2020.02新版
6
user/assets/css/animate.min.css
vendored
Normal file
5177
user/assets/css/app.css
Normal file
1
user/assets/css/captcha.css
Normal file
@@ -0,0 +1 @@
|
||||
#captcha_text{height:42px;width:100%;text-align:center;border-radius:2px;background-color:#F3F3F3;color:#BBBBBB;font-size:14px;letter-spacing:0.1px;line-height:42px}#captcha_wait{display:none;height:42px;width:100%;text-align:center;border-radius:2px;background-color:#F3F3F3}.loading{margin:auto;width:70px;height:20px}.loading-dot{float:left;width:8px;height:8px;margin:18px 4px;background:#ccc;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;opacity:0;-webkit-box-shadow:0 0 2px black;-moz-box-shadow:0 0 2px black;-ms-box-shadow:0 0 2px black;-o-box-shadow:0 0 2px black;box-shadow:0 0 2px black;-webkit-animation:loadingFade 1s infinite;-moz-animation:loadingFade 1s infinite;animation:loadingFade 1s infinite}.loading-dot:nth-child(1){-webkit-animation-delay:0s;-moz-animation-delay:0s;animation-delay:0s}.loading-dot:nth-child(2){-webkit-animation-delay:0.1s;-moz-animation-delay:0.1s;animation-delay:0.1s}.loading-dot:nth-child(3){-webkit-animation-delay:0.2s;-moz-animation-delay:0.2s;animation-delay:0.2s}.loading-dot:nth-child(4){-webkit-animation-delay:0.3s;-moz-animation-delay:0.3s;animation-delay:0.3s}@-webkit-keyframes loadingFade{0%{opacity:0}50%{opacity:0.8}100%{opacity:0}}@-moz-keyframes loadingFade{0%{opacity:0}50%{opacity:0.8}100%{opacity:0}}@keyframes loadingFade{0%{opacity:0}50%{opacity:0.8}100%{opacity:0}}
|
||||
18
user/assets/css/font.css
Normal file
@@ -0,0 +1,18 @@
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url('../fonts/sourcesanspro/sourcesanspro-light.woff') format('woff');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url('../fonts/sourcesanspro/sourcesanspro.woff') format('woff');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url('../fonts/sourcesanspro/sourcesanspro-bold.woff') format('woff');
|
||||
}
|
||||
BIN
user/assets/fonts/sourcesanspro/sourcesanspro-bold.woff
Normal file
BIN
user/assets/fonts/sourcesanspro/sourcesanspro-light.woff
Normal file
BIN
user/assets/fonts/sourcesanspro/sourcesanspro.woff
Normal file
BIN
user/assets/img/alipay.png
Normal file
|
After Width: | Height: | Size: 8.7 KiB |
BIN
user/assets/img/logo.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
user/assets/img/p0.jpg
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
user/assets/img/qr.png
Normal file
|
After Width: | Height: | Size: 95 KiB |
BIN
user/assets/img/user.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
4
user/assets/js/app.min.js
vendored
Normal file
227
user/assets/js/config.json
Normal file
@@ -0,0 +1,227 @@
|
||||
{
|
||||
"dongxue": {
|
||||
"qrWidth": "364",
|
||||
"qrHeight": "364",
|
||||
"foreground": "#E3D6C6",
|
||||
"background": "#FFFFFF",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "#FFFFFF",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 270,
|
||||
"qrTop": 340,
|
||||
"url": "https://img.alicdn.com/imgextra/i2/2027555802/O1CN0178X3hU1sjMWfmkoh5_!!2027555802.png"
|
||||
},
|
||||
"pikaqiu": {
|
||||
"qrWidth": "316",
|
||||
"qrHeight": "316",
|
||||
"foreground": "#FBCE29",
|
||||
"background": "#FFFFFF",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "#FFFFFF",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 290,
|
||||
"qrTop": 367,
|
||||
"url": "https://img.alicdn.com/imgextra/i3/2027555802/O1CN01ETL8eZ1sjMWf7GHlX_!!2027555802.png"
|
||||
},
|
||||
"kanuobudingmao": {
|
||||
"qrWidth": "316",
|
||||
"qrHeight": "316",
|
||||
"foreground": "#E1C6B1",
|
||||
"background": "#FFFFFF",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "#E1C6B1",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 290,
|
||||
"qrTop": 367,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN01bFGxSs1sjMWcWW1uR_!!2027555802.png"
|
||||
},
|
||||
"niannianyouyu": {
|
||||
"qrWidth": "370",
|
||||
"qrHeight": "370",
|
||||
"foreground": "#E62601",
|
||||
"background": "#FFFFFF",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "60px '黑体'",
|
||||
"fontColor": "#FFFFFF",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 255,
|
||||
"qrLeft": 270,
|
||||
"qrTop": 320,
|
||||
"url": "https://img.alicdn.com/imgextra/i1/2027555802/O1CN01T0g4kQ1sjMWf7HUZP_!!2027555802.png"
|
||||
},
|
||||
"xiaohuangren": {
|
||||
"qrWidth": "520",
|
||||
"qrHeight": "520",
|
||||
"foreground": "#F7D25D",
|
||||
"background": "#FFFFFF",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 183,
|
||||
"qrTop": 98,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN019MNjbn1sjMWe1zPkK_!!2027555802.png"
|
||||
},
|
||||
"qitao": {
|
||||
"qrWidth": "520",
|
||||
"qrHeight": "520",
|
||||
"foreground": "#212121",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 93,
|
||||
"qrTop": 98,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN01vCBhEb1sjMWbLYdfv_!!2027555802.png"
|
||||
},
|
||||
"baobei": {
|
||||
"qrWidth": "500",
|
||||
"qrHeight": "500",
|
||||
"foreground": "#A95B5E",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 200,
|
||||
"qrTop": 370,
|
||||
"url": "https://img.alicdn.com/imgextra/i3/2027555802/O1CN01ABc7nR1sjMWbLWQRm_!!2027555802.png"
|
||||
},
|
||||
"toushi": {
|
||||
"qrWidth": "400",
|
||||
"qrHeight": "400",
|
||||
"foreground": "#FDA3B8",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 408,
|
||||
"qrTop": 605,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN01mO4EYP1sjMWeSZtzX_!!2027555802.png"
|
||||
},
|
||||
"gongzhu": {
|
||||
"qrWidth": "520",
|
||||
"qrHeight": "520",
|
||||
"foreground": "#F36C79",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 185,
|
||||
"qrTop": 370,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN01LDfMYs1sjMWhTHmPR_!!2027555802.png"
|
||||
},
|
||||
"qiuzanzhu": {
|
||||
"qrWidth": "460",
|
||||
"qrHeight": "460",
|
||||
"foreground": "#F36C79",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 220,
|
||||
"qrTop": 425,
|
||||
"url": "https://img.alicdn.com/imgextra/i2/2027555802/O1CN01EAhVdL1sjMWe1yXjJ_!!2027555802.png"
|
||||
},
|
||||
"huanyingdashang": {
|
||||
"qrWidth": "510",
|
||||
"qrHeight": "510",
|
||||
"foreground": "#F00",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 195,
|
||||
"qrTop": 625,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN01Yuipi71sjMWhTI32u_!!2027555802.png"
|
||||
},
|
||||
"yinlian": {
|
||||
"qrWidth": "330",
|
||||
"qrHeight": "330",
|
||||
"foreground": "#fff",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 190,
|
||||
"qrTop": 180,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN01DU5ECy1sjMWe205L5_!!2027555802.png"
|
||||
},
|
||||
"yitiji": {
|
||||
"qrWidth": "380",
|
||||
"qrHeight": "380",
|
||||
"foreground": "#FB7C2F",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 260,
|
||||
"qrTop": 190,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN01B4y11v1sjMWeSGuWy_!!2027555802.png"
|
||||
},
|
||||
"maomi": {
|
||||
"qrWidth": "480",
|
||||
"qrHeight": "480",
|
||||
"foreground": "#FDD699",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 210,
|
||||
"qrTop": 150,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN017OCNEy1sjMWfe9Z3U_!!2027555802.png"
|
||||
},
|
||||
"longmao": {
|
||||
"qrWidth": "464",
|
||||
"qrHeight": "464",
|
||||
"foreground": "#7394B6",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 218,
|
||||
"qrTop": 214,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN01Jb4sxE1sjMWWkB2GX_!!2027555802.png"
|
||||
}
|
||||
}
|
||||
120
user/assets/js/onecode.js
Normal file
@@ -0,0 +1,120 @@
|
||||
var config;
|
||||
// 生成收款码
|
||||
function makeDiyBg(element, qrWidth, qrHeight, url, foreground, background, imgUrl, imgWidth, imgHeight, font, fontColor, recName, recNameLeft, recNameTop, qrLeft, qrTop) {
|
||||
$(element).qrcode({
|
||||
render: "canvas",
|
||||
width: qrWidth,
|
||||
height: qrHeight,
|
||||
text: url,
|
||||
foreground: foreground,
|
||||
background: background
|
||||
});
|
||||
var canvas = document.getElementById('canvas');
|
||||
canvas.width = imgWidth;
|
||||
canvas.height = imgHeight;
|
||||
var ctx = canvas.getContext("2d");
|
||||
var img = new Image();
|
||||
img.crossOrigin = "Anonymous"
|
||||
img.src = imgUrl;
|
||||
img.onload = function () {
|
||||
// 生成背景图
|
||||
var bg = ctx.createPattern(img, "no-repeat");
|
||||
ctx.fillStyle = bg;
|
||||
ctx.fillRect(0, 0, imgWidth, imgHeight);
|
||||
// 生成收款名
|
||||
ctx.textAlign = "center";
|
||||
ctx.font = font;
|
||||
ctx.fillStyle = fontColor;
|
||||
if (recName) {
|
||||
if (!recNameLeft) {
|
||||
recNameLeft = imgWidth / 2;
|
||||
}
|
||||
ctx.fillText("扫码向 " + recName + " 付款", recNameLeft, recNameTop);
|
||||
}
|
||||
// 在canvas上生成二维码
|
||||
var canvasOld = document.getElementsByTagName('canvas')[0];
|
||||
ctx.drawImage(canvasOld, qrLeft, qrTop);
|
||||
|
||||
|
||||
var image = new Image();
|
||||
image.crossOrigin = "Anonymous"
|
||||
image.src = canvas.toDataURL("image/png");
|
||||
$("#endImg").attr("src", image.src);
|
||||
$("#load").hide();
|
||||
$("#qrcode").show();
|
||||
}
|
||||
}
|
||||
function showQrCode(styleName){
|
||||
$("#load").show();
|
||||
$("#qrcode").hide();
|
||||
$("#code").empty();
|
||||
styleName = styleName || 'dongxue';
|
||||
var qrWidth = config[styleName].qrWidth;
|
||||
var qrHeight = config[styleName].qrHeight;
|
||||
var foreground = config[styleName].foreground;
|
||||
var background = config[styleName].background;
|
||||
var imgWidth = config[styleName].imgWidth;
|
||||
var imgHeight = config[styleName].imgHeight;
|
||||
var font = config[styleName].font;
|
||||
var fontColor = config[styleName].fontColor;
|
||||
var recNameLeft = config[styleName].recNameLeft;
|
||||
var recNameTop = config[styleName].recNameTop;
|
||||
var qrLeft = config[styleName].qrLeft;
|
||||
var qrTop = config[styleName].qrTop;
|
||||
var nowUrl = config[styleName].url;
|
||||
makeDiyBg("#code", qrWidth, qrHeight, $("#code_url").val(), foreground, background, nowUrl, imgWidth, imgHeight, font, fontColor, $("#recName").val(), recNameLeft, recNameTop, qrLeft, qrTop);
|
||||
}
|
||||
$(document).ready(function(){
|
||||
var clipboard = new Clipboard('.copy-btn');
|
||||
clipboard.on('success', function (e) {
|
||||
layer.msg('复制成功!', {icon: 1});
|
||||
});
|
||||
clipboard.on('error', function (e) {
|
||||
layer.msg('复制失败,请长按链接后手动复制', {icon: 2});
|
||||
});
|
||||
$("#editName").click(function(){
|
||||
var codename=$("input[name='codename']").val();
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax2.php?act=edit_codename",
|
||||
data : {codename:codename},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 1){
|
||||
layer.alert(data.msg, {icon: 1}, function(){window.location.reload()});
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
//点击按钮保存图片
|
||||
$("#downImg").click(function () {
|
||||
var img = document.getElementById('endImg');
|
||||
var url = img.src;
|
||||
var a = document.createElement('a');
|
||||
var event = new MouseEvent('click');
|
||||
a.download = '一码支付-' + document.getElementById("recName").value;
|
||||
a.href = url;
|
||||
a.dispatchEvent(event);
|
||||
});
|
||||
$("#styleName").change(function(){
|
||||
$.cookie('styleName',$(this).val());
|
||||
showQrCode($(this).val());
|
||||
});
|
||||
if($.cookie('styleName')){
|
||||
$("#styleName").val($.cookie('styleName'));
|
||||
}
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: "./assets/js/config.json",
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function (data) {
|
||||
config = data;
|
||||
$("#styleName").change();
|
||||
}
|
||||
})
|
||||
})
|
||||
115
user/assets/js/qrlogin.js
Normal file
@@ -0,0 +1,115 @@
|
||||
var interval1,interval2;
|
||||
function setCookie(name,value)
|
||||
{
|
||||
var exp = new Date();
|
||||
exp.setTime(exp.getTime() + 30*1000);
|
||||
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
|
||||
}
|
||||
function getCookie(name)
|
||||
{
|
||||
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
|
||||
if(arr=document.cookie.match(reg))
|
||||
return unescape(arr[2]);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
function getqrpic(force){
|
||||
force = force || false;
|
||||
cleartime();
|
||||
var qrsig = getCookie('qrsig');
|
||||
var qrimg = getCookie('qrimg');
|
||||
if(qrsig!=null && qrimg!=null && force==false){
|
||||
$('#qrimg').attr('qrsig',qrsig);
|
||||
$('#qrimg').html('<img id="qrcodeimg" onclick="getqrpic(true)" src="data:image/png;base64,'+qrimg+'" title="点击刷新">');
|
||||
if( /Android|SymbianOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone|Midp/i.test(navigator.userAgent) && navigator.userAgent.indexOf("QQ/") == -1) {
|
||||
$('#mobile').show();
|
||||
}
|
||||
interval1=setInterval(loginload,1000);
|
||||
interval2=setInterval(qrlogin,3000);
|
||||
}else{
|
||||
var getvcurl='qrlogin.php?do=getqrpic&r='+Math.random(1);
|
||||
$.get(getvcurl, function(d) {
|
||||
if(d.saveOK ==0){
|
||||
setCookie('qrsig',d.qrsig);
|
||||
setCookie('qrimg',d.data);
|
||||
$('#qrimg').attr('qrsig',d.qrsig);
|
||||
$('#qrimg').html('<img id="qrcodeimg" onclick="getqrpic(true)" src="data:image/png;base64,'+d.data+'" title="点击刷新">');
|
||||
if( /Android|SymbianOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone|Midp/i.test(navigator.userAgent) && navigator.userAgent.indexOf("QQ/") == -1) {
|
||||
$('#mobile').show();
|
||||
}
|
||||
interval1=setInterval(loginload,1000);
|
||||
interval2=setInterval(qrlogin,3000);
|
||||
}else{
|
||||
alert(d.msg);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
function qrlogin(){
|
||||
if ($('#login').attr("data-lock") === "true") return;
|
||||
var qrsig=$('#qrimg').attr('qrsig');
|
||||
var url = 'qrlogin.php?do=qrlogin&qrsig='+decodeURIComponent(qrsig)+'&r='+Math.random(1);
|
||||
$.get(url, function(d) {
|
||||
if(d.saveOK ==0){
|
||||
$('#loginmsg').html('QQ已成功登录!');
|
||||
$('#login').hide();
|
||||
$('#qrimg').hide();
|
||||
$('#submit').hide();
|
||||
$('#login').attr("data-lock", "true");
|
||||
$.get("connect.php?act=qrlogin&r="+Math.random(1), function(arr) {
|
||||
if(arr.code==0) {
|
||||
layer.msg(arr.msg, {icon: 16,time: 10000,shade:[0.3, "#000"]});
|
||||
setTimeout(function(){ window.location.href=arr.url }, 1000);
|
||||
}else{
|
||||
layer.alert(arr.msg);
|
||||
}
|
||||
}, 'json');
|
||||
cleartime();
|
||||
}else if(d.saveOK ==1){
|
||||
getqrpic(true);
|
||||
$('#loginmsg').html('请重新扫描二维码');
|
||||
}else if(d.saveOK ==2){
|
||||
$('#loginmsg').html('使用QQ手机版扫描二维码');
|
||||
}else if(d.saveOK ==3){
|
||||
$('#loginmsg').html('扫描成功,请在手机上确认授权登录');
|
||||
}else if(d.saveOK ==4){
|
||||
cleartime();
|
||||
$('#loginmsg').html('QQ验证失败,请解除登录异常后重试!');
|
||||
}else{
|
||||
cleartime();
|
||||
$('#loginmsg').html(d.msg);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
function loginload(){
|
||||
if ($('#login').attr("data-lock") === "true") return;
|
||||
var load=document.getElementById('loginload').innerHTML;
|
||||
var len=load.length;
|
||||
if(len>2){
|
||||
load='.';
|
||||
}else{
|
||||
load+='.';
|
||||
}
|
||||
document.getElementById('loginload').innerHTML=load;
|
||||
}
|
||||
function cleartime(){
|
||||
clearInterval(interval1);
|
||||
clearInterval(interval2);
|
||||
}
|
||||
function mloginurl(){
|
||||
var imagew = $('#qrcodeimg').attr('src');
|
||||
imagew = imagew.replace(/data:image\/png;base64,/, "");
|
||||
$('#mlogin').html("正在跳转...");
|
||||
$.post("connect.php?act=qrcode&r="+Math.random(1),"image="+encodeURIComponent(imagew), function(arr) {
|
||||
if(arr.code==0) {
|
||||
$('#loginmsg').html('跳转到QQ登录后请返回此页面');
|
||||
window.location.href='mqqapi://forward/url?version=1&src_type=web&url_prefix='+window.btoa(arr.url);
|
||||
}else{
|
||||
alert(arr.msg);
|
||||
}
|
||||
$('#mlogin').html("跳转QQ快捷登录");
|
||||
}, 'json');
|
||||
}
|
||||
$(document).ready(function(){
|
||||
getqrpic();
|
||||
});
|
||||
46
user/assets/js/ui-jp.config.js
Normal file
@@ -0,0 +1,46 @@
|
||||
// lazyload config
|
||||
|
||||
var jp_config = {
|
||||
easyPieChart: [ './assets/vendor/jquery.easy-pie-chart/dist/jquery.easypiechart.fill.js'],
|
||||
sparkline: [ './assets/vendor/jquery.sparkline/dist/jquery.sparkline.retina.js'],
|
||||
plot: [ './assets/vendor/flot/jquery.flot.js',
|
||||
'./assets/vendor/flot/jquery.flot.pie.js',
|
||||
'./assets/vendor/flot/jquery.flot.resize.js',
|
||||
'./assets/vendor/flot.tooltip/js/jquery.flot.tooltip.min.js',
|
||||
'./assets/vendor/flot.orderbars/js/jquery.flot.orderBars.js',
|
||||
'./assets/vendor/flot-spline/js/jquery.flot.spline.min.js'],
|
||||
moment: [ './assets/vendor/moment/moment.js'],
|
||||
screenfull: [ './assets/vendor/screenfull/dist/screenfull.min.js'],
|
||||
slimScroll: [ './assets/vendor/slimscroll/jquery.slimscroll.min.js'],
|
||||
sortable: [ './assets/vendor/html5sortable/jquery.sortable.js'],
|
||||
nestable: [ './assets/vendor/nestable/jquery.nestable.js',
|
||||
'./assets/vendor/nestable/jquery.nestable.css'],
|
||||
filestyle: [ './assets/vendor/bootstrap-filestyle/src/bootstrap-filestyle.js'],
|
||||
slider: [ './assets/vendor/bootstrap-slider/bootstrap-slider.js',
|
||||
'./assets/vendor/bootstrap-slider/bootstrap-slider.css'],
|
||||
chosen: [ './assets/vendor/chosen/chosen.jquery.min.js',
|
||||
'./assets/vendor/bootstrap-chosen/bootstrap-chosen.css'],
|
||||
TouchSpin: [ './assets/vendor/bootstrap-touchspin/dist/jquery.bootstrap-touchspin.min.js',
|
||||
'./assets/vendor/bootstrap-touchspin/dist/jquery.bootstrap-touchspin.min.css'],
|
||||
wysiwyg: [ './assets/vendor/bootstrap-wysiwyg/bootstrap-wysiwyg.js',
|
||||
'./assets/vendor/bootstrap-wysiwyg/external/jquery.hotkeys.js'],
|
||||
dataTable: [ './assets/vendor/datatables/media/js/jquery.dataTables.min.js',
|
||||
'./assets/vendor/plugins/integration/bootstrap/3/dataTables.bootstrap.js',
|
||||
'./assets/vendor/plugins/integration/bootstrap/3/dataTables.bootstrap.css'],
|
||||
vectorMap: [ './assets/vendor/bower-jvectormap/jquery-jvectormap-1.2.2.min.js',
|
||||
'./assets/vendor/bower-jvectormap/jquery-jvectormap-world-mill-en.js',
|
||||
'./assets/vendor/bower-jvectormap/jquery-jvectormap-us-aea-en.js',
|
||||
'./assets/vendor/bower-jvectormap/jquery-jvectormap-1.2.2.css'],
|
||||
footable: [ './assets/vendor/footable/dist/footable.all.min.js',
|
||||
'./assets/vendor/footable/css/footable.core.css'],
|
||||
fullcalendar: [ './assets/vendor/moment/moment.js',
|
||||
'./assets/vendor/fullcalendar/dist/fullcalendar.min.js',
|
||||
'./assets/vendor/fullcalendar/dist/fullcalendar.css',
|
||||
'./assets/vendor/fullcalendar/dist/fullcalendar.theme.css'],
|
||||
daterangepicker:[ './assets/vendor/moment/moment.js',
|
||||
'./assets/vendor/bootstrap-daterangepicker/daterangepicker.js',
|
||||
'./assets/vendor/bootstrap-daterangepicker/daterangepicker-bs3.css'],
|
||||
tagsinput: [ './assets/vendor/bootstrap-tagsinput/dist/bootstrap-tagsinput.js',
|
||||
'./assets/vendor/bootstrap-tagsinput/dist/bootstrap-tagsinput.css']
|
||||
|
||||
};
|
||||
19
user/assets/js/ui-jp.js
Normal file
@@ -0,0 +1,19 @@
|
||||
+function ($) {
|
||||
|
||||
$(function(){
|
||||
|
||||
$("[ui-jq]").each(function(){
|
||||
var self = $(this);
|
||||
var options = eval('[' + self.attr('ui-options') + ']');
|
||||
|
||||
if ($.isPlainObject(options[0])) {
|
||||
options[0] = $.extend({}, options[0]);
|
||||
}
|
||||
|
||||
uiLoad.load(jp_config[self.attr('ui-jq')]).then( function(){
|
||||
self[self.attr('ui-jq')].apply(self, options);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}(jQuery);
|
||||
86
user/assets/js/ui-load.js
Normal file
@@ -0,0 +1,86 @@
|
||||
|
||||
/**
|
||||
* 0.1.0
|
||||
* Deferred load js/css file, used for ui-jq.js and Lazy Loading.
|
||||
*
|
||||
* @ flatfull.com All Rights Reserved.
|
||||
* Author url: http://themeforest.net/user/flatfull
|
||||
*/
|
||||
var uiLoad = uiLoad || {};
|
||||
|
||||
(function($, $document, uiLoad) {
|
||||
"use strict";
|
||||
|
||||
var loaded = [],
|
||||
promise = false,
|
||||
deferred = $.Deferred();
|
||||
|
||||
/**
|
||||
* Chain loads the given sources
|
||||
* @param srcs array, script or css
|
||||
* @returns {*} Promise that will be resolved once the sources has been loaded.
|
||||
*/
|
||||
uiLoad.load = function (srcs) {
|
||||
srcs = $.isArray(srcs) ? srcs : srcs.split(/\s+/);
|
||||
if(!promise){
|
||||
promise = deferred.promise();
|
||||
}
|
||||
|
||||
$.each(srcs, function(index, src) {
|
||||
promise = promise.then( function(){
|
||||
return src.indexOf('.css') >=0 ? loadCSS(src) : loadScript(src);
|
||||
} );
|
||||
});
|
||||
deferred.resolve();
|
||||
return promise;
|
||||
};
|
||||
|
||||
/**
|
||||
* Dynamically loads the given script
|
||||
* @param src The url of the script to load dynamically
|
||||
* @returns {*} Promise that will be resolved once the script has been loaded.
|
||||
*/
|
||||
var loadScript = function (src) {
|
||||
if(loaded[src]) return loaded[src].promise();
|
||||
|
||||
var deferred = $.Deferred();
|
||||
var script = $document.createElement('script');
|
||||
script.src = src;
|
||||
script.onload = function (e) {
|
||||
deferred.resolve(e);
|
||||
};
|
||||
script.onerror = function (e) {
|
||||
deferred.reject(e);
|
||||
};
|
||||
$document.body.appendChild(script);
|
||||
loaded[src] = deferred;
|
||||
|
||||
return deferred.promise();
|
||||
};
|
||||
|
||||
/**
|
||||
* Dynamically loads the given CSS file
|
||||
* @param href The url of the CSS to load dynamically
|
||||
* @returns {*} Promise that will be resolved once the CSS file has been loaded.
|
||||
*/
|
||||
var loadCSS = function (href) {
|
||||
if(loaded[href]) return loaded[href].promise();
|
||||
|
||||
var deferred = $.Deferred();
|
||||
var style = $document.createElement('link');
|
||||
style.rel = 'stylesheet';
|
||||
style.type = 'text/css';
|
||||
style.href = href;
|
||||
style.onload = function (e) {
|
||||
deferred.resolve(e);
|
||||
};
|
||||
style.onerror = function (e) {
|
||||
deferred.reject(e);
|
||||
};
|
||||
$document.head.appendChild(style);
|
||||
loaded[href] = deferred;
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
})(jQuery, document, uiLoad);
|
||||
20
user/assets/js/ui-nav.js
Normal file
@@ -0,0 +1,20 @@
|
||||
+function ($) {
|
||||
|
||||
$(function(){
|
||||
|
||||
// nav
|
||||
$(document).on('click', '[ui-nav] a', function (e) {
|
||||
var $this = $(e.target), $active;
|
||||
$this.is('a') || ($this = $this.closest('a'));
|
||||
|
||||
$active = $this.parent().siblings( ".active" );
|
||||
$active && $active.toggleClass('active').find('> ul:visible').slideUp(200);
|
||||
|
||||
($this.parent().hasClass('active') && $this.next().slideUp(200)) || $this.next().slideDown(200);
|
||||
$this.parent().toggleClass('active');
|
||||
|
||||
$this.next().is('ul') && e.preventDefault();
|
||||
});
|
||||
|
||||
});
|
||||
}(jQuery);
|
||||
14
user/assets/js/ui-toggle.js
Normal file
@@ -0,0 +1,14 @@
|
||||
+function ($) {
|
||||
|
||||
$(function(){
|
||||
|
||||
$(document).on('click', '[ui-toggle]', function (e) {
|
||||
e.preventDefault();
|
||||
var $this = $(e.target);
|
||||
$this.attr('ui-toggle') || ($this = $this.closest('[ui-toggle]'));
|
||||
var $target = $($this.attr('target')) || $this;
|
||||
$target.toggleClass($this.attr('ui-toggle'));
|
||||
});
|
||||
|
||||
});
|
||||
}(jQuery);
|
||||
399
user/assets/vendor/chosen/bootstrap-chosen.css
vendored
Normal file
@@ -0,0 +1,399 @@
|
||||
.chosen-select {
|
||||
width: 100%;
|
||||
}
|
||||
.chosen-select-deselect {
|
||||
width: 100%;
|
||||
}
|
||||
.chosen-container {
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.chosen-container .chosen-drop {
|
||||
background: #ffffff;
|
||||
border: 1px solid #cccccc;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
-webkit-box-shadow: 0 8px 8px rgba(0, 0, 0, .25);
|
||||
box-shadow: 0 8px 8px rgba(0, 0, 0, .25);
|
||||
margin-top: -1px;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: -9000px;
|
||||
z-index: 1060;
|
||||
}
|
||||
.chosen-container.chosen-with-drop .chosen-drop {
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
.chosen-container .chosen-results {
|
||||
color: #555555;
|
||||
margin: 0 4px 4px 0;
|
||||
max-height: 240px;
|
||||
padding: 0 0 0 4px;
|
||||
position: relative;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
.chosen-container .chosen-results li {
|
||||
display: none;
|
||||
line-height: 1.42857143;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 5px 6px;
|
||||
}
|
||||
.chosen-container .chosen-results li em {
|
||||
background: #feffde;
|
||||
font-style: normal;
|
||||
}
|
||||
.chosen-container .chosen-results li.group-result {
|
||||
display: list-item;
|
||||
cursor: default;
|
||||
color: #999;
|
||||
font-weight: bold;
|
||||
}
|
||||
.chosen-container .chosen-results li.group-option {
|
||||
padding-left: 15px;
|
||||
}
|
||||
.chosen-container .chosen-results li.active-result {
|
||||
cursor: pointer;
|
||||
display: list-item;
|
||||
}
|
||||
.chosen-container .chosen-results li.highlighted {
|
||||
background-color: #337ab7;
|
||||
background-image: none;
|
||||
color: white;
|
||||
}
|
||||
.chosen-container .chosen-results li.highlighted em {
|
||||
background: transparent;
|
||||
}
|
||||
.chosen-container .chosen-results li.disabled-result {
|
||||
display: list-item;
|
||||
color: #777777;
|
||||
}
|
||||
.chosen-container .chosen-results .no-results {
|
||||
background: #eeeeee;
|
||||
display: list-item;
|
||||
}
|
||||
.chosen-container .chosen-results-scroll {
|
||||
background: white;
|
||||
margin: 0 4px;
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
width: 321px;
|
||||
z-index: 1;
|
||||
}
|
||||
.chosen-container .chosen-results-scroll span {
|
||||
display: inline-block;
|
||||
height: 1.42857143;
|
||||
text-indent: -5000px;
|
||||
width: 9px;
|
||||
}
|
||||
.chosen-container .chosen-results-scroll-down {
|
||||
bottom: 0;
|
||||
}
|
||||
.chosen-container .chosen-results-scroll-down span {
|
||||
background: url("chosen-sprite.png") no-repeat -4px -3px;
|
||||
}
|
||||
.chosen-container .chosen-results-scroll-up span {
|
||||
background: url("chosen-sprite.png") no-repeat -22px -3px;
|
||||
}
|
||||
.chosen-container-single .chosen-single {
|
||||
background-color: #ffffff;
|
||||
-webkit-background-clip: padding-box;
|
||||
-moz-background-clip: padding;
|
||||
background-clip: padding-box;
|
||||
border: 1px solid #cccccc;
|
||||
border-top-right-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
color: #555555;
|
||||
display: block;
|
||||
height: 34px;
|
||||
overflow: hidden;
|
||||
line-height: 34px;
|
||||
padding: 0 0 0 8px;
|
||||
position: relative;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.chosen-container-single .chosen-single span {
|
||||
display: block;
|
||||
margin-right: 26px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.chosen-container-single .chosen-single abbr {
|
||||
background: url("chosen-sprite.png") right top no-repeat;
|
||||
display: block;
|
||||
font-size: 1px;
|
||||
height: 10px;
|
||||
position: absolute;
|
||||
right: 26px;
|
||||
top: 12px;
|
||||
width: 12px;
|
||||
}
|
||||
.chosen-container-single .chosen-single abbr:hover {
|
||||
background-position: right -11px;
|
||||
}
|
||||
.chosen-container-single .chosen-single.chosen-disabled .chosen-single abbr:hover {
|
||||
background-position: right 2px;
|
||||
}
|
||||
.chosen-container-single .chosen-single div {
|
||||
display: block;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 18px;
|
||||
}
|
||||
.chosen-container-single .chosen-single div b {
|
||||
background: url("chosen-sprite.png") no-repeat 0 7px;
|
||||
display: block;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.chosen-container-single .chosen-default {
|
||||
color: #777777;
|
||||
}
|
||||
.chosen-container-single .chosen-search {
|
||||
margin: 0;
|
||||
padding: 3px 4px;
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
z-index: 1000;
|
||||
}
|
||||
.chosen-container-single .chosen-search input[type="text"] {
|
||||
background: url("chosen-sprite.png") no-repeat 100% -20px, #ffffff;
|
||||
border: 1px solid #cccccc;
|
||||
border-top-right-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
margin: 1px 0;
|
||||
padding: 4px 20px 4px 4px;
|
||||
width: 100%;
|
||||
}
|
||||
.chosen-container-single .chosen-drop {
|
||||
margin-top: -1px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
-webkit-background-clip: padding-box;
|
||||
-moz-background-clip: padding;
|
||||
background-clip: padding-box;
|
||||
}
|
||||
.chosen-container-single-nosearch .chosen-search input {
|
||||
position: absolute;
|
||||
left: -9000px;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices {
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #cccccc;
|
||||
border-top-right-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
cursor: text;
|
||||
height: auto !important;
|
||||
height: 1%;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li {
|
||||
float: left;
|
||||
list-style: none;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices .search-field {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices .search-field input[type="text"] {
|
||||
background: transparent !important;
|
||||
border: 0 !important;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
color: #555555;
|
||||
height: 32px;
|
||||
margin: 0;
|
||||
padding: 4px;
|
||||
outline: 0;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices .search-field .default {
|
||||
color: #999;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices .search-choice {
|
||||
-webkit-background-clip: padding-box;
|
||||
-moz-background-clip: padding;
|
||||
background-clip: padding-box;
|
||||
background-color: #eeeeee;
|
||||
border: 1px solid #cccccc;
|
||||
border-top-right-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
color: #333333;
|
||||
cursor: default;
|
||||
line-height: 13px;
|
||||
margin: 6px 0 3px 5px;
|
||||
padding: 3px 20px 3px 5px;
|
||||
position: relative;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices .search-choice .search-choice-close {
|
||||
background: url("chosen-sprite.png") right top no-repeat;
|
||||
display: block;
|
||||
font-size: 1px;
|
||||
height: 10px;
|
||||
position: absolute;
|
||||
right: 4px;
|
||||
top: 5px;
|
||||
width: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices .search-choice .search-choice-close:hover {
|
||||
background-position: right -11px;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices .search-choice-focus {
|
||||
background: #d4d4d4;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices .search-choice-focus .search-choice-close {
|
||||
background-position: right -11px;
|
||||
}
|
||||
.chosen-container-multi .chosen-results {
|
||||
margin: 0 0 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
.chosen-container-multi .chosen-drop .result-selected {
|
||||
display: none;
|
||||
}
|
||||
.chosen-container-active .chosen-single {
|
||||
border: 1px solid #66afe9;
|
||||
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .075) inset, 0 0 8px rgba(82, 168, 236, .6);
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, .075) inset, 0 0 8px rgba(82, 168, 236, .6);
|
||||
-webkit-transition: border linear .2s, box-shadow linear .2s;
|
||||
-o-transition: border linear .2s, box-shadow linear .2s;
|
||||
transition: border linear .2s, box-shadow linear .2s;
|
||||
}
|
||||
.chosen-container-active.chosen-with-drop .chosen-single {
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #66afe9;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .075) inset, 0 0 8px rgba(82, 168, 236, .6);
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, .075) inset, 0 0 8px rgba(82, 168, 236, .6);
|
||||
-webkit-transition: border linear .2s, box-shadow linear .2s;
|
||||
-o-transition: border linear .2s, box-shadow linear .2s;
|
||||
transition: border linear .2s, box-shadow linear .2s;
|
||||
}
|
||||
.chosen-container-active.chosen-with-drop .chosen-single div {
|
||||
background: transparent;
|
||||
border-left: none;
|
||||
}
|
||||
.chosen-container-active.chosen-with-drop .chosen-single div b {
|
||||
background-position: -18px 7px;
|
||||
}
|
||||
.chosen-container-active .chosen-choices {
|
||||
border: 1px solid #66afe9;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .075) inset, 0 0 8px rgba(82, 168, 236, .6);
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, .075) inset, 0 0 8px rgba(82, 168, 236, .6);
|
||||
-webkit-transition: border linear .2s, box-shadow linear .2s;
|
||||
-o-transition: border linear .2s, box-shadow linear .2s;
|
||||
transition: border linear .2s, box-shadow linear .2s;
|
||||
}
|
||||
.chosen-container-active .chosen-choices .search-field input[type="text"] {
|
||||
color: #111 !important;
|
||||
}
|
||||
.chosen-container-active.chosen-with-drop .chosen-choices {
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
.chosen-disabled {
|
||||
cursor: default;
|
||||
opacity: 0.5 !important;
|
||||
}
|
||||
.chosen-disabled .chosen-single {
|
||||
cursor: default;
|
||||
}
|
||||
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
|
||||
cursor: default;
|
||||
}
|
||||
.chosen-rtl {
|
||||
text-align: right;
|
||||
}
|
||||
.chosen-rtl .chosen-single {
|
||||
padding: 0 8px 0 0;
|
||||
overflow: visible;
|
||||
}
|
||||
.chosen-rtl .chosen-single span {
|
||||
margin-left: 26px;
|
||||
margin-right: 0;
|
||||
direction: rtl;
|
||||
}
|
||||
.chosen-rtl .chosen-single div {
|
||||
left: 7px;
|
||||
right: auto;
|
||||
}
|
||||
.chosen-rtl .chosen-single abbr {
|
||||
left: 26px;
|
||||
right: auto;
|
||||
}
|
||||
.chosen-rtl .chosen-choices .search-field input[type="text"] {
|
||||
direction: rtl;
|
||||
}
|
||||
.chosen-rtl .chosen-choices li {
|
||||
float: right;
|
||||
}
|
||||
.chosen-rtl .chosen-choices .search-choice {
|
||||
margin: 6px 5px 3px 0;
|
||||
padding: 3px 5px 3px 19px;
|
||||
}
|
||||
.chosen-rtl .chosen-choices .search-choice .search-choice-close {
|
||||
background-position: right top;
|
||||
left: 4px;
|
||||
right: auto;
|
||||
}
|
||||
.chosen-rtl.chosen-container-single .chosen-results {
|
||||
margin: 0 0 4px 4px;
|
||||
padding: 0 4px 0 0;
|
||||
}
|
||||
.chosen-rtl .chosen-results .group-option {
|
||||
padding-left: 0;
|
||||
padding-right: 15px;
|
||||
}
|
||||
.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
|
||||
border-right: none;
|
||||
}
|
||||
.chosen-rtl .chosen-search input[type="text"] {
|
||||
background: url("chosen-sprite.png") no-repeat -28px -20px, #ffffff;
|
||||
direction: rtl;
|
||||
padding: 4px 5px 4px 20px;
|
||||
}
|
||||
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 2dppx) {
|
||||
.chosen-rtl .chosen-search input[type="text"],
|
||||
.chosen-container-single .chosen-single abbr,
|
||||
.chosen-container-single .chosen-single div b,
|
||||
.chosen-container-single .chosen-search input[type="text"],
|
||||
.chosen-container-multi .chosen-choices .search-choice .search-choice-close,
|
||||
.chosen-container .chosen-results-scroll-down span,
|
||||
.chosen-container .chosen-results-scroll-up span {
|
||||
background-image: url("chosen-sprite@2x.png") !important;
|
||||
background-size: 52px 37px !important;
|
||||
background-repeat: no-repeat !important;
|
||||
}
|
||||
}
|
||||
BIN
user/assets/vendor/chosen/chosen-sprite.png
vendored
Normal file
|
After Width: | Height: | Size: 646 B |
BIN
user/assets/vendor/chosen/chosen-sprite@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 872 B |
2
user/assets/vendor/chosen/chosen.jquery.min.js
vendored
Normal file
1
user/assets/vendor/flot-spline/js/jquery.flot.spline.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(a){"use strict";function b(a,b,c,d,e,f,g){var j,k,l,m,n,o,p,q,h=Math.pow,i=Math.sqrt;return j=i(h(c-a,2)+h(d-b,2)),k=i(h(e-c,2)+h(f-d,2)),l=g*j/(j+k),m=g-l,n=c+l*(a-e),o=d+l*(b-f),p=c-m*(a-e),q=d-m*(b-f),[n,o,p,q]}function d(b,c,d,e,f){var g=a.color.parse(f);g.a="number"==typeof e?e:.3,g.normalize(),g=g.toString(),c.beginPath(),c.moveTo(b[0][0],b[0][1]);for(var h=b.length,i=0;h>i;i++)c[b[i][3]].apply(c,b[i][2]);c.stroke(),c.lineWidth=0,c.lineTo(b[h-1][0],d),c.lineTo(b[0][0],d),c.closePath(),e!==!1&&(c.fillStyle=g,c.fill())}function e(a,b,d,e){(void 0===b||"bezier"!==b&&"quadratic"!==b)&&(b="quadratic"),b+="CurveTo",0==c.length?c.push([d[0],d[1],e.concat(d.slice(2)),b]):"quadraticCurveTo"==b&&2==d.length?(e=e.slice(0,2).concat(d),c.push([d[0],d[1],e,b])):c.push([d[2],d[3],e.concat(d.slice(2)),b])}function f(f,g,h){if(h.splines.show===!0){var k,l,m,i=[],j=h.splines.tension||.5,n=h.datapoints.points,o=h.datapoints.pointsize,p=f.getPlotOffset(),q=n.length,r=[];if(c=[],4>q/o)return a.extend(h.lines,h.splines),void 0;for(k=0;q>k;k+=o)l=n[k],m=n[k+1],null==l||l<h.xaxis.min||l>h.xaxis.max||m<h.yaxis.min||m>h.yaxis.max||r.push(h.xaxis.p2c(l)+p.left,h.yaxis.p2c(m)+p.top);for(q=r.length,k=0;q-2>k;k+=2)i=i.concat(b.apply(this,r.slice(k,k+6).concat([j])));for(g.save(),g.strokeStyle=h.color,g.lineWidth=h.splines.lineWidth,e(g,"quadratic",r.slice(0,4),i.slice(0,2)),k=2;q-3>k;k+=2)e(g,"bezier",r.slice(k,k+4),i.slice(2*k-2,2*k+2));e(g,"quadratic",r.slice(q-2,q),[i[2*q-10],i[2*q-9],r[q-4],r[q-3]]),d(c,g,f.height()+10,h.splines.fill,h.color),g.restore()}}var c=[];a.plot.plugins.push({init:function(a){a.hooks.drawSeries.push(f)},options:{series:{splines:{show:!1,lineWidth:2,tension:.5,fill:!1}}},name:"spline",version:"0.8.2"})}(jQuery);
|
||||
201
user/assets/vendor/flot.orderbars/js/jquery.flot.orderBars.js
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
/*
|
||||
* Flot plugin to order bars side by side.
|
||||
*
|
||||
* Released under the MIT license by Benjamin BUFFET, 20-Sep-2010.
|
||||
* Modifications made by Steven Hall <github.com/emmerich>, 01-May-2013.
|
||||
*
|
||||
* This plugin is an alpha version.
|
||||
*
|
||||
* To activate the plugin you must specify the parameter "order" for the specific serie :
|
||||
*
|
||||
* $.plot($("#placeholder"), [{ data: [ ... ], bars :{ order = null or integer }])
|
||||
*
|
||||
* If 2 series have the same order param, they are ordered by the position in the array;
|
||||
*
|
||||
* The plugin adjust the point by adding a value depanding of the barwidth
|
||||
* Exemple for 3 series (barwidth : 0.1) :
|
||||
*
|
||||
* first bar décalage : -0.15
|
||||
* second bar décalage : -0.05
|
||||
* third bar décalage : 0.05
|
||||
*
|
||||
*/
|
||||
|
||||
// INFO: decalage/decallage is French for gap. It's used to denote the spacing applied to each
|
||||
// bar.
|
||||
(function($){
|
||||
function init(plot){
|
||||
var orderedBarSeries;
|
||||
var nbOfBarsToOrder;
|
||||
var borderWidth;
|
||||
var borderWidthInXabsWidth;
|
||||
var pixelInXWidthEquivalent = 1;
|
||||
var isHorizontal = false;
|
||||
|
||||
// A mapping of order integers to decallage.
|
||||
var decallageByOrder = {};
|
||||
|
||||
/*
|
||||
* This method add shift to x values
|
||||
*/
|
||||
function reOrderBars(plot, serie, datapoints){
|
||||
var shiftedPoints = null;
|
||||
|
||||
if(serieNeedToBeReordered(serie)){
|
||||
checkIfGraphIsHorizontal(serie);
|
||||
calculPixel2XWidthConvert(plot);
|
||||
retrieveBarSeries(plot);
|
||||
calculBorderAndBarWidth(serie);
|
||||
|
||||
if(nbOfBarsToOrder >= 2){
|
||||
var position = findPosition(serie);
|
||||
var decallage = 0;
|
||||
|
||||
var centerBarShift = calculCenterBarShift();
|
||||
|
||||
// If we haven't already calculated the decallage for this order value, do it.
|
||||
if(typeof decallageByOrder[serie.bars.order] === 'undefined') {
|
||||
if (isBarAtLeftOfCenter(position)){
|
||||
decallageByOrder[serie.bars.order] = -1*(sumWidth(orderedBarSeries,position-1,Math.floor(nbOfBarsToOrder / 2)-1)) - centerBarShift;
|
||||
}else{
|
||||
decallageByOrder[serie.bars.order] = sumWidth(orderedBarSeries,Math.ceil(nbOfBarsToOrder / 2),position-2) + centerBarShift + borderWidthInXabsWidth*2;
|
||||
}
|
||||
}
|
||||
|
||||
// Lookup the decallage based on the series' order value.
|
||||
decallage = decallageByOrder[serie.bars.order];
|
||||
|
||||
shiftedPoints = shiftPoints(datapoints,serie,decallage);
|
||||
datapoints.points = shiftedPoints;
|
||||
}
|
||||
}
|
||||
return shiftedPoints;
|
||||
}
|
||||
|
||||
function serieNeedToBeReordered(serie){
|
||||
return serie.bars != null
|
||||
&& serie.bars.show
|
||||
&& serie.bars.order != null;
|
||||
}
|
||||
|
||||
function calculPixel2XWidthConvert(plot){
|
||||
var gridDimSize = isHorizontal ? plot.getPlaceholder().innerHeight() : plot.getPlaceholder().innerWidth();
|
||||
var minMaxValues = isHorizontal ? getAxeMinMaxValues(plot.getData(),1) : getAxeMinMaxValues(plot.getData(),0);
|
||||
var AxeSize = minMaxValues[1] - minMaxValues[0];
|
||||
pixelInXWidthEquivalent = AxeSize / gridDimSize;
|
||||
}
|
||||
|
||||
function getAxeMinMaxValues(series,AxeIdx){
|
||||
var minMaxValues = new Array();
|
||||
for(var i = 0; i < series.length; i++){
|
||||
minMaxValues[0] = series[i].data[0][AxeIdx];
|
||||
minMaxValues[1] = series[i].data[series[i].data.length - 1][AxeIdx];
|
||||
}
|
||||
return minMaxValues;
|
||||
}
|
||||
|
||||
function retrieveBarSeries(plot){
|
||||
orderedBarSeries = findOthersBarsToReOrders(plot.getData());
|
||||
nbOfBarsToOrder = orderedBarSeries.length;
|
||||
}
|
||||
|
||||
function findOthersBarsToReOrders(series){
|
||||
var retSeries = new Array();
|
||||
var orderValuesSeen = [];
|
||||
|
||||
for(var i = 0; i < series.length; i++){
|
||||
if(series[i].bars.order != null && series[i].bars.show &&
|
||||
orderValuesSeen.indexOf(series[i].bars.order) < 0){
|
||||
|
||||
orderValuesSeen.push(series[i].bars.order);
|
||||
retSeries.push(series[i]);
|
||||
}
|
||||
}
|
||||
return retSeries.sort(sortByOrder);
|
||||
}
|
||||
|
||||
function sortByOrder(serie1,serie2){
|
||||
var x = serie1.bars.order;
|
||||
var y = serie2.bars.order;
|
||||
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
|
||||
}
|
||||
|
||||
function calculBorderAndBarWidth(serie){
|
||||
borderWidth = typeof serie.bars.lineWidth !== 'undefined' ? serie.bars.lineWidth : 2;
|
||||
borderWidthInXabsWidth = borderWidth * pixelInXWidthEquivalent;
|
||||
}
|
||||
|
||||
function checkIfGraphIsHorizontal(serie){
|
||||
if(serie.bars.horizontal){
|
||||
isHorizontal = true;
|
||||
}
|
||||
}
|
||||
|
||||
function findPosition(serie){
|
||||
var pos = 0
|
||||
for (var i = 0; i < orderedBarSeries.length; ++i) {
|
||||
if (serie == orderedBarSeries[i]){
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return pos+1;
|
||||
}
|
||||
|
||||
function calculCenterBarShift(){
|
||||
var width = 0;
|
||||
|
||||
if(nbOfBarsToOrder%2 != 0)
|
||||
width = (orderedBarSeries[Math.ceil(nbOfBarsToOrder / 2)].bars.barWidth)/2;
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
function isBarAtLeftOfCenter(position){
|
||||
return position <= Math.ceil(nbOfBarsToOrder / 2);
|
||||
}
|
||||
|
||||
function sumWidth(series,start,end){
|
||||
var totalWidth = 0;
|
||||
|
||||
for(var i = start; i <= end; i++){
|
||||
totalWidth += series[i].bars.barWidth+borderWidthInXabsWidth*2;
|
||||
}
|
||||
|
||||
return totalWidth;
|
||||
}
|
||||
|
||||
function shiftPoints(datapoints,serie,dx){
|
||||
var ps = datapoints.pointsize;
|
||||
var points = datapoints.points;
|
||||
var j = 0;
|
||||
for(var i = isHorizontal ? 1 : 0;i < points.length; i += ps){
|
||||
points[i] += dx;
|
||||
//Adding the new x value in the serie to be abble to display the right tooltip value,
|
||||
//using the index 3 to not overide the third index.
|
||||
serie.data[j][3] = points[i];
|
||||
j++;
|
||||
}
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
plot.hooks.processDatapoints.push(reOrderBars);
|
||||
|
||||
}
|
||||
|
||||
var options = {
|
||||
series : {
|
||||
bars: {order: null} // or number/string
|
||||
}
|
||||
};
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: "orderBars",
|
||||
version: "0.2"
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
12
user/assets/vendor/flot.tooltip/js/jquery.flot.tooltip.min.js
vendored
Normal file
3168
user/assets/vendor/flot/jquery.flot.js
vendored
Normal file
820
user/assets/vendor/flot/jquery.flot.pie.js
vendored
Normal file
@@ -0,0 +1,820 @@
|
||||
/* Flot plugin for rendering pie charts.
|
||||
|
||||
Copyright (c) 2007-2014 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
The plugin assumes that each series has a single data value, and that each
|
||||
value is a positive integer or zero. Negative numbers don't make sense for a
|
||||
pie chart, and have unpredictable results. The values do NOT need to be
|
||||
passed in as percentages; the plugin will calculate the total and per-slice
|
||||
percentages internally.
|
||||
|
||||
* Created by Brian Medendorp
|
||||
|
||||
* Updated with contributions from btburnett3, Anthony Aragues and Xavi Ivars
|
||||
|
||||
The plugin supports these options:
|
||||
|
||||
series: {
|
||||
pie: {
|
||||
show: true/false
|
||||
radius: 0-1 for percentage of fullsize, or a specified pixel length, or 'auto'
|
||||
innerRadius: 0-1 for percentage of fullsize or a specified pixel length, for creating a donut effect
|
||||
startAngle: 0-2 factor of PI used for starting angle (in radians) i.e 3/2 starts at the top, 0 and 2 have the same result
|
||||
tilt: 0-1 for percentage to tilt the pie, where 1 is no tilt, and 0 is completely flat (nothing will show)
|
||||
offset: {
|
||||
top: integer value to move the pie up or down
|
||||
left: integer value to move the pie left or right, or 'auto'
|
||||
},
|
||||
stroke: {
|
||||
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#FFF')
|
||||
width: integer pixel width of the stroke
|
||||
},
|
||||
label: {
|
||||
show: true/false, or 'auto'
|
||||
formatter: a user-defined function that modifies the text/style of the label text
|
||||
radius: 0-1 for percentage of fullsize, or a specified pixel length
|
||||
background: {
|
||||
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#000')
|
||||
opacity: 0-1
|
||||
},
|
||||
threshold: 0-1 for the percentage value at which to hide labels (if they're too small)
|
||||
},
|
||||
combine: {
|
||||
threshold: 0-1 for the percentage value at which to combine slices (if they're too small)
|
||||
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#CCC'), if null, the plugin will automatically use the color of the first slice to be combined
|
||||
label: any text value of what the combined slice should be labeled
|
||||
}
|
||||
highlight: {
|
||||
opacity: 0-1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
More detail and specific examples can be found in the included HTML file.
|
||||
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
// Maximum redraw attempts when fitting labels within the plot
|
||||
|
||||
var REDRAW_ATTEMPTS = 10;
|
||||
|
||||
// Factor by which to shrink the pie when fitting labels within the plot
|
||||
|
||||
var REDRAW_SHRINK = 0.95;
|
||||
|
||||
function init(plot) {
|
||||
|
||||
var canvas = null,
|
||||
target = null,
|
||||
options = null,
|
||||
maxRadius = null,
|
||||
centerLeft = null,
|
||||
centerTop = null,
|
||||
processed = false,
|
||||
ctx = null;
|
||||
|
||||
// interactive variables
|
||||
|
||||
var highlights = [];
|
||||
|
||||
// add hook to determine if pie plugin in enabled, and then perform necessary operations
|
||||
|
||||
plot.hooks.processOptions.push(function(plot, options) {
|
||||
if (options.series.pie.show) {
|
||||
|
||||
options.grid.show = false;
|
||||
|
||||
// set labels.show
|
||||
|
||||
if (options.series.pie.label.show == "auto") {
|
||||
if (options.legend.show) {
|
||||
options.series.pie.label.show = false;
|
||||
} else {
|
||||
options.series.pie.label.show = true;
|
||||
}
|
||||
}
|
||||
|
||||
// set radius
|
||||
|
||||
if (options.series.pie.radius == "auto") {
|
||||
if (options.series.pie.label.show) {
|
||||
options.series.pie.radius = 3/4;
|
||||
} else {
|
||||
options.series.pie.radius = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ensure sane tilt
|
||||
|
||||
if (options.series.pie.tilt > 1) {
|
||||
options.series.pie.tilt = 1;
|
||||
} else if (options.series.pie.tilt < 0) {
|
||||
options.series.pie.tilt = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
plot.hooks.bindEvents.push(function(plot, eventHolder) {
|
||||
var options = plot.getOptions();
|
||||
if (options.series.pie.show) {
|
||||
if (options.grid.hoverable) {
|
||||
eventHolder.unbind("mousemove").mousemove(onMouseMove);
|
||||
}
|
||||
if (options.grid.clickable) {
|
||||
eventHolder.unbind("click").click(onClick);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
plot.hooks.processDatapoints.push(function(plot, series, data, datapoints) {
|
||||
var options = plot.getOptions();
|
||||
if (options.series.pie.show) {
|
||||
processDatapoints(plot, series, data, datapoints);
|
||||
}
|
||||
});
|
||||
|
||||
plot.hooks.drawOverlay.push(function(plot, octx) {
|
||||
var options = plot.getOptions();
|
||||
if (options.series.pie.show) {
|
||||
drawOverlay(plot, octx);
|
||||
}
|
||||
});
|
||||
|
||||
plot.hooks.draw.push(function(plot, newCtx) {
|
||||
var options = plot.getOptions();
|
||||
if (options.series.pie.show) {
|
||||
draw(plot, newCtx);
|
||||
}
|
||||
});
|
||||
|
||||
function processDatapoints(plot, series, datapoints) {
|
||||
if (!processed) {
|
||||
processed = true;
|
||||
canvas = plot.getCanvas();
|
||||
target = $(canvas).parent();
|
||||
options = plot.getOptions();
|
||||
plot.setData(combine(plot.getData()));
|
||||
}
|
||||
}
|
||||
|
||||
function combine(data) {
|
||||
|
||||
var total = 0,
|
||||
combined = 0,
|
||||
numCombined = 0,
|
||||
color = options.series.pie.combine.color,
|
||||
newdata = [];
|
||||
|
||||
// Fix up the raw data from Flot, ensuring the data is numeric
|
||||
|
||||
for (var i = 0; i < data.length; ++i) {
|
||||
|
||||
var value = data[i].data;
|
||||
|
||||
// If the data is an array, we'll assume that it's a standard
|
||||
// Flot x-y pair, and are concerned only with the second value.
|
||||
|
||||
// Note how we use the original array, rather than creating a
|
||||
// new one; this is more efficient and preserves any extra data
|
||||
// that the user may have stored in higher indexes.
|
||||
|
||||
if ($.isArray(value) && value.length == 1) {
|
||||
value = value[0];
|
||||
}
|
||||
|
||||
if ($.isArray(value)) {
|
||||
// Equivalent to $.isNumeric() but compatible with jQuery < 1.7
|
||||
if (!isNaN(parseFloat(value[1])) && isFinite(value[1])) {
|
||||
value[1] = +value[1];
|
||||
} else {
|
||||
value[1] = 0;
|
||||
}
|
||||
} else if (!isNaN(parseFloat(value)) && isFinite(value)) {
|
||||
value = [1, +value];
|
||||
} else {
|
||||
value = [1, 0];
|
||||
}
|
||||
|
||||
data[i].data = [value];
|
||||
}
|
||||
|
||||
// Sum up all the slices, so we can calculate percentages for each
|
||||
|
||||
for (var i = 0; i < data.length; ++i) {
|
||||
total += data[i].data[0][1];
|
||||
}
|
||||
|
||||
// Count the number of slices with percentages below the combine
|
||||
// threshold; if it turns out to be just one, we won't combine.
|
||||
|
||||
for (var i = 0; i < data.length; ++i) {
|
||||
var value = data[i].data[0][1];
|
||||
if (value / total <= options.series.pie.combine.threshold) {
|
||||
combined += value;
|
||||
numCombined++;
|
||||
if (!color) {
|
||||
color = data[i].color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < data.length; ++i) {
|
||||
var value = data[i].data[0][1];
|
||||
if (numCombined < 2 || value / total > options.series.pie.combine.threshold) {
|
||||
newdata.push(
|
||||
$.extend(data[i], { /* extend to allow keeping all other original data values
|
||||
and using them e.g. in labelFormatter. */
|
||||
data: [[1, value]],
|
||||
color: data[i].color,
|
||||
label: data[i].label,
|
||||
angle: value * Math.PI * 2 / total,
|
||||
percent: value / (total / 100)
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (numCombined > 1) {
|
||||
newdata.push({
|
||||
data: [[1, combined]],
|
||||
color: color,
|
||||
label: options.series.pie.combine.label,
|
||||
angle: combined * Math.PI * 2 / total,
|
||||
percent: combined / (total / 100)
|
||||
});
|
||||
}
|
||||
|
||||
return newdata;
|
||||
}
|
||||
|
||||
function draw(plot, newCtx) {
|
||||
|
||||
if (!target) {
|
||||
return; // if no series were passed
|
||||
}
|
||||
|
||||
var canvasWidth = plot.getPlaceholder().width(),
|
||||
canvasHeight = plot.getPlaceholder().height(),
|
||||
legendWidth = target.children().filter(".legend").children().width() || 0;
|
||||
|
||||
ctx = newCtx;
|
||||
|
||||
// WARNING: HACK! REWRITE THIS CODE AS SOON AS POSSIBLE!
|
||||
|
||||
// When combining smaller slices into an 'other' slice, we need to
|
||||
// add a new series. Since Flot gives plugins no way to modify the
|
||||
// list of series, the pie plugin uses a hack where the first call
|
||||
// to processDatapoints results in a call to setData with the new
|
||||
// list of series, then subsequent processDatapoints do nothing.
|
||||
|
||||
// The plugin-global 'processed' flag is used to control this hack;
|
||||
// it starts out false, and is set to true after the first call to
|
||||
// processDatapoints.
|
||||
|
||||
// Unfortunately this turns future setData calls into no-ops; they
|
||||
// call processDatapoints, the flag is true, and nothing happens.
|
||||
|
||||
// To fix this we'll set the flag back to false here in draw, when
|
||||
// all series have been processed, so the next sequence of calls to
|
||||
// processDatapoints once again starts out with a slice-combine.
|
||||
// This is really a hack; in 0.9 we need to give plugins a proper
|
||||
// way to modify series before any processing begins.
|
||||
|
||||
processed = false;
|
||||
|
||||
// calculate maximum radius and center point
|
||||
|
||||
maxRadius = Math.min(canvasWidth, canvasHeight / options.series.pie.tilt) / 2;
|
||||
centerTop = canvasHeight / 2 + options.series.pie.offset.top;
|
||||
centerLeft = canvasWidth / 2;
|
||||
|
||||
if (options.series.pie.offset.left == "auto") {
|
||||
if (options.legend.position.match("w")) {
|
||||
centerLeft += legendWidth / 2;
|
||||
} else {
|
||||
centerLeft -= legendWidth / 2;
|
||||
}
|
||||
if (centerLeft < maxRadius) {
|
||||
centerLeft = maxRadius;
|
||||
} else if (centerLeft > canvasWidth - maxRadius) {
|
||||
centerLeft = canvasWidth - maxRadius;
|
||||
}
|
||||
} else {
|
||||
centerLeft += options.series.pie.offset.left;
|
||||
}
|
||||
|
||||
var slices = plot.getData(),
|
||||
attempts = 0;
|
||||
|
||||
// Keep shrinking the pie's radius until drawPie returns true,
|
||||
// indicating that all the labels fit, or we try too many times.
|
||||
|
||||
do {
|
||||
if (attempts > 0) {
|
||||
maxRadius *= REDRAW_SHRINK;
|
||||
}
|
||||
attempts += 1;
|
||||
clear();
|
||||
if (options.series.pie.tilt <= 0.8) {
|
||||
drawShadow();
|
||||
}
|
||||
} while (!drawPie() && attempts < REDRAW_ATTEMPTS)
|
||||
|
||||
if (attempts >= REDRAW_ATTEMPTS) {
|
||||
clear();
|
||||
target.prepend("<div class='error'>Could not draw pie with labels contained inside canvas</div>");
|
||||
}
|
||||
|
||||
if (plot.setSeries && plot.insertLegend) {
|
||||
plot.setSeries(slices);
|
||||
plot.insertLegend();
|
||||
}
|
||||
|
||||
// we're actually done at this point, just defining internal functions at this point
|
||||
|
||||
function clear() {
|
||||
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
|
||||
target.children().filter(".pieLabel, .pieLabelBackground").remove();
|
||||
}
|
||||
|
||||
function drawShadow() {
|
||||
|
||||
var shadowLeft = options.series.pie.shadow.left;
|
||||
var shadowTop = options.series.pie.shadow.top;
|
||||
var edge = 10;
|
||||
var alpha = options.series.pie.shadow.alpha;
|
||||
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
||||
|
||||
if (radius >= canvasWidth / 2 - shadowLeft || radius * options.series.pie.tilt >= canvasHeight / 2 - shadowTop || radius <= edge) {
|
||||
return; // shadow would be outside canvas, so don't draw it
|
||||
}
|
||||
|
||||
ctx.save();
|
||||
ctx.translate(shadowLeft,shadowTop);
|
||||
ctx.globalAlpha = alpha;
|
||||
ctx.fillStyle = "#000";
|
||||
|
||||
// center and rotate to starting position
|
||||
|
||||
ctx.translate(centerLeft,centerTop);
|
||||
ctx.scale(1, options.series.pie.tilt);
|
||||
|
||||
//radius -= edge;
|
||||
|
||||
for (var i = 1; i <= edge; i++) {
|
||||
ctx.beginPath();
|
||||
ctx.arc(0, 0, radius, 0, Math.PI * 2, false);
|
||||
ctx.fill();
|
||||
radius -= i;
|
||||
}
|
||||
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
function drawPie() {
|
||||
|
||||
var startAngle = Math.PI * options.series.pie.startAngle;
|
||||
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
||||
|
||||
// center and rotate to starting position
|
||||
|
||||
ctx.save();
|
||||
ctx.translate(centerLeft,centerTop);
|
||||
ctx.scale(1, options.series.pie.tilt);
|
||||
//ctx.rotate(startAngle); // start at top; -- This doesn't work properly in Opera
|
||||
|
||||
// draw slices
|
||||
|
||||
ctx.save();
|
||||
var currentAngle = startAngle;
|
||||
for (var i = 0; i < slices.length; ++i) {
|
||||
slices[i].startAngle = currentAngle;
|
||||
drawSlice(slices[i].angle, slices[i].color, true);
|
||||
}
|
||||
ctx.restore();
|
||||
|
||||
// draw slice outlines
|
||||
|
||||
if (options.series.pie.stroke.width > 0) {
|
||||
ctx.save();
|
||||
ctx.lineWidth = options.series.pie.stroke.width;
|
||||
currentAngle = startAngle;
|
||||
for (var i = 0; i < slices.length; ++i) {
|
||||
drawSlice(slices[i].angle, options.series.pie.stroke.color, false);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
// draw donut hole
|
||||
|
||||
drawDonutHole(ctx);
|
||||
|
||||
ctx.restore();
|
||||
|
||||
// Draw the labels, returning true if they fit within the plot
|
||||
|
||||
if (options.series.pie.label.show) {
|
||||
return drawLabels();
|
||||
} else return true;
|
||||
|
||||
function drawSlice(angle, color, fill) {
|
||||
|
||||
if (angle <= 0 || isNaN(angle)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fill) {
|
||||
ctx.fillStyle = color;
|
||||
} else {
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineJoin = "round";
|
||||
}
|
||||
|
||||
ctx.beginPath();
|
||||
if (Math.abs(angle - Math.PI * 2) > 0.000000001) {
|
||||
ctx.moveTo(0, 0); // Center of the pie
|
||||
}
|
||||
|
||||
//ctx.arc(0, 0, radius, 0, angle, false); // This doesn't work properly in Opera
|
||||
ctx.arc(0, 0, radius,currentAngle, currentAngle + angle / 2, false);
|
||||
ctx.arc(0, 0, radius,currentAngle + angle / 2, currentAngle + angle, false);
|
||||
ctx.closePath();
|
||||
//ctx.rotate(angle); // This doesn't work properly in Opera
|
||||
currentAngle += angle;
|
||||
|
||||
if (fill) {
|
||||
ctx.fill();
|
||||
} else {
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
function drawLabels() {
|
||||
|
||||
var currentAngle = startAngle;
|
||||
var radius = options.series.pie.label.radius > 1 ? options.series.pie.label.radius : maxRadius * options.series.pie.label.radius;
|
||||
|
||||
for (var i = 0; i < slices.length; ++i) {
|
||||
if (slices[i].percent >= options.series.pie.label.threshold * 100) {
|
||||
if (!drawLabel(slices[i], currentAngle, i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
currentAngle += slices[i].angle;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
function drawLabel(slice, startAngle, index) {
|
||||
|
||||
if (slice.data[0][1] == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// format label text
|
||||
|
||||
var lf = options.legend.labelFormatter, text, plf = options.series.pie.label.formatter;
|
||||
|
||||
if (lf) {
|
||||
text = lf(slice.label, slice);
|
||||
} else {
|
||||
text = slice.label;
|
||||
}
|
||||
|
||||
if (plf) {
|
||||
text = plf(text, slice);
|
||||
}
|
||||
|
||||
var halfAngle = ((startAngle + slice.angle) + startAngle) / 2;
|
||||
var x = centerLeft + Math.round(Math.cos(halfAngle) * radius);
|
||||
var y = centerTop + Math.round(Math.sin(halfAngle) * radius) * options.series.pie.tilt;
|
||||
|
||||
var html = "<span class='pieLabel' id='pieLabel" + index + "' style='position:absolute;top:" + y + "px;left:" + x + "px;'>" + text + "</span>";
|
||||
target.append(html);
|
||||
|
||||
var label = target.children("#pieLabel" + index);
|
||||
var labelTop = (y - label.height() / 2);
|
||||
var labelLeft = (x - label.width() / 2);
|
||||
|
||||
label.css("top", labelTop);
|
||||
label.css("left", labelLeft);
|
||||
|
||||
// check to make sure that the label is not outside the canvas
|
||||
|
||||
if (0 - labelTop > 0 || 0 - labelLeft > 0 || canvasHeight - (labelTop + label.height()) < 0 || canvasWidth - (labelLeft + label.width()) < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (options.series.pie.label.background.opacity != 0) {
|
||||
|
||||
// put in the transparent background separately to avoid blended labels and label boxes
|
||||
|
||||
var c = options.series.pie.label.background.color;
|
||||
|
||||
if (c == null) {
|
||||
c = slice.color;
|
||||
}
|
||||
|
||||
var pos = "top:" + labelTop + "px;left:" + labelLeft + "px;";
|
||||
$("<div class='pieLabelBackground' style='position:absolute;width:" + label.width() + "px;height:" + label.height() + "px;" + pos + "background-color:" + c + ";'></div>")
|
||||
.css("opacity", options.series.pie.label.background.opacity)
|
||||
.insertBefore(label);
|
||||
}
|
||||
|
||||
return true;
|
||||
} // end individual label function
|
||||
} // end drawLabels function
|
||||
} // end drawPie function
|
||||
} // end draw function
|
||||
|
||||
// Placed here because it needs to be accessed from multiple locations
|
||||
|
||||
function drawDonutHole(layer) {
|
||||
if (options.series.pie.innerRadius > 0) {
|
||||
|
||||
// subtract the center
|
||||
|
||||
layer.save();
|
||||
var innerRadius = options.series.pie.innerRadius > 1 ? options.series.pie.innerRadius : maxRadius * options.series.pie.innerRadius;
|
||||
layer.globalCompositeOperation = "destination-out"; // this does not work with excanvas, but it will fall back to using the stroke color
|
||||
layer.beginPath();
|
||||
layer.fillStyle = options.series.pie.stroke.color;
|
||||
layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
|
||||
layer.fill();
|
||||
layer.closePath();
|
||||
layer.restore();
|
||||
|
||||
// add inner stroke
|
||||
|
||||
layer.save();
|
||||
layer.beginPath();
|
||||
layer.strokeStyle = options.series.pie.stroke.color;
|
||||
layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
|
||||
layer.stroke();
|
||||
layer.closePath();
|
||||
layer.restore();
|
||||
|
||||
// TODO: add extra shadow inside hole (with a mask) if the pie is tilted.
|
||||
}
|
||||
}
|
||||
|
||||
//-- Additional Interactive related functions --
|
||||
|
||||
function isPointInPoly(poly, pt) {
|
||||
for(var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)
|
||||
((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) || (poly[j][1] <= pt[1] && pt[1]< poly[i][1]))
|
||||
&& (pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0])
|
||||
&& (c = !c);
|
||||
return c;
|
||||
}
|
||||
|
||||
function findNearbySlice(mouseX, mouseY) {
|
||||
|
||||
var slices = plot.getData(),
|
||||
options = plot.getOptions(),
|
||||
radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius,
|
||||
x, y;
|
||||
|
||||
for (var i = 0; i < slices.length; ++i) {
|
||||
|
||||
var s = slices[i];
|
||||
|
||||
if (s.pie.show) {
|
||||
|
||||
ctx.save();
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0, 0); // Center of the pie
|
||||
//ctx.scale(1, options.series.pie.tilt); // this actually seems to break everything when here.
|
||||
ctx.arc(0, 0, radius, s.startAngle, s.startAngle + s.angle / 2, false);
|
||||
ctx.arc(0, 0, radius, s.startAngle + s.angle / 2, s.startAngle + s.angle, false);
|
||||
ctx.closePath();
|
||||
x = mouseX - centerLeft;
|
||||
y = mouseY - centerTop;
|
||||
|
||||
if (ctx.isPointInPath) {
|
||||
if (ctx.isPointInPath(mouseX - centerLeft, mouseY - centerTop)) {
|
||||
ctx.restore();
|
||||
return {
|
||||
datapoint: [s.percent, s.data],
|
||||
dataIndex: 0,
|
||||
series: s,
|
||||
seriesIndex: i
|
||||
};
|
||||
}
|
||||
} else {
|
||||
|
||||
// excanvas for IE doesn;t support isPointInPath, this is a workaround.
|
||||
|
||||
var p1X = radius * Math.cos(s.startAngle),
|
||||
p1Y = radius * Math.sin(s.startAngle),
|
||||
p2X = radius * Math.cos(s.startAngle + s.angle / 4),
|
||||
p2Y = radius * Math.sin(s.startAngle + s.angle / 4),
|
||||
p3X = radius * Math.cos(s.startAngle + s.angle / 2),
|
||||
p3Y = radius * Math.sin(s.startAngle + s.angle / 2),
|
||||
p4X = radius * Math.cos(s.startAngle + s.angle / 1.5),
|
||||
p4Y = radius * Math.sin(s.startAngle + s.angle / 1.5),
|
||||
p5X = radius * Math.cos(s.startAngle + s.angle),
|
||||
p5Y = radius * Math.sin(s.startAngle + s.angle),
|
||||
arrPoly = [[0, 0], [p1X, p1Y], [p2X, p2Y], [p3X, p3Y], [p4X, p4Y], [p5X, p5Y]],
|
||||
arrPoint = [x, y];
|
||||
|
||||
// TODO: perhaps do some mathmatical trickery here with the Y-coordinate to compensate for pie tilt?
|
||||
|
||||
if (isPointInPoly(arrPoly, arrPoint)) {
|
||||
ctx.restore();
|
||||
return {
|
||||
datapoint: [s.percent, s.data],
|
||||
dataIndex: 0,
|
||||
series: s,
|
||||
seriesIndex: i
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
ctx.restore();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function onMouseMove(e) {
|
||||
triggerClickHoverEvent("plothover", e);
|
||||
}
|
||||
|
||||
function onClick(e) {
|
||||
triggerClickHoverEvent("plotclick", e);
|
||||
}
|
||||
|
||||
// trigger click or hover event (they send the same parameters so we share their code)
|
||||
|
||||
function triggerClickHoverEvent(eventname, e) {
|
||||
|
||||
var offset = plot.offset();
|
||||
var canvasX = parseInt(e.pageX - offset.left);
|
||||
var canvasY = parseInt(e.pageY - offset.top);
|
||||
var item = findNearbySlice(canvasX, canvasY);
|
||||
|
||||
if (options.grid.autoHighlight) {
|
||||
|
||||
// clear auto-highlights
|
||||
|
||||
for (var i = 0; i < highlights.length; ++i) {
|
||||
var h = highlights[i];
|
||||
if (h.auto == eventname && !(item && h.series == item.series)) {
|
||||
unhighlight(h.series);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// highlight the slice
|
||||
|
||||
if (item) {
|
||||
highlight(item.series, eventname);
|
||||
}
|
||||
|
||||
// trigger any hover bind events
|
||||
|
||||
var pos = { pageX: e.pageX, pageY: e.pageY };
|
||||
target.trigger(eventname, [pos, item]);
|
||||
}
|
||||
|
||||
function highlight(s, auto) {
|
||||
//if (typeof s == "number") {
|
||||
// s = series[s];
|
||||
//}
|
||||
|
||||
var i = indexOfHighlight(s);
|
||||
|
||||
if (i == -1) {
|
||||
highlights.push({ series: s, auto: auto });
|
||||
plot.triggerRedrawOverlay();
|
||||
} else if (!auto) {
|
||||
highlights[i].auto = false;
|
||||
}
|
||||
}
|
||||
|
||||
function unhighlight(s) {
|
||||
if (s == null) {
|
||||
highlights = [];
|
||||
plot.triggerRedrawOverlay();
|
||||
}
|
||||
|
||||
//if (typeof s == "number") {
|
||||
// s = series[s];
|
||||
//}
|
||||
|
||||
var i = indexOfHighlight(s);
|
||||
|
||||
if (i != -1) {
|
||||
highlights.splice(i, 1);
|
||||
plot.triggerRedrawOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
function indexOfHighlight(s) {
|
||||
for (var i = 0; i < highlights.length; ++i) {
|
||||
var h = highlights[i];
|
||||
if (h.series == s)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function drawOverlay(plot, octx) {
|
||||
|
||||
var options = plot.getOptions();
|
||||
|
||||
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
||||
|
||||
octx.save();
|
||||
octx.translate(centerLeft, centerTop);
|
||||
octx.scale(1, options.series.pie.tilt);
|
||||
|
||||
for (var i = 0; i < highlights.length; ++i) {
|
||||
drawHighlight(highlights[i].series);
|
||||
}
|
||||
|
||||
drawDonutHole(octx);
|
||||
|
||||
octx.restore();
|
||||
|
||||
function drawHighlight(series) {
|
||||
|
||||
if (series.angle <= 0 || isNaN(series.angle)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//octx.fillStyle = parseColor(options.series.pie.highlight.color).scale(null, null, null, options.series.pie.highlight.opacity).toString();
|
||||
octx.fillStyle = "rgba(255, 255, 255, " + options.series.pie.highlight.opacity + ")"; // this is temporary until we have access to parseColor
|
||||
octx.beginPath();
|
||||
if (Math.abs(series.angle - Math.PI * 2) > 0.000000001) {
|
||||
octx.moveTo(0, 0); // Center of the pie
|
||||
}
|
||||
octx.arc(0, 0, radius, series.startAngle, series.startAngle + series.angle / 2, false);
|
||||
octx.arc(0, 0, radius, series.startAngle + series.angle / 2, series.startAngle + series.angle, false);
|
||||
octx.closePath();
|
||||
octx.fill();
|
||||
}
|
||||
}
|
||||
} // end init (plugin body)
|
||||
|
||||
// define pie specific options and their default values
|
||||
|
||||
var options = {
|
||||
series: {
|
||||
pie: {
|
||||
show: false,
|
||||
radius: "auto", // actual radius of the visible pie (based on full calculated radius if <=1, or hard pixel value)
|
||||
innerRadius: 0, /* for donut */
|
||||
startAngle: 3/2,
|
||||
tilt: 1,
|
||||
shadow: {
|
||||
left: 5, // shadow left offset
|
||||
top: 15, // shadow top offset
|
||||
alpha: 0.02 // shadow alpha
|
||||
},
|
||||
offset: {
|
||||
top: 0,
|
||||
left: "auto"
|
||||
},
|
||||
stroke: {
|
||||
color: "#fff",
|
||||
width: 1
|
||||
},
|
||||
label: {
|
||||
show: "auto",
|
||||
formatter: function(label, slice) {
|
||||
return "<div style='font-size:x-small;text-align:center;padding:2px;color:" + slice.color + ";'>" + label + "<br/>" + Math.round(slice.percent) + "%</div>";
|
||||
}, // formatter function
|
||||
radius: 1, // radius at which to place the labels (based on full calculated radius if <=1, or hard pixel value)
|
||||
background: {
|
||||
color: null,
|
||||
opacity: 0
|
||||
},
|
||||
threshold: 0 // percentage at which to hide the label (i.e. the slice is too narrow)
|
||||
},
|
||||
combine: {
|
||||
threshold: -1, // percentage at which to combine little slices into one larger slice
|
||||
color: null, // color to give the new slice (auto-generated if null)
|
||||
label: "Other" // label to give the new slice
|
||||
},
|
||||
highlight: {
|
||||
//color: "#fff", // will add this functionality once parseColor is available
|
||||
opacity: 0.5
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: "pie",
|
||||
version: "1.1"
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
59
user/assets/vendor/flot/jquery.flot.resize.js
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/* Flot plugin for automatically redrawing plots as the placeholder resizes.
|
||||
|
||||
Copyright (c) 2007-2014 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
It works by listening for changes on the placeholder div (through the jQuery
|
||||
resize event plugin) - if the size changes, it will redraw the plot.
|
||||
|
||||
There are no options. If you need to disable the plugin for some plots, you
|
||||
can just fix the size of their placeholders.
|
||||
|
||||
*/
|
||||
|
||||
/* Inline dependency:
|
||||
* jQuery resize event - v1.1 - 3/14/2010
|
||||
* http://benalman.com/projects/jquery-resize-plugin/
|
||||
*
|
||||
* Copyright (c) 2010 "Cowboy" Ben Alman
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://benalman.com/about/license/
|
||||
*/
|
||||
(function($,e,t){"$:nomunge";var i=[],n=$.resize=$.extend($.resize,{}),a,r=false,s="setTimeout",u="resize",m=u+"-special-event",o="pendingDelay",l="activeDelay",f="throttleWindow";n[o]=200;n[l]=20;n[f]=true;$.event.special[u]={setup:function(){if(!n[f]&&this[s]){return false}var e=$(this);i.push(this);e.data(m,{w:e.width(),h:e.height()});if(i.length===1){a=t;h()}},teardown:function(){if(!n[f]&&this[s]){return false}var e=$(this);for(var t=i.length-1;t>=0;t--){if(i[t]==this){i.splice(t,1);break}}e.removeData(m);if(!i.length){if(r){cancelAnimationFrame(a)}else{clearTimeout(a)}a=null}},add:function(e){if(!n[f]&&this[s]){return false}var i;function a(e,n,a){var r=$(this),s=r.data(m)||{};s.w=n!==t?n:r.width();s.h=a!==t?a:r.height();i.apply(this,arguments)}if($.isFunction(e)){i=e;return a}else{i=e.handler;e.handler=a}}};function h(t){if(r===true){r=t||1}for(var s=i.length-1;s>=0;s--){var l=$(i[s]);if(l[0]==e||l.is(":visible")){var f=l.width(),c=l.height(),d=l.data(m);if(d&&(f!==d.w||c!==d.h)){l.trigger(u,[d.w=f,d.h=c]);r=t||true}}else{d=l.data(m);d.w=0;d.h=0}}if(a!==null){if(r&&(t==null||t-r<1e3)){a=e.requestAnimationFrame(h)}else{a=setTimeout(h,n[o]);r=false}}}if(!e.requestAnimationFrame){e.requestAnimationFrame=function(){return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t,i){return e.setTimeout(function(){t((new Date).getTime())},n[l])}}()}if(!e.cancelAnimationFrame){e.cancelAnimationFrame=function(){return e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout}()}})(jQuery,this);
|
||||
|
||||
(function ($) {
|
||||
var options = { }; // no options
|
||||
|
||||
function init(plot) {
|
||||
function onResize() {
|
||||
var placeholder = plot.getPlaceholder();
|
||||
|
||||
// somebody might have hidden us and we can't plot
|
||||
// when we don't have the dimensions
|
||||
if (placeholder.width() == 0 || placeholder.height() == 0)
|
||||
return;
|
||||
|
||||
plot.resize();
|
||||
plot.setupGrid();
|
||||
plot.draw();
|
||||
}
|
||||
|
||||
function bindEvents(plot, eventHolder) {
|
||||
plot.getPlaceholder().resize(onResize);
|
||||
}
|
||||
|
||||
function shutdown(plot, eventHolder) {
|
||||
plot.getPlaceholder().unbind("resize", onResize);
|
||||
}
|
||||
|
||||
plot.hooks.bindEvents.push(bindEvents);
|
||||
plot.hooks.shutdown.push(shutdown);
|
||||
}
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: 'resize',
|
||||
version: '1.0'
|
||||
});
|
||||
})(jQuery);
|
||||
209
user/assets/vendor/jquery.easy-pie-chart/dist/jquery.easypiechart.fill.js
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
// Generated by CoffeeScript 1.6.3
|
||||
/*
|
||||
Easy pie chart is a jquery plugin to display simple animated pie charts for only one value
|
||||
|
||||
Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
|
||||
Built on top of the jQuery library (http://jquery.com)
|
||||
|
||||
@source: http://github.com/rendro/easy-pie-chart/
|
||||
@autor: Robert Fleischmann
|
||||
@version: 1.2.5
|
||||
|
||||
Inspired by: http://dribbble.com/shots/631074-Simple-Pie-Charts-II?list=popular&offset=210
|
||||
Thanks to Philip Thrasher for the jquery plugin boilerplate for coffee script
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
$.easyPieChart = function(el, options) {
|
||||
var addScaleLine, animateLine, drawLine, easeInOutQuad, rAF, renderBackground, renderScale, renderTrack,
|
||||
_this = this;
|
||||
this.el = el;
|
||||
this.$el = $(el);
|
||||
this.$el.data("easyPieChart", this);
|
||||
this.init = function() {
|
||||
var percent, scaleBy;
|
||||
_this.options = $.extend({}, $.easyPieChart.defaultOptions, options);
|
||||
percent = _this.options.percent || parseInt(_this.$el.data('percent'), 10);
|
||||
_this.percentage = 0;
|
||||
_this.canvas = $("<canvas width='" + _this.options.size + "' height='" + _this.options.size + "'></canvas>").get(0);
|
||||
_this.$el.append(_this.canvas);
|
||||
if (typeof G_vmlCanvasManager !== "undefined" && G_vmlCanvasManager !== null) {
|
||||
G_vmlCanvasManager.initElement(_this.canvas);
|
||||
}
|
||||
_this.ctx = _this.canvas.getContext('2d');
|
||||
if (window.devicePixelRatio > 1) {
|
||||
scaleBy = window.devicePixelRatio;
|
||||
$(_this.canvas).css({
|
||||
width: _this.options.size,
|
||||
height: _this.options.size
|
||||
});
|
||||
_this.canvas.width *= scaleBy;
|
||||
_this.canvas.height *= scaleBy;
|
||||
_this.ctx.scale(scaleBy, scaleBy);
|
||||
}
|
||||
_this.ctx.translate(_this.options.size / 2, _this.options.size / 2);
|
||||
_this.ctx.rotate(_this.options.rotate * Math.PI / 180);
|
||||
_this.$el.addClass('easyPieChart');
|
||||
_this.$el.css({
|
||||
width: _this.options.size,
|
||||
height: _this.options.size,
|
||||
lineHeight: "" + _this.options.size + "px"
|
||||
});
|
||||
_this.update(percent);
|
||||
return _this;
|
||||
};
|
||||
this.update = function(percent) {
|
||||
percent = parseFloat(percent) || 0;
|
||||
if (_this.options.animate === false) {
|
||||
drawLine(percent);
|
||||
} else {
|
||||
if (_this.options.delay) {
|
||||
animateLine(_this.percentage, 0);
|
||||
setTimeout(function() {
|
||||
return animateLine(_this.percentage, percent);
|
||||
}, _this.options.delay);
|
||||
} else {
|
||||
animateLine(_this.percentage, percent);
|
||||
}
|
||||
}
|
||||
return _this;
|
||||
};
|
||||
renderScale = function() {
|
||||
var i, _i, _results;
|
||||
_this.ctx.fillStyle = _this.options.scaleColor;
|
||||
_this.ctx.lineWidth = 1;
|
||||
_results = [];
|
||||
for (i = _i = 0; _i <= 24; i = ++_i) {
|
||||
_results.push(addScaleLine(i));
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
addScaleLine = function(i) {
|
||||
var offset;
|
||||
offset = i % 6 === 0 ? 0 : _this.options.size * 0.017;
|
||||
_this.ctx.save();
|
||||
_this.ctx.rotate(i * Math.PI / 12);
|
||||
_this.ctx.fillRect(_this.options.size / 2 - offset, 0, -_this.options.size * 0.05 + offset, 1);
|
||||
_this.ctx.restore();
|
||||
};
|
||||
renderTrack = function() {
|
||||
var offset;
|
||||
offset = _this.options.size / 2 - _this.options.lineWidth / 2;
|
||||
if (_this.options.scaleColor !== false) {
|
||||
offset -= _this.options.size * 0.08;
|
||||
}
|
||||
_this.ctx.beginPath();
|
||||
_this.ctx.arc(0, 0, offset, 0, Math.PI * 2, true);
|
||||
_this.ctx.closePath();
|
||||
_this.ctx.strokeStyle = _this.options.trackColor;
|
||||
|
||||
if (_this.options.color) {
|
||||
_this.ctx.fillStyle = _this.options.color;
|
||||
_this.ctx.fill();
|
||||
}
|
||||
|
||||
_this.ctx.lineWidth = _this.options.lineWidth;
|
||||
_this.ctx.stroke();
|
||||
};
|
||||
renderBackground = function() {
|
||||
if (_this.options.scaleColor !== false) {
|
||||
renderScale();
|
||||
}
|
||||
if (_this.options.trackColor !== false) {
|
||||
renderTrack();
|
||||
}
|
||||
};
|
||||
drawLine = function(percent) {
|
||||
var offset;
|
||||
renderBackground();
|
||||
_this.ctx.strokeStyle = $.isFunction(_this.options.barColor) ? _this.options.barColor(percent) : _this.options.barColor;
|
||||
_this.ctx.lineCap = _this.options.lineCap;
|
||||
_this.ctx.lineWidth = _this.options.lineWidth;
|
||||
offset = _this.options.size / 2 - _this.options.lineWidth / 2;
|
||||
if (_this.options.scaleColor !== false) {
|
||||
offset -= _this.options.size * 0.08;
|
||||
}
|
||||
_this.ctx.save();
|
||||
_this.ctx.rotate(-Math.PI / 2);
|
||||
_this.ctx.beginPath();
|
||||
_this.ctx.arc(0, 0, offset, 0, Math.PI * 2 * percent / 100, false);
|
||||
_this.ctx.stroke();
|
||||
_this.ctx.restore();
|
||||
};
|
||||
rAF = (function() {
|
||||
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) {
|
||||
return window.setTimeout(callback, 1000 / 60);
|
||||
};
|
||||
})();
|
||||
animateLine = function(from, to) {
|
||||
var anim, startTime;
|
||||
_this.options.onStart.call(_this);
|
||||
_this.percentage = to;
|
||||
Date.now || (Date.now = function() {
|
||||
return +(new Date);
|
||||
});
|
||||
startTime = Date.now();
|
||||
anim = function() {
|
||||
var currentValue, process;
|
||||
process = Math.min(Date.now() - startTime, _this.options.animate);
|
||||
_this.ctx.clearRect(-_this.options.size / 2, -_this.options.size / 2, _this.options.size, _this.options.size);
|
||||
renderBackground.call(_this);
|
||||
currentValue = [easeInOutQuad(process, from, to - from, _this.options.animate)];
|
||||
_this.options.onStep.call(_this, currentValue);
|
||||
drawLine.call(_this, currentValue);
|
||||
if (process >= _this.options.animate) {
|
||||
return _this.options.onStop.call(_this, currentValue, to);
|
||||
} else {
|
||||
return rAF(anim);
|
||||
}
|
||||
};
|
||||
rAF(anim);
|
||||
};
|
||||
easeInOutQuad = function(t, b, c, d) {
|
||||
var easeIn, easing;
|
||||
easeIn = function(t) {
|
||||
return Math.pow(t, 2);
|
||||
};
|
||||
easing = function(t) {
|
||||
if (t < 1) {
|
||||
return easeIn(t);
|
||||
} else {
|
||||
return 2 - easeIn((t / 2) * -2 + 2);
|
||||
}
|
||||
};
|
||||
t /= d / 2;
|
||||
return c / 2 * easing(t) + b;
|
||||
};
|
||||
return this.init();
|
||||
};
|
||||
$.easyPieChart.defaultOptions = {
|
||||
percent: 0,
|
||||
barColor: '#ef1e25',
|
||||
trackColor: '#f2f2f2',
|
||||
scaleColor: '#dfe0e0',
|
||||
lineCap: 'round',
|
||||
rotate: 0,
|
||||
size: 110,
|
||||
lineWidth: 3,
|
||||
animate: false,
|
||||
delay: false,
|
||||
onStart: $.noop,
|
||||
onStop: $.noop,
|
||||
onStep: $.noop
|
||||
};
|
||||
$.fn.easyPieChart = function(options) {
|
||||
return $.each(this, function(i, el) {
|
||||
var $el, instanceOptions;
|
||||
$el = $(el);
|
||||
if (!$el.data('easyPieChart')) {
|
||||
instanceOptions = $.extend({}, options, $el.data());
|
||||
return $el.data('easyPieChart', new $.easyPieChart(el, instanceOptions));
|
||||
} else{
|
||||
$el.data('easyPieChart').update(options['percent']);
|
||||
}
|
||||
});
|
||||
};
|
||||
return void 0;
|
||||
})(jQuery);
|
||||