mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-23 15:51:25 +00:00
add web interface
This commit is contained in:
parent
5c2fac9352
commit
385a4a8fe6
120
lib/recorder.js
Normal file
120
lib/recorder.js
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
//start recording and share a list when required
|
||||||
|
var zlib = require('zlib'),
|
||||||
|
Datastore = require('nedb'),
|
||||||
|
util = require("util"),
|
||||||
|
events = require('events'),
|
||||||
|
db = new Datastore(); //in-memory store
|
||||||
|
|
||||||
|
function Recorder(){
|
||||||
|
var self = this,
|
||||||
|
id = 1;
|
||||||
|
|
||||||
|
self.recordBodyMap = []; // id - body
|
||||||
|
|
||||||
|
self.updateRecord = function(id,info){
|
||||||
|
if(id < 0 ) return;
|
||||||
|
|
||||||
|
var finalInfo = normalizeInfo(id,info);
|
||||||
|
|
||||||
|
db.update({_id:id},finalInfo);
|
||||||
|
self.updateRecordBody(id,info);
|
||||||
|
|
||||||
|
self.emit("update",finalInfo);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
self.appendRecord = function(info){
|
||||||
|
if(info.req.headers.anyproxy_web_req){ //request from web interface
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
var thisId = id++,
|
||||||
|
finalInfo = normalizeInfo(thisId,info);
|
||||||
|
db.insert(finalInfo);
|
||||||
|
self.updateRecordBody(id,info);
|
||||||
|
|
||||||
|
self.emit("update",finalInfo);
|
||||||
|
return thisId;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//update recordBody if exits
|
||||||
|
self.updateRecordBody =function(id,info){
|
||||||
|
if(id == -1) return;
|
||||||
|
|
||||||
|
if(!id || !info.resBody) return;
|
||||||
|
//add to body map
|
||||||
|
//do not save image data
|
||||||
|
if(/image/.test(info.res.headers['content-type'])){
|
||||||
|
self.recordBodyMap[id] = "(image)";
|
||||||
|
}else if(/gzip/.test(info.res.headers['content-encoding'])){
|
||||||
|
zlib.unzip(info.resBody,function(err,buffer){
|
||||||
|
if(err){
|
||||||
|
self.recordBodyMap[id] = "(err when unzip response buffer)";
|
||||||
|
}else{
|
||||||
|
self.recordBodyMap[id] = buffer.toString();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
self.recordBodyMap[id] = info.resBody.toString();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
self.getBody = function(id){
|
||||||
|
if(id < 0){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return self.recordBodyMap[id] || "";
|
||||||
|
};
|
||||||
|
|
||||||
|
self.getSummaryList = function(cb){
|
||||||
|
db.find({},cb);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
util.inherits(Recorder, events.EventEmitter);
|
||||||
|
|
||||||
|
function normalizeInfo(id,info){
|
||||||
|
var singleRecord = {};
|
||||||
|
|
||||||
|
//general
|
||||||
|
singleRecord._id = id;
|
||||||
|
singleRecord.id = id;
|
||||||
|
singleRecord.url = info.url;
|
||||||
|
singleRecord.host = info.host;
|
||||||
|
singleRecord.path = info.path;
|
||||||
|
singleRecord.method = info.method;
|
||||||
|
|
||||||
|
//req
|
||||||
|
singleRecord.reqHeader = info.req.headers;
|
||||||
|
singleRecord.startTime = info.startTime;
|
||||||
|
|
||||||
|
//res
|
||||||
|
if(info.res){
|
||||||
|
singleRecord.statusCode= info.res.statusCode;
|
||||||
|
singleRecord.endTime = info.endTime;
|
||||||
|
singleRecord.resHeader = info.res.headers;
|
||||||
|
singleRecord.length = info.length;
|
||||||
|
if(info.res.headers['content-type']){
|
||||||
|
singleRecord.mime = info.res.headers['content-type'].split(";")[0];
|
||||||
|
}else{
|
||||||
|
singleRecord.mime = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
singleRecord.duration = info.endTime - info.startTime;
|
||||||
|
}else{
|
||||||
|
singleRecord.statusCode= "";
|
||||||
|
singleRecord.endTime = "";
|
||||||
|
singleRecord.resHeader = "";
|
||||||
|
singleRecord.length = "";
|
||||||
|
singleRecord.mime = "";
|
||||||
|
singleRecord.duration = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return singleRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Recorder;
|
@ -29,10 +29,24 @@ var handleRule = {
|
|||||||
|
|
||||||
function userRequestHandler(req,userRes){
|
function userRequestHandler(req,userRes){
|
||||||
var host = req.headers.host,
|
var host = req.headers.host,
|
||||||
urlPattern = url.parse(req.url),
|
urlPattern = url.parse(req.url),
|
||||||
path = urlPattern.path,
|
path = urlPattern.path,
|
||||||
ifLocalruleMatched = false,
|
ifLocalruleMatched = false,
|
||||||
callback = null;
|
callback = null,
|
||||||
|
ifHttps = !!req.connection.encrypted && !/http:/.test(req.url),
|
||||||
|
resourceInfo = {},
|
||||||
|
resourceInfoId = -1;
|
||||||
|
|
||||||
|
resourceInfo.host = host;
|
||||||
|
resourceInfo.method = req.method;
|
||||||
|
resourceInfo.path = path;
|
||||||
|
resourceInfo.url = (ifHttps ? "https://" :"http://") + host + path;
|
||||||
|
resourceInfo.req = req;
|
||||||
|
resourceInfo.startTime = new Date().getTime();
|
||||||
|
|
||||||
|
try{
|
||||||
|
resourceInfoId = GLOBAL.recorder.appendRecord(resourceInfo);
|
||||||
|
}catch(e){}
|
||||||
|
|
||||||
console.log(color.green("\nreceived request to : " + host + path));
|
console.log(color.green("\nreceived request to : " + host + path));
|
||||||
/*
|
/*
|
||||||
@ -41,6 +55,7 @@ function userRequestHandler(req,userRes){
|
|||||||
in https server : /work/alibaba
|
in https server : /work/alibaba
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//handle OPTIONS request
|
||||||
if(req.method == "OPTIONS"){
|
if(req.method == "OPTIONS"){
|
||||||
console.log("==>OPTIONS req for CROS, will allow all");
|
console.log("==>OPTIONS req for CROS, will allow all");
|
||||||
userRes.writeHead(200,mergeCORSHeader(req.headers)); //remove any cache related header, add crossdomain headers
|
userRes.writeHead(200,mergeCORSHeader(req.headers)); //remove any cache related header, add crossdomain headers
|
||||||
@ -83,8 +98,6 @@ function userRequestHandler(req,userRes){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//sleep for seconds if configed in the rule file
|
//sleep for seconds if configed in the rule file
|
||||||
//see rule_sample.js
|
//see rule_sample.js
|
||||||
if(hostTest && pathTest && !!rule.sleep){
|
if(hostTest && pathTest && !!rule.sleep){
|
||||||
@ -102,7 +115,6 @@ function userRequestHandler(req,userRes){
|
|||||||
|
|
||||||
}else{
|
}else{
|
||||||
console.log("==>will forward to real server by proxy");
|
console.log("==>will forward to real server by proxy");
|
||||||
var ifHttps = !!req.connection.encrypted && !/http:/.test(req.url);
|
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
hostname : urlPattern.hostname || req.headers.host,
|
hostname : urlPattern.hostname || req.headers.host,
|
||||||
@ -114,17 +126,31 @@ function userRequestHandler(req,userRes){
|
|||||||
|
|
||||||
var proxyReq = (ifHttps ? https : http).request(options, function(res) {
|
var proxyReq = (ifHttps ? https : http).request(options, function(res) {
|
||||||
userRes.writeHead(res.statusCode,mergeCORSHeader(req.headers,res.headers));
|
userRes.writeHead(res.statusCode,mergeCORSHeader(req.headers,res.headers));
|
||||||
if(callback){
|
|
||||||
res.on('data',function(chunk){
|
var resData = [],
|
||||||
userRes.write(chunk);
|
length = 0;
|
||||||
});
|
res.on("data",function(chunk){
|
||||||
res.on('end',function(){
|
resData.push(chunk);
|
||||||
callback(userRes);
|
length += chunk.length;
|
||||||
userRes.end();
|
userRes.write(chunk);
|
||||||
});
|
});
|
||||||
}else{
|
|
||||||
res.pipe(userRes);
|
res.on("end",function(){
|
||||||
}
|
callback && callback.call(null,userRes);
|
||||||
|
userRes.end();
|
||||||
|
|
||||||
|
//update record info
|
||||||
|
resourceInfo.endTime = new Date().getTime();
|
||||||
|
resourceInfo.res = res;
|
||||||
|
resourceInfo.resBody = Buffer.concat(resData);
|
||||||
|
resourceInfo.length = length;
|
||||||
|
|
||||||
|
try{
|
||||||
|
GLOBAL.recorder.updateRecord(resourceInfoId,resourceInfo);
|
||||||
|
}catch(e){}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
proxyReq.on("error",function(e){
|
proxyReq.on("error",function(e){
|
||||||
|
@ -11,7 +11,11 @@
|
|||||||
"async-task-mgr": "^1.0.1",
|
"async-task-mgr": "^1.0.1",
|
||||||
"colorful": "^2.1.0",
|
"colorful": "^2.1.0",
|
||||||
"commander": "~2.3.0",
|
"commander": "~2.3.0",
|
||||||
"sleep": "~1.1.8"
|
"entities": "^1.1.1",
|
||||||
|
"express": "^4.8.5",
|
||||||
|
"nedb": "^0.11.0",
|
||||||
|
"sleep": "~1.1.8",
|
||||||
|
"ws": "^0.4.32"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"tunnel": "0.0.3"
|
"tunnel": "0.0.3"
|
||||||
|
75
proxy.js
75
proxy.js
@ -1,21 +1,27 @@
|
|||||||
var http = require('http'),
|
var http = require('http'),
|
||||||
https = require('https'),
|
https = require('https'),
|
||||||
fs = require('fs'),
|
fs = require('fs'),
|
||||||
net = require('net'),
|
|
||||||
async = require("async"),
|
async = require("async"),
|
||||||
url = require('url'),
|
url = require('url'),
|
||||||
exec = require('child_process').exec,
|
|
||||||
program = require('commander'),
|
program = require('commander'),
|
||||||
color = require('colorful'),
|
color = require('colorful'),
|
||||||
certMgr = require("./lib/certMgr"),
|
certMgr = require("./lib/certMgr"),
|
||||||
getPort = require("./lib/getPort"),
|
getPort = require("./lib/getPort"),
|
||||||
requestHandler = require("./lib/requestHandler");
|
requestHandler = require("./lib/requestHandler"),
|
||||||
|
Recorder = require("./lib/Recorder"),
|
||||||
|
entities = require("entities"),
|
||||||
|
express = require("express"),
|
||||||
|
WebSocketServer= require('ws').Server;
|
||||||
|
|
||||||
|
GLOBAL.recorder = new Recorder();
|
||||||
|
|
||||||
var T_TYPE_HTTP = 0,
|
var T_TYPE_HTTP = 0,
|
||||||
T_TYPE_HTTPS = 1,
|
T_TYPE_HTTPS = 1,
|
||||||
DEFAULT_PORT = 8001,
|
DEFAULT_PORT = 8001,
|
||||||
DEFAULT_HOST = "localhost",
|
DEFAULT_WEB_PORT = 8002,
|
||||||
DEFAULT_TYPE = T_TYPE_HTTP;
|
DEFAULT_WEBSOCKET_PORT = 8003,
|
||||||
|
DEFAULT_HOST = "localhost",
|
||||||
|
DEFAULT_TYPE = T_TYPE_HTTP;
|
||||||
|
|
||||||
function proxyServer(type, port, hostname,ruleFile){
|
function proxyServer(type, port, hostname,ruleFile){
|
||||||
var self = this,
|
var self = this,
|
||||||
@ -29,6 +35,8 @@ function proxyServer(type, port, hostname,ruleFile){
|
|||||||
console.log(color.green("server closed :" + proxyHost + ":" + proxyPort));
|
console.log(color.green("server closed :" + proxyHost + ":" + proxyPort));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
startWebServer();
|
||||||
|
|
||||||
if(ruleFile){
|
if(ruleFile){
|
||||||
if(fs.existsSync(ruleFile)){
|
if(fs.existsSync(ruleFile)){
|
||||||
try{ //for abs path
|
try{ //for abs path
|
||||||
@ -88,6 +96,59 @@ function proxyServer(type, port, hostname,ruleFile){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function startWebServer(port){
|
||||||
|
port = port || DEFAULT_WEB_PORT;
|
||||||
|
|
||||||
|
//web interface
|
||||||
|
var app = express();
|
||||||
|
app.use(function(req, res, next) {
|
||||||
|
res.setHeader("note", "THIS IS A REQUEST FROM ANYPROXY WEB INTERFACE");
|
||||||
|
return next();
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get("/summary",function(req,res){
|
||||||
|
GLOBAL.recorder.getSummaryList(function(err,docs){
|
||||||
|
if(err){
|
||||||
|
res.end(err.toString());
|
||||||
|
}else{
|
||||||
|
res.json(docs.slice(docs.length -500));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get("/body",function(req,res){
|
||||||
|
var reqQuery = url.parse(req.url,true);
|
||||||
|
var id = reqQuery.query.id;
|
||||||
|
|
||||||
|
res.setHeader("Content-Type","text/html");
|
||||||
|
res.writeHead(200);
|
||||||
|
|
||||||
|
var body = GLOBAL.recorder.getBody(id);
|
||||||
|
res.end(entities.encodeHTML(body));
|
||||||
|
});
|
||||||
|
|
||||||
|
app.use(express.static(__dirname + '/web'));
|
||||||
|
|
||||||
|
app.listen(port);
|
||||||
|
|
||||||
|
var tipText = "web interface started at port " + port;
|
||||||
|
console.log(color.green(tipText));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//web socket interface
|
||||||
|
var wss = new WebSocketServer({port: DEFAULT_WEBSOCKET_PORT});
|
||||||
|
wss.broadcast = function(data) {
|
||||||
|
for(var i in this.clients){
|
||||||
|
this.clients[i].send(data);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
GLOBAL.recorder.on("update",function(data){
|
||||||
|
wss.broadcast( JSON.stringify(data) );
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
module.exports.proxyServer = proxyServer;
|
module.exports.proxyServer = proxyServer;
|
||||||
module.exports.generateRootCA = certMgr.generateRootCA;
|
module.exports.generateRootCA = certMgr.generateRootCA;
|
||||||
module.exports.isRootCAFileExists = certMgr.isRootCAFileExists;
|
module.exports.isRootCAFileExists = certMgr.isRootCAFileExists;
|
@ -23,7 +23,7 @@ var rules = {
|
|||||||
"sleep" :5//seconds
|
"sleep" :5//seconds
|
||||||
},{
|
},{
|
||||||
"host" :/./,
|
"host" :/./,
|
||||||
"path" :/(.*)\.html/,
|
"path" :/html/,
|
||||||
"callback" :function(res){
|
"callback" :function(res){
|
||||||
//remoty.js will be inject into response via callback
|
//remoty.js will be inject into response via callback
|
||||||
res.write("<script type=\"text\/javascript\" src=\"http:\/\/localhost:3001\/remoty\.js\"><\/script>");
|
res.write("<script type=\"text\/javascript\" src=\"http:\/\/localhost:3001\/remoty\.js\"><\/script>");
|
||||||
|
File diff suppressed because it is too large
Load Diff
3
web/css/addons/uikit.addons.min.css
vendored
3
web/css/addons/uikit.addons.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
3
web/css/addons/uikit.gradient.addons.min.css
vendored
3
web/css/addons/uikit.gradient.addons.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
3
web/css/uikit.almost-flat.min.css
vendored
3
web/css/uikit.almost-flat.min.css
vendored
File diff suppressed because one or more lines are too long
6936
web/css/uikit.css
6936
web/css/uikit.css
File diff suppressed because it is too large
Load Diff
3
web/css/uikit.min.css
vendored
3
web/css/uikit.min.css
vendored
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
615
web/index.html
615
web/index.html
@ -2,367 +2,344 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Anyproxy</title>
|
<title>Anyproxy</title>
|
||||||
<link rel="stylesheet" href="/css/uikit.min.css" />
|
<link rel="stylesheet" href="/css/uikit.gradient.min.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="topHead">
|
<div class="topHead">
|
||||||
<h1>Anyproxy</h1>
|
<h1>Anyproxy</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class="mainRecordTable uk-table uk-table-striped uk-table-condensed uk-table-hover">
|
<div class="mainTableWrapper J_mainTable">
|
||||||
<thead>
|
<table class="uk-table uk-table-condensed uk-table-hover">
|
||||||
<tr>
|
<thead>
|
||||||
<th>id</th>
|
<tr>
|
||||||
<th>host</th>
|
<th class="col_id">id</th>
|
||||||
<th>path</th>
|
<th class="col_method">method</th>
|
||||||
<th>code</th>
|
<th class="col_code">code</th>
|
||||||
<th>mime type</th>
|
<th class="col_host">host</th>
|
||||||
</tr>
|
<th class="col_path">path</th>
|
||||||
</thead>
|
<th class="col_mime">mime type</th>
|
||||||
<tbody>
|
</tr>
|
||||||
<tr>
|
</thead>
|
||||||
<td>1</td>
|
<tbody class="J_tableBody"></tbody>
|
||||||
<td>www.baidu.com</td>
|
</table>
|
||||||
<td>/search?a=b</td>
|
</div>
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1</td>
|
|
||||||
<td>www.baidu.com</td>
|
|
||||||
<td>/search?a=b</td>
|
|
||||||
<td>200</td>
|
|
||||||
<td>text/html</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<div class="recordDetailOverlay">
|
<div class="recordDetailOverlay J_recordDetailOverlay" style="display:none">
|
||||||
|
<span class="escBtn J_escBtn">Close (ESC)</span>
|
||||||
|
<div class="J_recordDetailOverlayContent"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/template" id="main_table_row">
|
||||||
|
<td class="data_id"><%= _id %></td>
|
||||||
|
<td><%= method %></td>
|
||||||
|
<td class="http_status http_status_<%= statusCode %>"><%= statusCode %></td>
|
||||||
|
<td title="<%= host %>"><%= host %></td>
|
||||||
|
<td title="<%= path %>"><%= path %></td>
|
||||||
|
<td><%= mime %></td>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script type="text/template" id="detail_tpl">
|
||||||
<section class="req">
|
<section class="req">
|
||||||
<h4 class="subTitle">request</h4>
|
<h4 class="subTitle">request</h4>
|
||||||
<div class="detail">
|
<div class="detail">
|
||||||
<ul class="uk-list">
|
<ul class="uk-list">
|
||||||
<li>GET www.baidu.com</li>
|
<li><%= method %> <%= host %></li>
|
||||||
<li>/search?q=123&callbac=123</li>
|
<li><span title="<%= path %>"><%= path %></span></li>
|
||||||
<li><strong>Content-Type</strong> : text/html</li>
|
<% _.each(reqHeader, function(v,k) { %> <li><strong><%= k %></strong> : <%= v %></li><% }); %>
|
||||||
<li><strong>x-powered</strong> : text/html</li>
|
|
||||||
<li><strong>access-control-allow-credencial</strong> : true</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="resHeader">
|
<% if(statusCode) { %>
|
||||||
<h4 class="subTitle">response header</h4>
|
<section class="resHeader">
|
||||||
<div class="detail">
|
<h4 class="subTitle">response header</h4>
|
||||||
<ul class="uk-list">
|
<div class="detail">
|
||||||
<li>HTTP/1.1 200</li>
|
<ul class="uk-list">
|
||||||
<li><strong>Content-Type</strong> : text/html</li>
|
<li>HTTP/1.1 <span class="http_status http_status_<%= statusCode %>"><%= statusCode %></span></li>
|
||||||
<li><strong>x-powered</strong> : text/html</li>
|
<% _.each(resHeader, function(v,k) { %> <li><strong><%= k %></strong> : <%= v %></li><% }); %>
|
||||||
<li><strong>access-control-allow-credencial</strong> : true</li>
|
</ul>
|
||||||
<li><strong>Content-Type</strong> : text/html</li>
|
</div>
|
||||||
<li><strong>x-powered</strong> : text/html</li>
|
</section>
|
||||||
<li><strong>access-control-allow-credencial</strong> : true</li>
|
|
||||||
<li><strong>Content-Type</strong> : text/html</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="resBody">
|
<section class="resBody">
|
||||||
<h4 class="subTitle">response body</h4>
|
<h4 class="subTitle">response body</h4>
|
||||||
<div class="detail">
|
<div class="detail">
|
||||||
<form class="uk-form">
|
<form class="uk-form">
|
||||||
<textarea>NOTE In this example we used a button from the Button component. To add a top margin to form elements, when they stack on smaller viewports, just add the data-uk-margin attribute from the Utility component to the parent element.NOTE In this example we used a button from the Button component. To add a top margin to form elements, when they stack on smaller viewports, just add the data-uk-margin attribute from the Utility component to the parent element. NOTE In this example we used a button from the Button component. To add a top margin to form elements, when they stack on smaller viewports, just add the data-uk-margin attribute from the Utility component to the parent element.NOTE In this example we used a button from the Button component. To add a top margin to form elements, when they stack on smaller viewports, just add the data-uk-margin attribute from the Utility component to the parent element. </textarea>
|
<textarea class="J_responseBody">loading...</textarea>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
<% } %>
|
||||||
|
</script>
|
||||||
|
|
||||||
<script charset="utf-8" id="seajsnode"src="http://static.alipayobjects.com/seajs/??seajs/2.2.0/sea.js,seajs-combo/1.0.1/seajs-combo.js,seajs-style/1.0.2/seajs-style.js"></script>
|
<script charset="utf-8" id="seajsnode"src="http://static.alipayobjects.com/seajs/??seajs/2.2.0/sea.js,seajs-combo/1.0.1/seajs-combo.js,seajs-style/1.0.2/seajs-style.js"></script>
|
||||||
<script>
|
<script>
|
||||||
seajs.config({
|
seajs.config({
|
||||||
base: 'http://static.alipayobjects.com/',
|
base: 'http://static.alipayobjects.com/',
|
||||||
alias: {
|
alias: {
|
||||||
'$' : 'jquery/jquery/1.7.2/jquery',
|
'$' : 'jquery/jquery/1.7.2/jquery',
|
||||||
'Backbone': 'gallery/backbone/1.1.2/backbone.js'
|
'Backbone' : 'gallery/backbone/1.1.2/backbone.js',
|
||||||
|
'Underscore': 'gallery/underscore/1.6.0/underscore.js'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
seajs.use(['$','Underscore' ,'Backbone'], function($, _, Backbone) {
|
||||||
|
Backbone.$ = $;
|
||||||
|
|
||||||
seajs.use(['$', 'Backbone'], function($, Backbone) {
|
$(function(){
|
||||||
var Record = Backbone.Model.extend({
|
|
||||||
defaults:{
|
|
||||||
host:"",
|
|
||||||
path:"",
|
|
||||||
statusCode:"",
|
|
||||||
mimeType:""
|
|
||||||
},
|
|
||||||
initialize : function(){
|
|
||||||
|
|
||||||
|
//record detail
|
||||||
|
//backbone太麻烦了,这里手写拉倒..
|
||||||
|
var DetailView = function(){
|
||||||
|
var self = this,
|
||||||
|
$detailEl = $(".J_recordDetailOverlay");
|
||||||
|
|
||||||
|
$(document).on("keyup",function(e){
|
||||||
|
if(e.keyCode == 27){ //ESC
|
||||||
|
self.hideDetail();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$detailEl.on("click",function(e){
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".J_escBtn",$detailEl).on("click",function(e){
|
||||||
|
self.hideDetail();
|
||||||
|
});
|
||||||
|
|
||||||
|
self.showDetail = function(data){
|
||||||
|
var tpl = _.template($("#detail_tpl").html() , data);
|
||||||
|
|
||||||
|
$(".J_recordDetailOverlayContent",$detailEl).html(tpl);
|
||||||
|
$detailEl.show();
|
||||||
|
|
||||||
|
if(data.statusCode){ //if finished
|
||||||
|
$.ajax({
|
||||||
|
url:"/body?id=" + data._id,
|
||||||
|
headers:{
|
||||||
|
anyproxy_web_req : true
|
||||||
|
},
|
||||||
|
type : "GET",
|
||||||
|
success:function(data){
|
||||||
|
$(".J_responseBody", $detailEl).html(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.hideDetail = function(){
|
||||||
|
$detailEl.hide();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var detailPanel = new DetailView();
|
||||||
|
|
||||||
|
//record list
|
||||||
|
var RecordModel = Backbone.Model.extend({});
|
||||||
|
var RecordList = Backbone.Collection.extend({
|
||||||
|
initialize:function(){
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
self.on("add",function(data){
|
||||||
|
new RecordRowView({
|
||||||
|
model:data,
|
||||||
|
detailPanel : detailPanel
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var RecordRowView = Backbone.View.extend({
|
||||||
|
tagName : "tr",
|
||||||
|
className:function(){
|
||||||
|
return this.model.toJSON().id % 2 ? "row_odd" : "row_even";
|
||||||
|
},
|
||||||
|
tpl : $("#main_table_row").html(),
|
||||||
|
initialize:function(data){
|
||||||
|
var self = this;
|
||||||
|
self.model.on("change",self.render,self);
|
||||||
|
self.addNewRecord();
|
||||||
|
self.detailPanel = data.detailPanel;
|
||||||
|
},
|
||||||
|
events: {
|
||||||
|
click: function(){
|
||||||
|
var self = this;
|
||||||
|
var detailData = self.model.toJSON();
|
||||||
|
self.detailPanel.showDetail(detailData);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
render: function(){
|
||||||
|
var data = this.model.toJSON();
|
||||||
|
if(!data.statusCode){
|
||||||
|
data.statusCode = "-";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!data.mime){
|
||||||
|
data.mime = "-";
|
||||||
|
}
|
||||||
|
|
||||||
|
var html = _.template(this.tpl, data);
|
||||||
|
this.$el.attr("recordId",data.id).empty().html(html);
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
addNewRecord:function(){
|
||||||
|
$(".J_tableBody").prepend(this.render().$el);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var recList = new RecordList();
|
||||||
|
|
||||||
|
var dataSocket = new WebSocket("ws://127.0.0.1:8003");
|
||||||
|
dataSocket.onmessage = function(event){
|
||||||
|
var data = JSON.parse(event.data);
|
||||||
|
|
||||||
|
var previous;
|
||||||
|
if(previous = recList.get(data.id)){
|
||||||
|
previous.set(data);
|
||||||
|
}else{
|
||||||
|
recList.add(new RecordModel(data),{merge: true});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dataSocket.onerror = function(e){
|
||||||
|
alert("socket err, please refresh");
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var RecordList = Backbone.Collection.extend({
|
|
||||||
model:Record
|
|
||||||
});
|
|
||||||
|
|
||||||
var rec1 = new Record({statusCode:200, host:"www.baidu.com", path:"/search?a=b"});
|
|
||||||
var rec2 = new Record({statusCode:200, host:"www.bing.com", path:"/search?a=b"});
|
|
||||||
var rec3 = new Record({statusCode:200, host:"www.google.com", path:"/search?a=b"});
|
|
||||||
|
|
||||||
console.log([rec1,rec2,rec3] );
|
|
||||||
var recList = new RecordList( [rec1,rec2,rec3] );
|
|
||||||
console.log(recList.toJSON());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.topHead{
|
.topHead{
|
||||||
background: #000;
|
background: #000;
|
||||||
color: rgb(204,204,204);
|
color: rgb(204,204,204);
|
||||||
height: 42px;
|
height: 42px;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mainRecordTable{
|
.mainTableWrapper{
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uk-table-hover tbody tr:hover{
|
.mainTableWrapper table{
|
||||||
cursor: pointer;
|
table-layout: fixed;
|
||||||
background: #CCC;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.resHeader{
|
.mainTableWrapper td,
|
||||||
width: 400px;
|
.mainTableWrapper th{
|
||||||
}
|
padding: 4px 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
.resBody textarea{
|
.mainTableWrapper .col_id{
|
||||||
width: 400px;
|
width: 25px;
|
||||||
height: 280px;
|
padding-right: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.subTitle{
|
.mainTableWrapper .col_code{
|
||||||
padding-left: 6px;
|
width: 40px;
|
||||||
border-left: 3px solid #1FA2D6;
|
}
|
||||||
font-size: 16px;
|
|
||||||
line-height: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail{
|
.mainTableWrapper .col_method{
|
||||||
padding-left: 12px;
|
width: 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.recordDetailOverlay{
|
.mainTableWrapper .col_host{
|
||||||
width: 600px;
|
width: 180px;
|
||||||
height: 100%;
|
}
|
||||||
position: fixed;
|
|
||||||
right: 0;
|
|
||||||
background: #FFF;
|
|
||||||
border-left: 1px solid #CCC;
|
|
||||||
top: 0;
|
|
||||||
padding: 10px 10px 20px 10px;
|
|
||||||
overflow-y:scroll;
|
|
||||||
box-sizing: border-box;
|
|
||||||
-moz-box-sizing: border-box;
|
|
||||||
-webkit-box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
.mainTableWrapper tr.row_odd{
|
||||||
|
background: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mainTableWrapper tr.row_even{
|
||||||
|
background: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uk-table-hover tbody tr:hover{
|
||||||
|
cursor: pointer;
|
||||||
|
background: #CCC;
|
||||||
|
}
|
||||||
|
|
||||||
|
.resHeader{
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.resBody textarea{
|
||||||
|
width: 400px;
|
||||||
|
height: 280px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subTitle{
|
||||||
|
padding-left: 6px;
|
||||||
|
border-left: 3px solid #1FA2D6;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail{
|
||||||
|
padding-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.recordDetailOverlay{
|
||||||
|
width: 61.8%;
|
||||||
|
height: 100%;
|
||||||
|
position: fixed;
|
||||||
|
right: 0;
|
||||||
|
background: #FFF;
|
||||||
|
border-left: 1px solid #CCC;
|
||||||
|
top: 0;
|
||||||
|
padding: 10px 10px 20px 10px;
|
||||||
|
overflow-y:scroll;
|
||||||
|
box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.recordDetailOverlay .escBtn{
|
||||||
|
position: absolute;
|
||||||
|
right: 10px;
|
||||||
|
top: 8px;
|
||||||
|
color: #777;
|
||||||
|
cursor: pointer;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.recordDetailOverlay li{
|
||||||
|
white-space: nowrap;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data_id{
|
||||||
|
color: #777;
|
||||||
|
}
|
||||||
|
|
||||||
|
.http_status{
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.http_status_200{
|
||||||
|
color: #408E2F;
|
||||||
|
}
|
||||||
|
|
||||||
|
.http_status_404,
|
||||||
|
.http_status_500,
|
||||||
|
.http_status_501,
|
||||||
|
.http_status_502,
|
||||||
|
.http_status_503,
|
||||||
|
.http_status_504
|
||||||
|
{
|
||||||
|
color: #910A0A;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -1,305 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
(function(addon) {
|
|
||||||
|
|
||||||
var component;
|
|
||||||
|
|
||||||
if (jQuery && jQuery.UIkit) {
|
|
||||||
component = addon(jQuery, jQuery.UIkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof define == "function" && define.amd) {
|
|
||||||
define("uikit-autocomplete", ["uikit"], function(){
|
|
||||||
return component || addon(jQuery, jQuery.UIkit);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
})(function($, UI){
|
|
||||||
|
|
||||||
UI.component('autocomplete', {
|
|
||||||
|
|
||||||
defaults: {
|
|
||||||
minLength: 3,
|
|
||||||
param: 'search',
|
|
||||||
method: 'post',
|
|
||||||
delay: 300,
|
|
||||||
loadingClass: 'uk-loading',
|
|
||||||
flipDropdown: false,
|
|
||||||
skipClass: 'uk-skip',
|
|
||||||
hoverClass: 'uk-active',
|
|
||||||
source: null,
|
|
||||||
renderer: null,
|
|
||||||
|
|
||||||
// template
|
|
||||||
|
|
||||||
template: '<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>'
|
|
||||||
},
|
|
||||||
|
|
||||||
visible : false,
|
|
||||||
value : null,
|
|
||||||
selected : null,
|
|
||||||
|
|
||||||
init: function() {
|
|
||||||
|
|
||||||
var $this = this,
|
|
||||||
select = false,
|
|
||||||
trigger = UI.Utils.debounce(function(e) {
|
|
||||||
if(select) {
|
|
||||||
return (select = false);
|
|
||||||
}
|
|
||||||
$this.handle();
|
|
||||||
}, this.options.delay);
|
|
||||||
|
|
||||||
|
|
||||||
this.dropdown = this.find('.uk-dropdown');
|
|
||||||
this.template = this.find('script[type="text/autocomplete"]').html();
|
|
||||||
this.template = UI.Utils.template(this.template || this.options.template);
|
|
||||||
this.input = this.find("input:first").attr("autocomplete", "off");
|
|
||||||
|
|
||||||
if (!this.dropdown.length) {
|
|
||||||
this.dropdown = $('<div class="uk-dropdown"></div>').appendTo(this.element);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.options.flipDropdown) {
|
|
||||||
this.dropdown.addClass('uk-dropdown-flip');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.input.on({
|
|
||||||
"keydown": function(e) {
|
|
||||||
|
|
||||||
if (e && e.which && !e.shiftKey) {
|
|
||||||
|
|
||||||
switch (e.which) {
|
|
||||||
case 13: // enter
|
|
||||||
select = true;
|
|
||||||
|
|
||||||
if ($this.selected) {
|
|
||||||
e.preventDefault();
|
|
||||||
$this.select();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 38: // up
|
|
||||||
e.preventDefault();
|
|
||||||
$this.pick('prev', true);
|
|
||||||
break;
|
|
||||||
case 40: // down
|
|
||||||
e.preventDefault();
|
|
||||||
$this.pick('next', true);
|
|
||||||
break;
|
|
||||||
case 27:
|
|
||||||
case 9: // esc, tab
|
|
||||||
$this.hide();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
"keyup": trigger,
|
|
||||||
"blur": function(e) {
|
|
||||||
setTimeout(function() { $this.hide(); }, 200);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.dropdown.on("click", ".uk-autocomplete-results > *", function(){
|
|
||||||
$this.select();
|
|
||||||
});
|
|
||||||
|
|
||||||
this.dropdown.on("mouseover", ".uk-autocomplete-results > *", function(){
|
|
||||||
$this.pick($(this));
|
|
||||||
});
|
|
||||||
|
|
||||||
this.triggercomplete = trigger;
|
|
||||||
},
|
|
||||||
|
|
||||||
handle: function() {
|
|
||||||
|
|
||||||
var $this = this, old = this.value;
|
|
||||||
|
|
||||||
this.value = this.input.val();
|
|
||||||
|
|
||||||
if (this.value.length < this.options.minLength) return this.hide();
|
|
||||||
|
|
||||||
if (this.value != old) {
|
|
||||||
$this.request();
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
pick: function(item, scrollinview) {
|
|
||||||
|
|
||||||
var $this = this,
|
|
||||||
items = this.dropdown.find('.uk-autocomplete-results').children(':not(.'+this.options.skipClass+')'),
|
|
||||||
selected = false;
|
|
||||||
|
|
||||||
if (typeof item !== "string" && !item.hasClass(this.options.skipClass)) {
|
|
||||||
selected = item;
|
|
||||||
} else if (item == 'next' || item == 'prev') {
|
|
||||||
|
|
||||||
if (this.selected) {
|
|
||||||
var index = items.index(this.selected);
|
|
||||||
|
|
||||||
if (item == 'next') {
|
|
||||||
selected = items.eq(index + 1 < items.length ? index + 1 : 0);
|
|
||||||
} else {
|
|
||||||
selected = items.eq(index - 1 < 0 ? items.length - 1 : index - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
selected = items[(item == 'next') ? 'first' : 'last']();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selected && selected.length) {
|
|
||||||
this.selected = selected;
|
|
||||||
items.removeClass(this.options.hoverClass);
|
|
||||||
this.selected.addClass(this.options.hoverClass);
|
|
||||||
|
|
||||||
// jump to selected if not in view
|
|
||||||
if (scrollinview) {
|
|
||||||
|
|
||||||
var top = selected.position().top,
|
|
||||||
scrollTop = $this.dropdown.scrollTop(),
|
|
||||||
dpheight = $this.dropdown.height();
|
|
||||||
|
|
||||||
if (top > dpheight || top < 0) {
|
|
||||||
$this.dropdown.scrollTop(scrollTop + top);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
select: function() {
|
|
||||||
|
|
||||||
if(!this.selected) return;
|
|
||||||
|
|
||||||
var data = this.selected.data();
|
|
||||||
|
|
||||||
this.trigger("autocomplete-select", [data, this]);
|
|
||||||
|
|
||||||
if (data.value) {
|
|
||||||
this.input.val(data.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.hide();
|
|
||||||
},
|
|
||||||
|
|
||||||
show: function() {
|
|
||||||
if (this.visible) return;
|
|
||||||
this.visible = true;
|
|
||||||
this.element.addClass("uk-open");
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
hide: function() {
|
|
||||||
if (!this.visible) return;
|
|
||||||
this.visible = false;
|
|
||||||
this.element.removeClass("uk-open");
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
request: function() {
|
|
||||||
|
|
||||||
var $this = this,
|
|
||||||
release = function(data) {
|
|
||||||
|
|
||||||
if(data) {
|
|
||||||
$this.render(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this.element.removeClass($this.options.loadingClass);
|
|
||||||
};
|
|
||||||
|
|
||||||
this.element.addClass(this.options.loadingClass);
|
|
||||||
|
|
||||||
if (this.options.source) {
|
|
||||||
|
|
||||||
var source = this.options.source;
|
|
||||||
|
|
||||||
switch(typeof(this.options.source)) {
|
|
||||||
case 'function':
|
|
||||||
|
|
||||||
this.options.source.apply(this, [release]);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'object':
|
|
||||||
|
|
||||||
if(source.length) {
|
|
||||||
|
|
||||||
var items = [];
|
|
||||||
|
|
||||||
source.forEach(function(item){
|
|
||||||
if(item.value && item.value.toLowerCase().indexOf($this.value.toLowerCase())!=-1) {
|
|
||||||
items.push(item);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
release(items);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'string':
|
|
||||||
|
|
||||||
var params ={};
|
|
||||||
|
|
||||||
params[this.options.param] = this.value;
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: this.options.source,
|
|
||||||
data: params,
|
|
||||||
type: this.options.method,
|
|
||||||
dataType: 'json'
|
|
||||||
}).done(function(json) {
|
|
||||||
release(json || []);
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
release(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this.element.removeClass($this.options.loadingClass);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function(data) {
|
|
||||||
|
|
||||||
var $this = this;
|
|
||||||
|
|
||||||
this.dropdown.empty();
|
|
||||||
|
|
||||||
this.selected = false;
|
|
||||||
|
|
||||||
if (this.options.renderer) {
|
|
||||||
|
|
||||||
this.options.renderer.apply(this, [data]);
|
|
||||||
|
|
||||||
} else if(data && data.length) {
|
|
||||||
|
|
||||||
this.dropdown.append(this.template({"items":data}));
|
|
||||||
this.show();
|
|
||||||
|
|
||||||
this.trigger('autocomplete-show');
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// init code
|
|
||||||
UI.$doc.on("focus.autocomplete.uikit", "[data-uk-autocomplete]", function(e) {
|
|
||||||
|
|
||||||
var ele = $(this);
|
|
||||||
if (!ele.data("autocomplete")) {
|
|
||||||
var obj = UI.autocomplete(ele, UI.Utils.options(ele.attr("data-uk-autocomplete")));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return UI.autocomplete;
|
|
||||||
});
|
|
3
web/js/addons/autocomplete.min.js
vendored
3
web/js/addons/autocomplete.min.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
!function(a){var b;jQuery&&jQuery.UIkit&&(b=a(jQuery,jQuery.UIkit)),"function"==typeof define&&define.amd&&define("uikit-autocomplete",["uikit"],function(){return b||a(jQuery,jQuery.UIkit)})}(function(a,b){return b.component("autocomplete",{defaults:{minLength:3,param:"search",method:"post",delay:300,loadingClass:"uk-loading",flipDropdown:!1,skipClass:"uk-skip",hoverClass:"uk-active",source:null,renderer:null,template:'<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>'},visible:!1,value:null,selected:null,init:function(){var c=this,d=!1,e=b.Utils.debounce(function(){return d?d=!1:void c.handle()},this.options.delay);this.dropdown=this.find(".uk-dropdown"),this.template=this.find('script[type="text/autocomplete"]').html(),this.template=b.Utils.template(this.template||this.options.template),this.input=this.find("input:first").attr("autocomplete","off"),this.dropdown.length||(this.dropdown=a('<div class="uk-dropdown"></div>').appendTo(this.element)),this.options.flipDropdown&&this.dropdown.addClass("uk-dropdown-flip"),this.input.on({keydown:function(a){if(a&&a.which&&!a.shiftKey)switch(a.which){case 13:d=!0,c.selected&&(a.preventDefault(),c.select());break;case 38:a.preventDefault(),c.pick("prev",!0);break;case 40:a.preventDefault(),c.pick("next",!0);break;case 27:case 9:c.hide()}},keyup:e,blur:function(){setTimeout(function(){c.hide()},200)}}),this.dropdown.on("click",".uk-autocomplete-results > *",function(){c.select()}),this.dropdown.on("mouseover",".uk-autocomplete-results > *",function(){c.pick(a(this))}),this.triggercomplete=e},handle:function(){var a=this,b=this.value;return this.value=this.input.val(),this.value.length<this.options.minLength?this.hide():(this.value!=b&&a.request(),this)},pick:function(a,b){var c=this,d=this.dropdown.find(".uk-autocomplete-results").children(":not(."+this.options.skipClass+")"),e=!1;if("string"==typeof a||a.hasClass(this.options.skipClass)){if("next"==a||"prev"==a)if(this.selected){var f=d.index(this.selected);e=d.eq("next"==a?f+1<d.length?f+1:0:0>f-1?d.length-1:f-1)}else e=d["next"==a?"first":"last"]()}else e=a;if(e&&e.length&&(this.selected=e,d.removeClass(this.options.hoverClass),this.selected.addClass(this.options.hoverClass),b)){var g=e.position().top,h=c.dropdown.scrollTop(),i=c.dropdown.height();(g>i||0>g)&&c.dropdown.scrollTop(h+g)}},select:function(){if(this.selected){var a=this.selected.data();this.trigger("autocomplete-select",[a,this]),a.value&&this.input.val(a.value),this.hide()}},show:function(){return this.visible?void 0:(this.visible=!0,this.element.addClass("uk-open"),this)},hide:function(){return this.visible?(this.visible=!1,this.element.removeClass("uk-open"),this):void 0},request:function(){var b=this,c=function(a){a&&b.render(a),b.element.removeClass(b.options.loadingClass)};if(this.element.addClass(this.options.loadingClass),this.options.source){var d=this.options.source;switch(typeof this.options.source){case"function":this.options.source.apply(this,[c]);break;case"object":if(d.length){var e=[];d.forEach(function(a){a.value&&-1!=a.value.toLowerCase().indexOf(b.value.toLowerCase())&&e.push(a)}),c(e)}break;case"string":var f={};f[this.options.param]=this.value,a.ajax({url:this.options.source,data:f,type:this.options.method,dataType:"json"}).done(function(a){c(a||[])});break;default:c(null)}}else this.element.removeClass(b.options.loadingClass)},render:function(a){return this.dropdown.empty(),this.selected=!1,this.options.renderer?this.options.renderer.apply(this,[a]):a&&a.length&&(this.dropdown.append(this.template({items:a})),this.show(),this.trigger("autocomplete-show")),this}}),b.$doc.on("focus.autocomplete.uikit","[data-uk-autocomplete]",function(){var c=a(this);if(!c.data("autocomplete")){b.autocomplete(c,b.Utils.options(c.attr("data-uk-autocomplete")))}}),b.autocomplete});
|
|
@ -1,90 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
(function(addon) {
|
|
||||||
|
|
||||||
var component;
|
|
||||||
|
|
||||||
if (jQuery && jQuery.UIkit) {
|
|
||||||
component = addon(jQuery, jQuery.UIkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof define == "function" && define.amd) {
|
|
||||||
define("uikit-cover", ["uikit"], function(){
|
|
||||||
return component || addon(jQuery, jQuery.UIkit);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
})(function($, UI){
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
UI.component('cover', {
|
|
||||||
|
|
||||||
defaults: {
|
|
||||||
automute : true
|
|
||||||
},
|
|
||||||
|
|
||||||
init: function() {
|
|
||||||
|
|
||||||
this.parent = this.element.parent();
|
|
||||||
this.dimension = {w: this.element.width(), h: this.element.height()};
|
|
||||||
this.ratio = this.dimension.w / this.dimension.h;
|
|
||||||
|
|
||||||
UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(){
|
|
||||||
this.check();
|
|
||||||
}.bind(this), 100));
|
|
||||||
|
|
||||||
this.check();
|
|
||||||
|
|
||||||
this.element.data("cover", this);
|
|
||||||
|
|
||||||
|
|
||||||
if (this.element.is('iframe') && this.options.automute) {
|
|
||||||
|
|
||||||
var src = this.element.attr('src');
|
|
||||||
|
|
||||||
this.element.attr('src', '').on('load', function(){
|
|
||||||
|
|
||||||
this.contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}', '*');
|
|
||||||
|
|
||||||
}).attr('src', [src, (src.indexOf('?') > -1 ? '&':'?'), 'enablejsapi=1&api=1'].join(''));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
check: function() {
|
|
||||||
|
|
||||||
var w = this.parent.width(), h = this.parent.height(), width, height;
|
|
||||||
|
|
||||||
// if element height < parent height (gap underneath)
|
|
||||||
if ((w / this.ratio) < h) {
|
|
||||||
|
|
||||||
width = Math.ceil(h * this.ratio);
|
|
||||||
height = h;
|
|
||||||
|
|
||||||
// element width < parent width (gap to right)
|
|
||||||
} else {
|
|
||||||
|
|
||||||
width = w;
|
|
||||||
height = Math.ceil(w / this.ratio);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.element.css({
|
|
||||||
'width' : width,
|
|
||||||
'height' : height
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// auto init
|
|
||||||
UI.ready(function(context) {
|
|
||||||
|
|
||||||
$("[data-uk-cover]", context).each(function(){
|
|
||||||
|
|
||||||
var ele = $(this);
|
|
||||||
|
|
||||||
if(!ele.data("cover")) {
|
|
||||||
var plugin = UI.cover(ele, UI.Utils.options(ele.attr("data-uk-cover")));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
3
web/js/addons/cover.min.js
vendored
3
web/js/addons/cover.min.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
!function(a){var b;jQuery&&jQuery.UIkit&&(b=a(jQuery,jQuery.UIkit)),"function"==typeof define&&define.amd&&define("uikit-cover",["uikit"],function(){return b||a(jQuery,jQuery.UIkit)})}(function(a,b){"use strict";b.component("cover",{defaults:{automute:!0},init:function(){if(this.parent=this.element.parent(),this.dimension={w:this.element.width(),h:this.element.height()},this.ratio=this.dimension.w/this.dimension.h,b.$win.on("load resize orientationchange",b.Utils.debounce(function(){this.check()}.bind(this),100)),this.check(),this.element.data("cover",this),this.element.is("iframe")&&this.options.automute){var a=this.element.attr("src");this.element.attr("src","").on("load",function(){this.contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}',"*")}).attr("src",[a,a.indexOf("?")>-1?"&":"?","enablejsapi=1&api=1"].join(""))}},check:function(){var a,b,c=this.parent.width(),d=this.parent.height();c/this.ratio<d?(a=Math.ceil(d*this.ratio),b=d):(a=c,b=Math.ceil(c/this.ratio)),this.element.css({width:a,height:b})}}),b.ready(function(c){a("[data-uk-cover]",c).each(function(){var c=a(this);if(!c.data("cover")){b.cover(c,b.Utils.options(c.attr("data-uk-cover")))}})})});
|
|
@ -1,379 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
(function(addon) {
|
|
||||||
|
|
||||||
var component;
|
|
||||||
|
|
||||||
if (jQuery && jQuery.UIkit) {
|
|
||||||
component = addon(jQuery, jQuery.UIkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof define == "function" && define.amd) {
|
|
||||||
define("uikit-datepicker", ["uikit"], function(){
|
|
||||||
return component || addon(jQuery, jQuery.UIkit);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
})(function($, UI){
|
|
||||||
|
|
||||||
// Datepicker
|
|
||||||
|
|
||||||
var active = false, dropdown, moment;
|
|
||||||
|
|
||||||
UI.component('datepicker', {
|
|
||||||
|
|
||||||
defaults: {
|
|
||||||
weekstart: 1,
|
|
||||||
i18n: {
|
|
||||||
months : ['January','February','March','April','May','June','July','August','September','October','November','December'],
|
|
||||||
weekdays : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
|
|
||||||
},
|
|
||||||
format: "DD.MM.YYYY",
|
|
||||||
offsettop: 5,
|
|
||||||
maxDate: false,
|
|
||||||
minDate: false,
|
|
||||||
template: function(data, opts) {
|
|
||||||
|
|
||||||
var content = '', maxDate, minDate;
|
|
||||||
|
|
||||||
if (opts.maxDate!==false){
|
|
||||||
maxDate = isNaN(opts.maxDate) ? moment(opts.maxDate, opts.format) : moment().add('days', opts.maxDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opts.minDate!==false){
|
|
||||||
minDate = isNaN(opts.minDate) ? moment(opts.minDate, opts.format) : moment().add('days',opts.minDate-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
content += '<div class="uk-datepicker-nav">';
|
|
||||||
content += '<a href="" class="uk-datepicker-previous"></a>';
|
|
||||||
content += '<a href="" class="uk-datepicker-next"></a>';
|
|
||||||
|
|
||||||
if (UI.formSelect) {
|
|
||||||
|
|
||||||
var i, currentyear = (new Date()).getFullYear(), options = [], months, years, minYear, maxYear;
|
|
||||||
|
|
||||||
for (i=0;i<opts.i18n.months.length;i++) {
|
|
||||||
if(i==data.month) {
|
|
||||||
options.push('<option value="'+i+'" selected>'+opts.i18n.months[i]+'</option>');
|
|
||||||
} else {
|
|
||||||
options.push('<option value="'+i+'">'+opts.i18n.months[i]+'</option>');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
months = '<span class="uk-form-select">'+ opts.i18n.months[data.month] + '<select class="update-picker-month">'+options.join('')+'</select></span>';
|
|
||||||
|
|
||||||
// --
|
|
||||||
|
|
||||||
options = [];
|
|
||||||
|
|
||||||
minYear = minDate ? minDate.year() : currentyear - 50;
|
|
||||||
maxYear = maxDate ? maxDate.year() : currentyear + 20;
|
|
||||||
|
|
||||||
for (i=minYear;i<=maxYear;i++) {
|
|
||||||
if (i == data.year) {
|
|
||||||
options.push('<option value="'+i+'" selected>'+i+'</option>');
|
|
||||||
} else {
|
|
||||||
options.push('<option value="'+i+'">'+i+'</option>');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
years = '<span class="uk-form-select">'+ data.year + '<select class="update-picker-year">'+options.join('')+'</select></span>';
|
|
||||||
|
|
||||||
content += '<div class="uk-datepicker-heading">'+ months + ' ' + years +'</div>';
|
|
||||||
|
|
||||||
} else {
|
|
||||||
content += '<div class="uk-datepicker-heading">'+ opts.i18n.months[data.month] +' '+ data.year+'</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
content += '</div>';
|
|
||||||
|
|
||||||
content += '<table class="uk-datepicker-table">';
|
|
||||||
content += '<thead>';
|
|
||||||
for(var i = 0; i < data.weekdays.length; i++) {
|
|
||||||
if (data.weekdays[i]) {
|
|
||||||
content += '<th>'+data.weekdays[i]+'</th>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
content += '</thead>';
|
|
||||||
|
|
||||||
content += '<tbody>';
|
|
||||||
for(var i = 0; i < data.days.length; i++) {
|
|
||||||
if (data.days[i] && data.days[i].length){
|
|
||||||
content += '<tr>';
|
|
||||||
for(var d = 0; d < data.days[i].length; d++) {
|
|
||||||
if (data.days[i][d]) {
|
|
||||||
var day = data.days[i][d],
|
|
||||||
cls = [];
|
|
||||||
|
|
||||||
if(!day.inmonth) cls.push("uk-datepicker-table-muted");
|
|
||||||
if(day.selected) cls.push("uk-active");
|
|
||||||
|
|
||||||
if (maxDate && day.day > maxDate) cls.push('uk-datepicker-date-disabled uk-datepicker-table-muted');
|
|
||||||
if (minDate && minDate > day.day) cls.push('uk-datepicker-date-disabled uk-datepicker-table-muted');
|
|
||||||
|
|
||||||
content += '<td><a href="" class="'+cls.join(" ")+'" data-date="'+day.day.format()+'">'+day.day.format("D")+'</a></td>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
content += '</tr>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
content += '</tbody>';
|
|
||||||
|
|
||||||
content += '</table>';
|
|
||||||
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
init: function() {
|
|
||||||
|
|
||||||
var $this = this;
|
|
||||||
|
|
||||||
this.current = this.element.val() ? moment(this.element.val(), this.options.format) : moment();
|
|
||||||
|
|
||||||
this.on("click", function(){
|
|
||||||
if(active!==$this) $this.pick(this.value);
|
|
||||||
}).on("change", function(){
|
|
||||||
|
|
||||||
if($this.element.val() && !moment($this.element.val(), $this.options.format).isValid()) {
|
|
||||||
$this.element.val(moment().format($this.options.format));
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// init dropdown
|
|
||||||
if (!dropdown) {
|
|
||||||
|
|
||||||
dropdown = $('<div class="uk-dropdown uk-datepicker"></div>');
|
|
||||||
|
|
||||||
dropdown.on("click", ".uk-datepicker-next, .uk-datepicker-previous, [data-date]", function(e){
|
|
||||||
e.stopPropagation();
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var ele = $(this);
|
|
||||||
|
|
||||||
if (ele.hasClass('uk-datepicker-date-disabled')) return false;
|
|
||||||
|
|
||||||
if(ele.is('[data-date]')) {
|
|
||||||
active.element.val(moment(ele.data("date")).format(active.options.format)).trigger("change");
|
|
||||||
dropdown.hide();
|
|
||||||
active = false;
|
|
||||||
} else {
|
|
||||||
active.add("months", 1 * (ele.hasClass("uk-datepicker-next") ? 1:-1));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
dropdown.on('change', '.update-picker-month, .update-picker-year', function(){
|
|
||||||
|
|
||||||
var select = $(this);
|
|
||||||
active[select.is('.update-picker-year') ? 'setYear':'setMonth'](Number(select.val()));
|
|
||||||
});
|
|
||||||
|
|
||||||
dropdown.appendTo("body");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
pick: function(initdate) {
|
|
||||||
|
|
||||||
var offset = this.element.offset(),
|
|
||||||
css = {"top": offset.top + this.element.outerHeight() + this.options.offsettop, "left": offset.left, "right":""};
|
|
||||||
|
|
||||||
this.current = initdate ? moment(initdate, this.options.format):moment();
|
|
||||||
this.initdate = this.current.format("YYYY-MM-DD");
|
|
||||||
|
|
||||||
this.update();
|
|
||||||
|
|
||||||
if ($.UIkit.langdirection == 'right') {
|
|
||||||
css.right = window.innerWidth - (css.left + this.element.outerWidth());
|
|
||||||
css.left = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
dropdown.css(css).show();
|
|
||||||
|
|
||||||
active = this;
|
|
||||||
},
|
|
||||||
|
|
||||||
add: function(unit, value) {
|
|
||||||
this.current.add(unit, value);
|
|
||||||
this.update();
|
|
||||||
},
|
|
||||||
|
|
||||||
setMonth: function(month) {
|
|
||||||
this.current.month(month);
|
|
||||||
this.update();
|
|
||||||
},
|
|
||||||
|
|
||||||
setYear: function(year) {
|
|
||||||
this.current.year(year);
|
|
||||||
this.update();
|
|
||||||
},
|
|
||||||
|
|
||||||
update: function() {
|
|
||||||
|
|
||||||
var data = this.getRows(this.current.year(), this.current.month()),
|
|
||||||
tpl = this.options.template(data, this.options);
|
|
||||||
|
|
||||||
dropdown.html(tpl);
|
|
||||||
},
|
|
||||||
|
|
||||||
getRows: function(year, month) {
|
|
||||||
|
|
||||||
var opts = this.options,
|
|
||||||
now = moment().format('YYYY-MM-DD'),
|
|
||||||
days = [31, (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month],
|
|
||||||
before = new Date(year, month, 1).getDay(),
|
|
||||||
data = {"month":month, "year":year,"weekdays":[],"days":[]},
|
|
||||||
row = [];
|
|
||||||
|
|
||||||
data.weekdays = (function(){
|
|
||||||
|
|
||||||
for (var i=0, arr=[]; i < 7; i++) {
|
|
||||||
|
|
||||||
var day = i + (opts.weekstart || 0);
|
|
||||||
|
|
||||||
while (day >= 7) {
|
|
||||||
day -= 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
arr.push(opts.i18n.weekdays[day]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return arr;
|
|
||||||
})();
|
|
||||||
|
|
||||||
if (opts.weekstart && opts.weekstart > 0) {
|
|
||||||
before -= opts.weekstart;
|
|
||||||
if (before < 0) {
|
|
||||||
before += 7;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var cells = days + before, after = cells;
|
|
||||||
|
|
||||||
while(after > 7) { after -= 7; }
|
|
||||||
|
|
||||||
cells += 7 - after;
|
|
||||||
|
|
||||||
var day, isDisabled, isSelected, isToday, isInMonth;
|
|
||||||
|
|
||||||
for (var i = 0, r = 0; i < cells; i++) {
|
|
||||||
|
|
||||||
day = new Date(year, month, 1 + (i - before));
|
|
||||||
isDisabled = (opts.mindate && day < opts.mindate) || (opts.maxdate && day > opts.maxdate);
|
|
||||||
isInMonth = !(i < before || i >= (days + before));
|
|
||||||
|
|
||||||
day = moment(day);
|
|
||||||
|
|
||||||
isSelected = this.initdate == day.format("YYYY-MM-DD");
|
|
||||||
isToday = now == day.format("YYYY-MM-DD");
|
|
||||||
|
|
||||||
row.push({"selected": isSelected, "today": isToday, "disabled": isDisabled, "day":day, "inmonth":isInMonth});
|
|
||||||
|
|
||||||
if (++r === 7) {
|
|
||||||
data.days.push(row);
|
|
||||||
row = [];
|
|
||||||
r = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
},
|
|
||||||
|
|
||||||
hide: function() {
|
|
||||||
|
|
||||||
if (active && active === this) {
|
|
||||||
dropdown.hide();
|
|
||||||
active = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
UI.$win.on("resize orientationchange", function() {
|
|
||||||
|
|
||||||
if (active) {
|
|
||||||
active.hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// init code
|
|
||||||
UI.$doc.on("focus.datepicker.uikit", "[data-uk-datepicker]", function(e) {
|
|
||||||
|
|
||||||
var ele = $(this);
|
|
||||||
if (!ele.data("datepicker")) {
|
|
||||||
e.preventDefault();
|
|
||||||
var obj = UI.datepicker(ele, UI.Utils.options(ele.attr("data-uk-datepicker")));
|
|
||||||
ele.trigger("focus");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
UI.$doc.on("click.datepicker.uikit", function(e) {
|
|
||||||
|
|
||||||
var target = $(e.target);
|
|
||||||
|
|
||||||
if (active && target[0] != dropdown[0] && !target.data("datepicker") && !target.parents(".uk-datepicker:first").length) {
|
|
||||||
active.hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//! moment.js
|
|
||||||
//! version : 2.5.1
|
|
||||||
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
|
||||||
//! license : MIT
|
|
||||||
//! momentjs.com
|
|
||||||
|
|
||||||
moment = (function(B){function G(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function Z(a,b){return function(c){return l(a.call(this,c),b)}}function ta(a,b){return function(c){return this.lang().ordinal(a.call(this,c),b)}}function $(){}function H(a){aa(a);v(this,a)}function I(a){a=ba(a);var b=a.year||0,c=a.month||0,d=a.week||0,f=a.day||0;this._milliseconds=+(a.millisecond||0)+1E3*(a.second||0)+6E4*(a.minute||
|
|
||||||
0)+36E5*(a.hour||0);this._days=+f+7*d;this._months=+c+12*b;this._data={};this._bubble()}function v(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);b.hasOwnProperty("toString")&&(a.toString=b.toString);b.hasOwnProperty("valueOf")&&(a.valueOf=b.valueOf);return a}function w(a){return 0>a?Math.ceil(a):Math.floor(a)}function l(a,b,c){for(var d=""+Math.abs(a);d.length<b;)d="0"+d;return(0<=a?c?"+":"":"-")+d}function J(a,b,c,d){var f=b._milliseconds,g=b._days;b=b._months;var m,h;f&&a._d.setTime(+a._d+
|
|
||||||
f*c);if(g||b)m=a.minute(),h=a.hour();g&&a.date(a.date()+g*c);b&&a.month(a.month()+b*c);f&&!d&&e.updateOffset(a,g||b);if(g||b)a.minute(m),a.hour(h)}function K(a){return"[object Array]"===Object.prototype.toString.call(a)}function ca(a,b,c){var d=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0,e;for(e=0;e<d;e++)(c&&a[e]!==b[e]||!c&&h(a[e])!==h(b[e]))&&g++;return g+f}function n(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=ua[a]||va[b]||b}return a}function ba(a){var b={},c,d;for(d in a)a.hasOwnProperty(d)&&
|
|
||||||
(c=n(d))&&(b[c]=a[d]);return b}function wa(a){var b,c;if(0===a.indexOf("week"))b=7,c="day";else if(0===a.indexOf("month"))b=12,c="month";else return;e[a]=function(d,f){var g,m,h=e.fn._lang[a],k=[];"number"===typeof d&&(f=d,d=B);m=function(a){a=e().utc().set(c,a);return h.call(e.fn._lang,a,d||"")};if(null!=f)return m(f);for(g=0;g<b;g++)k.push(m(g));return k}}function h(a){a=+a;var b=0;0!==a&&isFinite(a)&&(b=0<=a?Math.floor(a):Math.ceil(a));return b}function L(a,b){return(new Date(Date.UTC(a,b+1,0))).getUTCDate()}
|
|
||||||
function da(a,b,c){return C(e([a,11,31+b-c]),b,c).week}function M(a){return 0===a%4&&0!==a%100||0===a%400}function aa(a){var b;a._a&&-2===a._pf.overflow&&(b=0>a._a[x]||11<a._a[x]?x:1>a._a[q]||a._a[q]>L(a._a[r],a._a[x])?q:0>a._a[p]||23<a._a[p]?p:0>a._a[y]||59<a._a[y]?y:0>a._a[D]||59<a._a[D]?D:0>a._a[E]||999<a._a[E]?E:-1,a._pf._overflowDayOfYear&&(b<r||b>q)&&(b=q),a._pf.overflow=b)}function ea(a){null==a._isValid&&(a._isValid=!isNaN(a._d.getTime())&&0>a._pf.overflow&&!a._pf.empty&&!a._pf.invalidMonth&&
|
|
||||||
!a._pf.nullInput&&!a._pf.invalidFormat&&!a._pf.userInvalidated,a._strict&&(a._isValid=a._isValid&&0===a._pf.charsLeftOver&&0===a._pf.unusedTokens.length));return a._isValid}function N(a){return a?a.toLowerCase().replace("_","-"):a}function O(a,b){return b._isUTC?e(a).zone(b._offset||0):e(a).local()}function s(a){var b=0,c,d,f,g,m=function(a){if(!z[a]&&xa)try{require("./lang/"+a)}catch(b){}return z[a]};if(!a)return e.fn._lang;if(!K(a)){if(d=m(a))return d;a=[a]}for(;b<a.length;){g=N(a[b]).split("-");
|
|
||||||
c=g.length;for(f=(f=N(a[b+1]))?f.split("-"):null;0<c;){if(d=m(g.slice(0,c).join("-")))return d;if(f&&f.length>=c&&ca(g,f,!0)>=c-1)break;c--}b++}return e.fn._lang}function ya(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function za(a){var b=a.match(fa),c,d;c=0;for(d=b.length;c<d;c++)b[c]=u[b[c]]?u[b[c]]:ya(b[c]);return function(f){var g="";for(c=0;c<d;c++)g+=b[c]instanceof Function?b[c].call(f,a):b[c];return g}}function P(a,b){if(!a.isValid())return a.lang().invalidDate();
|
|
||||||
b=ga(b,a.lang());Q[b]||(Q[b]=za(b));return Q[b](a)}function ga(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(F.lastIndex=0;0<=d&&F.test(a);)a=a.replace(F,c),F.lastIndex=0,d-=1;return a}function Aa(a,b){var c=b._strict;switch(a){case "DDDD":return ha;case "YYYY":case "GGGG":case "gggg":return c?Ba:Ca;case "Y":case "G":case "g":return Da;case "YYYYYY":case "YYYYY":case "GGGGG":case "ggggg":return c?Ea:Fa;case "S":if(c)return Ga;case "SS":if(c)return ia;case "SSS":if(c)return ha;case "DDD":return Ha;
|
|
||||||
case "MMM":case "MMMM":case "dd":case "ddd":case "dddd":return Ia;case "a":case "A":return s(b._l)._meridiemParse;case "X":return Ja;case "Z":case "ZZ":return R;case "T":return Ka;case "SSSS":return La;case "MM":case "DD":case "YY":case "GG":case "gg":case "HH":case "hh":case "mm":case "ss":case "ww":case "WW":return c?ia:ja;case "M":case "D":case "d":case "H":case "h":case "m":case "s":case "w":case "W":case "e":case "E":return ja;case "Do":return Ma;default:var c=RegExp,d;d=Na(a.replace("\\","")).replace(/[-\/\\^$*+?.()|[\]{}]/g,
|
|
||||||
"\\$&");return new c(d)}}function ka(a){a=(a||"").match(R)||[];a=((a[a.length-1]||[])+"").match(Oa)||["-",0,0];var b=+(60*a[1])+h(a[2]);return"+"===a[0]?-b:b}function S(a){var b,c=[],d,f,g,m,k;if(!a._d){d=Pa(a);a._w&&null==a._a[q]&&null==a._a[x]&&(b=function(b){var c=parseInt(b,10);return b?3>b.length?68<c?1900+c:2E3+c:c:null==a._a[r]?e().weekYear():a._a[r]},f=a._w,null!=f.GG||null!=f.W||null!=f.E?b=la(b(f.GG),f.W||1,f.E,4,1):(g=s(a._l),m=null!=f.d?ma(f.d,g):null!=f.e?parseInt(f.e,10)+g._week.dow:
|
|
||||||
0,k=parseInt(f.w,10)||1,null!=f.d&&m<g._week.dow&&k++,b=la(b(f.gg),k,m,g._week.doy,g._week.dow)),a._a[r]=b.year,a._dayOfYear=b.dayOfYear);a._dayOfYear&&(b=null==a._a[r]?d[r]:a._a[r],a._dayOfYear>(M(b)?366:365)&&(a._pf._overflowDayOfYear=!0),b=T(b,0,a._dayOfYear),a._a[x]=b.getUTCMonth(),a._a[q]=b.getUTCDate());for(b=0;3>b&&null==a._a[b];++b)a._a[b]=c[b]=d[b];for(;7>b;b++)a._a[b]=c[b]=null==a._a[b]?2===b?1:0:a._a[b];c[p]+=h((a._tzm||0)/60);c[y]+=h((a._tzm||0)%60);a._d=(a._useUTC?T:Qa).apply(null,c)}}
|
|
||||||
function Pa(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function U(a){a._a=[];a._pf.empty=!0;var b=s(a._l),c=""+a._i,d,f,g,e,k=c.length,l=0;f=ga(a._f,b).match(fa)||[];for(b=0;b<f.length;b++){g=f[b];if(d=(c.match(Aa(g,a))||[])[0])e=c.substr(0,c.indexOf(d)),0<e.length&&a._pf.unusedInput.push(e),c=c.slice(c.indexOf(d)+d.length),l+=d.length;if(u[g]){d?a._pf.empty=!1:a._pf.unusedTokens.push(g);e=a;var n=void 0,t=e._a;
|
|
||||||
switch(g){case "M":case "MM":null!=d&&(t[x]=h(d)-1);break;case "MMM":case "MMMM":n=s(e._l).monthsParse(d);null!=n?t[x]=n:e._pf.invalidMonth=d;break;case "D":case "DD":null!=d&&(t[q]=h(d));break;case "Do":null!=d&&(t[q]=h(parseInt(d,10)));break;case "DDD":case "DDDD":null!=d&&(e._dayOfYear=h(d));break;case "YY":t[r]=h(d)+(68<h(d)?1900:2E3);break;case "YYYY":case "YYYYY":case "YYYYYY":t[r]=h(d);break;case "a":case "A":e._isPm=s(e._l).isPM(d);break;case "H":case "HH":case "h":case "hh":t[p]=h(d);break;
|
|
||||||
case "m":case "mm":t[y]=h(d);break;case "s":case "ss":t[D]=h(d);break;case "S":case "SS":case "SSS":case "SSSS":t[E]=h(1E3*("0."+d));break;case "X":e._d=new Date(1E3*parseFloat(d));break;case "Z":case "ZZ":e._useUTC=!0;e._tzm=ka(d);break;case "w":case "ww":case "W":case "WW":case "d":case "dd":case "ddd":case "dddd":case "e":case "E":g=g.substr(0,1);case "gg":case "gggg":case "GG":case "GGGG":case "GGGGG":g=g.substr(0,2),d&&(e._w=e._w||{},e._w[g]=d)}}else a._strict&&!d&&a._pf.unusedTokens.push(g)}a._pf.charsLeftOver=
|
|
||||||
k-l;0<c.length&&a._pf.unusedInput.push(c);a._isPm&&12>a._a[p]&&(a._a[p]+=12);!1===a._isPm&&12===a._a[p]&&(a._a[p]=0);S(a);aa(a)}function Na(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,c,d,f,e){return c||d||f||e})}function Qa(a,b,c,d,f,e,h){b=new Date(a,b,c,d,f,e,h);1970>a&&b.setFullYear(a);return b}function T(a){var b=new Date(Date.UTC.apply(null,arguments));1970>a&&b.setUTCFullYear(a);return b}function ma(a,b){if("string"===typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!==
|
|
||||||
typeof a)return null}else a=parseInt(a,10);return a}function Ra(a,b,c,d,f){return f.relativeTime(b||1,!!c,a,d)}function C(a,b,c){b=c-b;c-=a.day();c>b&&(c-=7);c<b-7&&(c+=7);a=e(a).add("d",c);return{week:Math.ceil(a.dayOfYear()/7),year:a.year()}}function la(a,b,c,d,f){var e=T(a,0,1).getUTCDay();b=7*(b-1)+((null!=c?c:f)-f)+(f-e+(e>d?7:0)-(e<f?7:0))+1;return{year:0<b?a:a-1,dayOfYear:0<b?b:(M(a-1)?366:365)+b}}function na(a){var b=a._i,c=a._f;if(null===b)return e.invalid({nullInput:!0});"string"===typeof b&&
|
|
||||||
(a._i=b=s().preparse(b));if(e.isMoment(b)){a=b;var d={},f;for(f in a)a.hasOwnProperty(f)&&Sa.hasOwnProperty(f)&&(d[f]=a[f]);a=d;a._d=new Date(+b._d)}else if(c)if(K(c)){var b=a,g,h;if(0===b._f.length)b._pf.invalidFormat=!0,b._d=new Date(NaN);else{for(f=0;f<b._f.length;f++)if(c=0,d=v({},b),d._pf=G(),d._f=b._f[f],U(d),ea(d)&&(c+=d._pf.charsLeftOver,c+=10*d._pf.unusedTokens.length,d._pf.score=c,null==h||c<h))h=c,g=d;v(b,g||d)}}else U(a);else if(d=a,g=d._i,h=Ta.exec(g),g===B)d._d=new Date;else if(h)d._d=
|
|
||||||
new Date(+h[1]);else if("string"===typeof g)if(b=d._i,f=Ua.exec(b)){d._pf.iso=!0;g=0;for(h=V.length;g<h;g++)if(V[g][1].exec(b)){d._f=V[g][0]+(f[6]||" ");break}g=0;for(h=W.length;g<h;g++)if(W[g][1].exec(b)){d._f+=W[g][0];break}b.match(R)&&(d._f+="Z");U(d)}else d._d=new Date(b);else K(g)?(d._a=g.slice(0),S(d)):"[object Date]"===Object.prototype.toString.call(g)||g instanceof Date?d._d=new Date(+g):"object"===typeof g?d._d||(g=ba(d._i),d._a=[g.year,g.month,g.day,g.hour,g.minute,g.second,g.millisecond],
|
|
||||||
S(d)):d._d=new Date(g);return new H(a)}function oa(a,b){var c="date"===b||"month"===b||"year"===b;e.fn[a]=e.fn[a+"s"]=function(a,f){var g=this._isUTC?"UTC":"";null==f&&(f=c);return null!=a?(this._d["set"+g+b](a),e.updateOffset(this,f),this):this._d["get"+g+b]()}}function Va(a){e.duration.fn[a]=function(){return this._data[a]}}function pa(a,b){e.duration.fn["as"+a]=function(){return+this/b}}for(var e,A=Math.round,k,r=0,x=1,q=2,p=3,y=4,D=5,E=6,z={},Sa={_isAMomentObject:null,_i:null,_f:null,_l:null,
|
|
||||||
_strict:null,_isUTC:null,_offset:null,_pf:null,_lang:null},xa="undefined"!==typeof module&&module.exports&&"undefined"!==typeof require,Ta=/^\/?Date\((\-?\d+)/i,Wa=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,Xa=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,fa=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,
|
|
||||||
F=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,ja=/\d\d?/,Ha=/\d{1,3}/,Ca=/\d{1,4}/,Fa=/[+\-]?\d{1,6}/,La=/\d+/,Ia=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,R=/Z|[\+\-]\d\d:?\d\d/gi,Ka=/T/i,Ja=/[\+\-]?\d+(\.\d{1,3})?/,Ma=/\d{1,2}/,Ga=/\d/,ia=/\d\d/,ha=/\d{3}/,Ba=/\d{4}/,Ea=/[+-]?\d{6}/,Da=/[+-]?\d+/,Ua=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
|
|
||||||
V=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],W=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],Oa=/([\+\-]|\d\d)/gi,X=["Date","Hours","Minutes","Seconds","Milliseconds"],Y={Milliseconds:1,Seconds:1E3,Minutes:6E4,Hours:36E5,Days:864E5,Months:2592E6,Years:31536E6},ua={ms:"millisecond",s:"second",
|
|
||||||
m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},va={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},Q={},qa="DDD w W M D d".split(" "),ra="MDHhmswW".split(""),u={M:function(){return this.month()+1},MMM:function(a){return this.lang().monthsShort(this,a)},MMMM:function(a){return this.lang().months(this,a)},D:function(){return this.date()},
|
|
||||||
DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(a){return this.lang().weekdaysMin(this,a)},ddd:function(a){return this.lang().weekdaysShort(this,a)},dddd:function(a){return this.lang().weekdays(this,a)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return l(this.year()%100,2)},YYYY:function(){return l(this.year(),4)},YYYYY:function(){return l(this.year(),5)},YYYYYY:function(){var a=this.year();return(0<=a?"+":"-")+l(Math.abs(a),
|
|
||||||
6)},gg:function(){return l(this.weekYear()%100,2)},gggg:function(){return l(this.weekYear(),4)},ggggg:function(){return l(this.weekYear(),5)},GG:function(){return l(this.isoWeekYear()%100,2)},GGGG:function(){return l(this.isoWeekYear(),4)},GGGGG:function(){return l(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),
|
|
||||||
!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return h(this.milliseconds()/100)},SS:function(){return l(h(this.milliseconds()/10),2)},SSS:function(){return l(this.milliseconds(),3)},SSSS:function(){return l(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";0>a&&(a=-a,b="-");return b+l(h(a/60),2)+":"+l(h(a)%60,2)},ZZ:function(){var a=-this.zone(),b="+";0>a&&(a=-a,b="-");
|
|
||||||
return b+l(h(a/60),2)+l(h(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},sa=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];qa.length;)k=qa.pop(),u[k+"o"]=ta(u[k],k);for(;ra.length;)k=ra.pop(),u[k+k]=Z(u[k],2);u.DDDD=Z(u.DDD,3);v($.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"===typeof b?this[c]=b:this["_"+c]=b},_months:"January February March April May June July August September October November December".split(" "),
|
|
||||||
months:function(a){return this._months[a.month()]},_monthsShort:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a){var b,c;this._monthsParse||(this._monthsParse=[]);for(b=0;12>b;b++)if(this._monthsParse[b]||(c=e.utc([2E3,b]),c="^"+this.months(c,"")+"|^"+this.monthsShort(c,""),this._monthsParse[b]=RegExp(c.replace(".",""),"i")),this._monthsParse[b].test(a))return b},_weekdays:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
|
|
||||||
weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun Mon Tue Wed Thu Fri Sat".split(" "),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su Mo Tu We Th Fr Sa".split(" "),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c;this._weekdaysParse||(this._weekdaysParse=[]);for(b=0;7>b;b++)if(this._weekdaysParse[b]||(c=e([2E3,1]).day(b),c="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,
|
|
||||||
""),this._weekdaysParse[b]=RegExp(c.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b);return b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},
|
|
||||||
_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return 11<a?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendar[a];return"function"===typeof c?c.apply(b):c},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",
|
|
||||||
y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var f=this._relativeTime[c];return"function"===typeof f?f(a,b,c,d):f.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[0<a?"future":"past"];return"function"===typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",preparse:function(a){return a},postformat:function(a){return a},week:function(a){return C(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",
|
|
||||||
invalidDate:function(){return this._invalidDate}});e=function(a,b,c,d){var f;"boolean"===typeof c&&(d=c,c=B);f={_isAMomentObject:!0};f._i=a;f._f=b;f._l=c;f._strict=d;f._isUTC=!1;f._pf=G();return na(f)};e.utc=function(a,b,c,d){var f;"boolean"===typeof c&&(d=c,c=B);f={_isAMomentObject:!0,_useUTC:!0,_isUTC:!0};f._l=c;f._i=a;f._f=b;f._strict=d;f._pf=G();return na(f).utc()};e.unix=function(a){return e(1E3*a)};e.duration=function(a,b){var c=a,d=null,f;if(e.isDuration(a))c={ms:a._milliseconds,d:a._days,
|
|
||||||
M:a._months};else if("number"===typeof a)c={},b?c[b]=a:c.milliseconds=a;else if(d=Wa.exec(a))f="-"===d[1]?-1:1,c={y:0,d:h(d[q])*f,h:h(d[p])*f,m:h(d[y])*f,s:h(d[D])*f,ms:h(d[E])*f};else if(d=Xa.exec(a))f="-"===d[1]?-1:1,c=function(a){a=a&&parseFloat(a.replace(",","."));return(isNaN(a)?0:a)*f},c={y:c(d[2]),M:c(d[3]),d:c(d[4]),h:c(d[5]),m:c(d[6]),s:c(d[7]),w:c(d[8])};d=new I(c);e.isDuration(a)&&a.hasOwnProperty("_lang")&&(d._lang=a._lang);return d};e.version="2.5.1";e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";
|
|
||||||
e.updateOffset=function(){};e.lang=function(a,b){if(!a)return e.fn._lang._abbr;if(b){var c=N(a);b.abbr=c;z[c]||(z[c]=new $);z[c].set(b)}else null===b?(delete z[a],a="en"):z[a]||s(a);return(e.duration.fn._lang=e.fn._lang=s(a))._abbr};e.langData=function(a){a&&a._lang&&a._lang._abbr&&(a=a._lang._abbr);return s(a)};e.isMoment=function(a){return a instanceof H||null!=a&&a.hasOwnProperty("_isAMomentObject")};e.isDuration=function(a){return a instanceof I};for(k=sa.length-1;0<=k;--k)wa(sa[k]);e.normalizeUnits=
|
|
||||||
function(a){return n(a)};e.invalid=function(a){var b=e.utc(NaN);null!=a?v(b._pf,a):b._pf.userInvalidated=!0;return b};e.parseZone=function(){return e.apply(null,arguments).parseZone()};v(e.fn=H.prototype,{clone:function(){return e(this)},valueOf:function(){return+this._d+6E4*(this._offset||0)},unix:function(){return Math.floor(+this/1E3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=
|
|
||||||
e(this).utc();return 0<a.year()&&9999>=a.year()?P(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):P(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){return[this.year(),this.month(),this.date(),this.hours(),this.minutes(),this.seconds(),this.milliseconds()]},isValid:function(){return ea(this)},isDSTShifted:function(){return this._a?this.isValid()&&0<ca(this._a,(this._isUTC?e.utc(this._a):e(this._a)).toArray()):!1},parsingFlags:function(){return v({},this._pf)},invalidAt:function(){return this._pf.overflow},
|
|
||||||
utc:function(){return this.zone(0)},local:function(){this.zone(0);this._isUTC=!1;return this},format:function(a){a=P(this,a||e.defaultFormat);return this.lang().postformat(a)},add:function(a,b){var c;c="string"===typeof a?e.duration(+b,a):e.duration(a,b);J(this,c,1);return this},subtract:function(a,b){var c;c="string"===typeof a?e.duration(+b,a):e.duration(a,b);J(this,c,-1);return this},diff:function(a,b,c){a=O(a,this);var d=6E4*(this.zone()-a.zone()),f;b=n(b);"year"===b||"month"===b?(f=432E5*(this.daysInMonth()+
|
|
||||||
a.daysInMonth()),d=12*(this.year()-a.year())+(this.month()-a.month()),d+=(this-e(this).startOf("month")-(a-e(a).startOf("month")))/f,d-=6E4*(this.zone()-e(this).startOf("month").zone()-(a.zone()-e(a).startOf("month").zone()))/f,"year"===b&&(d/=12)):(f=this-a,d="second"===b?f/1E3:"minute"===b?f/6E4:"hour"===b?f/36E5:"day"===b?(f-d)/864E5:"week"===b?(f-d)/6048E5:f);return c?d:w(d)},from:function(a,b){return e.duration(this.diff(a)).lang(this.lang()._abbr).humanize(!b)},fromNow:function(a){return this.from(e(),
|
|
||||||
a)},calendar:function(){var a=O(e(),this).startOf("day"),a=this.diff(a,"days",!0),a=-6>a?"sameElse":-1>a?"lastWeek":0>a?"lastDay":1>a?"sameDay":2>a?"nextDay":7>a?"nextWeek":"sameElse";return this.format(this.lang().calendar(a,this))},isLeapYear:function(){return M(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=ma(a,this.lang()),this.add({d:a-
|
|
||||||
b})):b},month:function(a){var b=this._isUTC?"UTC":"",c;if(null!=a){if("string"===typeof a&&(a=this.lang().monthsParse(a),"number"!==typeof a))return this;c=Math.min(this.date(),L(this.year(),a));this._d["set"+b+"Month"](a,c);e.updateOffset(this,!0);return this}return this._d["get"+b+"Month"]()},startOf:function(a){a=n(a);switch(a){case "year":this.month(0);case "month":this.date(1);case "week":case "isoWeek":case "day":this.hours(0);case "hour":this.minutes(0);case "minute":this.seconds(0);case "second":this.milliseconds(0)}"week"===
|
|
||||||
a?this.weekday(0):"isoWeek"===a&&this.isoWeekday(1);return this},endOf:function(a){a=n(a);return this.startOf(a).add("isoWeek"===a?"week":a,1).subtract("ms",1)},isAfter:function(a,b){b="undefined"!==typeof b?b:"millisecond";return+this.clone().startOf(b)>+e(a).startOf(b)},isBefore:function(a,b){b="undefined"!==typeof b?b:"millisecond";return+this.clone().startOf(b)<+e(a).startOf(b)},isSame:function(a,b){b=b||"ms";return+this.clone().startOf(b)===+O(a,this).startOf(b)},min:function(a){a=e.apply(null,
|
|
||||||
arguments);return a<this?this:a},max:function(a){a=e.apply(null,arguments);return a>this?this:a},zone:function(a,b){b=null==b?!0:!1;var c=this._offset||0;if(null!=a)"string"===typeof a&&(a=ka(a)),16>Math.abs(a)&&(a*=60),this._offset=a,this._isUTC=!0,c!==a&&b&&J(this,e.duration(c-a,"m"),1,!0);else return this._isUTC?c:this._d.getTimezoneOffset();return this},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){this._tzm?
|
|
||||||
this.zone(this._tzm):"string"===typeof this._i&&this.zone(this._i);return this},hasAlignedHourOffset:function(a){a=a?e(a).zone():0;return 0===(this.zone()-a)%60},daysInMonth:function(){return L(this.year(),this.month())},dayOfYear:function(a){var b=A((e(this).startOf("day")-e(this).startOf("year"))/864E5)+1;return null==a?b:this.add("d",a-b)},quarter:function(){return Math.ceil((this.month()+1)/3)},weekYear:function(a){var b=C(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==a?
|
|
||||||
b:this.add("y",a-b)},isoWeekYear:function(a){var b=C(this,1,4).year;return null==a?b:this.add("y",a-b)},week:function(a){var b=this.lang().week(this);return null==a?b:this.add("d",7*(a-b))},isoWeek:function(a){var b=C(this,1,4).week;return null==a?b:this.add("d",7*(a-b))},weekday:function(a){var b=(this.day()+7-this.lang()._week.dow)%7;return null==a?b:this.add("d",a-b)},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},isoWeeksInYear:function(){return da(this.year(),
|
|
||||||
1,4)},weeksInYear:function(){var a=this._lang._week;return da(this.year(),a.dow,a.doy)},get:function(a){a=n(a);return this[a]()},set:function(a,b){a=n(a);if("function"===typeof this[a])this[a](b);return this},lang:function(a){if(a===B)return this._lang;this._lang=s(a);return this}});for(k=0;k<X.length;k++)oa(X[k].toLowerCase().replace(/s$/,""),X[k]);oa("year","FullYear");e.fn.days=e.fn.day;e.fn.months=e.fn.month;e.fn.weeks=e.fn.week;e.fn.isoWeeks=e.fn.isoWeek;e.fn.toJSON=e.fn.toISOString;v(e.duration.fn=
|
|
||||||
I.prototype,{_bubble:function(){var a=this._milliseconds,b=this._days,c=this._months,d=this._data;d.milliseconds=a%1E3;a=w(a/1E3);d.seconds=a%60;a=w(a/60);d.minutes=a%60;a=w(a/60);d.hours=a%24;b+=w(a/24);d.days=b%30;c+=w(b/30);d.months=c%12;b=w(c/12);d.years=b},weeks:function(){return w(this.days()/7)},valueOf:function(){return this._milliseconds+864E5*this._days+this._months%12*2592E6+31536E6*h(this._months/12)},humanize:function(a){var b=+this,c;c=!a;var d=this.lang(),f=A(Math.abs(b)/1E3),e=A(f/
|
|
||||||
60),h=A(e/60),k=A(h/24),l=A(k/365),f=45>f&&["s",f]||1===e&&["m"]||45>e&&["mm",e]||1===h&&["h"]||22>h&&["hh",h]||1===k&&["d"]||25>=k&&["dd",k]||45>=k&&["M"]||345>k&&["MM",A(k/30)]||1===l&&["y"]||["yy",l];f[2]=c;f[3]=0<b;f[4]=d;c=Ra.apply({},f);a&&(c=this.lang().pastFuture(b,c));return this.lang().postformat(c)},add:function(a,b){var c=e.duration(a,b);this._milliseconds+=c._milliseconds;this._days+=c._days;this._months+=c._months;this._bubble();return this},subtract:function(a,b){var c=e.duration(a,
|
|
||||||
b);this._milliseconds-=c._milliseconds;this._days-=c._days;this._months-=c._months;this._bubble();return this},get:function(a){a=n(a);return this[a.toLowerCase()+"s"]()},as:function(a){a=n(a);return this["as"+a.charAt(0).toUpperCase()+a.slice(1)+"s"]()},lang:e.fn.lang,toIsoString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),g=Math.abs(this.seconds()+this.milliseconds()/1E3);return this.asSeconds()?(0>
|
|
||||||
this.asSeconds()?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||g?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(g?g+"S":""):"P0D"}});for(k in Y)Y.hasOwnProperty(k)&&(pa(k,Y[k]),Va(k.toLowerCase()));pa("Weeks",6048E5);e.duration.fn.asMonths=function(){return(+this-31536E6*this.years())/2592E6+12*this.years()};e.lang("en",{ordinal:function(a){var b=a%10,b=1===h(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+b}});return e}).call(this);
|
|
||||||
|
|
||||||
UI.datepicker.moment = moment;
|
|
||||||
|
|
||||||
return UI.datepicker;
|
|
||||||
});
|
|
3
web/js/addons/datepicker.min.js
vendored
3
web/js/addons/datepicker.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,62 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
(function(addon) {
|
|
||||||
|
|
||||||
var component;
|
|
||||||
|
|
||||||
if (jQuery && jQuery.UIkit) {
|
|
||||||
component = addon(jQuery, jQuery.UIkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof define == "function" && define.amd) {
|
|
||||||
define("uikit-form-password", ["uikit"], function(){
|
|
||||||
return component || addon(jQuery, jQuery.UIkit);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
})(function($, UI){
|
|
||||||
|
|
||||||
UI.component('formPassword', {
|
|
||||||
|
|
||||||
defaults: {
|
|
||||||
"lblShow": "Show",
|
|
||||||
"lblHide": "Hide"
|
|
||||||
},
|
|
||||||
|
|
||||||
init: function() {
|
|
||||||
|
|
||||||
var $this = this;
|
|
||||||
|
|
||||||
this.on("click", function(e) {
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
if($this.input.length) {
|
|
||||||
var type = $this.input.attr("type");
|
|
||||||
$this.input.attr("type", type=="text" ? "password":"text");
|
|
||||||
$this.element.text($this.options[type=="text" ? "lblShow":"lblHide"]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.input = this.element.next("input").length ? this.element.next("input") : this.element.prev("input");
|
|
||||||
this.element.text(this.options[this.input.is("[type='password']") ? "lblShow":"lblHide"]);
|
|
||||||
|
|
||||||
this.element.data("formPassword", this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// init code
|
|
||||||
UI.$doc.on("click.formpassword.uikit", "[data-uk-form-password]", function(e) {
|
|
||||||
|
|
||||||
var ele = $(this);
|
|
||||||
if (!ele.data("formPassword")) {
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var obj = UI.formPassword(ele, UI.Utils.options(ele.attr("data-uk-form-password")));
|
|
||||||
ele.trigger("click");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return UI.formPassword;
|
|
||||||
});
|
|
3
web/js/addons/form-password.min.js
vendored
3
web/js/addons/form-password.min.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
!function(a){var b;jQuery&&jQuery.UIkit&&(b=a(jQuery,jQuery.UIkit)),"function"==typeof define&&define.amd&&define("uikit-form-password",["uikit"],function(){return b||a(jQuery,jQuery.UIkit)})}(function(a,b){return b.component("formPassword",{defaults:{lblShow:"Show",lblHide:"Hide"},init:function(){var a=this;this.on("click",function(b){if(b.preventDefault(),a.input.length){var c=a.input.attr("type");a.input.attr("type","text"==c?"password":"text"),a.element.text(a.options["text"==c?"lblShow":"lblHide"])}}),this.input=this.element.next("input").length?this.element.next("input"):this.element.prev("input"),this.element.text(this.options[this.input.is("[type='password']")?"lblShow":"lblHide"]),this.element.data("formPassword",this)}}),b.$doc.on("click.formpassword.uikit","[data-uk-form-password]",function(c){var d=a(this);if(!d.data("formPassword")){c.preventDefault();{b.formPassword(d,b.Utils.options(d.attr("data-uk-form-password")))}d.trigger("click")}}),b.formPassword});
|
|
@ -1,62 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
(function(addon) {
|
|
||||||
|
|
||||||
var component;
|
|
||||||
|
|
||||||
if (jQuery && jQuery.UIkit) {
|
|
||||||
component = addon(jQuery, jQuery.UIkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof define == "function" && define.amd) {
|
|
||||||
define("uikit-form-select", ["uikit"], function(){
|
|
||||||
return component || addon(jQuery, jQuery.UIkit);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
})(function($, UI){
|
|
||||||
|
|
||||||
UI.component('formSelect', {
|
|
||||||
defaults: {
|
|
||||||
'target': '>span:first'
|
|
||||||
},
|
|
||||||
|
|
||||||
init: function() {
|
|
||||||
var $this = this;
|
|
||||||
|
|
||||||
this.target = this.find(this.options.target);
|
|
||||||
this.select = this.find('select');
|
|
||||||
|
|
||||||
// init + on change event
|
|
||||||
this.select.on("change", (function(){
|
|
||||||
|
|
||||||
var select = $this.select[0], fn = function(){
|
|
||||||
|
|
||||||
try {
|
|
||||||
$this.target.text(select.options[select.selectedIndex].text);
|
|
||||||
} catch(e) {}
|
|
||||||
|
|
||||||
return fn;
|
|
||||||
};
|
|
||||||
|
|
||||||
return fn();
|
|
||||||
})());
|
|
||||||
|
|
||||||
this.element.data("formSelect", this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// init code
|
|
||||||
UI.ready(function(context) {
|
|
||||||
|
|
||||||
$("[data-uk-form-select]", context).each(function(){
|
|
||||||
var ele = $(this);
|
|
||||||
|
|
||||||
if (!ele.data("formSelect")) {
|
|
||||||
var obj = UI.formSelect(ele, UI.Utils.options(ele.attr("data-uk-form-select")));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return UI.formSelect;
|
|
||||||
});
|
|
3
web/js/addons/form-select.min.js
vendored
3
web/js/addons/form-select.min.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
!function(a){var b;jQuery&&jQuery.UIkit&&(b=a(jQuery,jQuery.UIkit)),"function"==typeof define&&define.amd&&define("uikit-form-select",["uikit"],function(){return b||a(jQuery,jQuery.UIkit)})}(function(a,b){return b.component("formSelect",{defaults:{target:">span:first"},init:function(){var a=this;this.target=this.find(this.options.target),this.select=this.find("select"),this.select.on("change",function(){var b=a.select[0],c=function(){try{a.target.text(b.options[b.selectedIndex].text)}catch(d){}return c};return c()}()),this.element.data("formSelect",this)}}),b.ready(function(c){a("[data-uk-form-select]",c).each(function(){var c=a(this);if(!c.data("formSelect")){b.formSelect(c,b.Utils.options(c.attr("data-uk-form-select")))}})}),b.formSelect});
|
|
@ -1,615 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
(function(addon) {
|
|
||||||
|
|
||||||
var component;
|
|
||||||
|
|
||||||
if (jQuery && jQuery.UIkit) {
|
|
||||||
component = addon(jQuery, jQuery.UIkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof define == "function" && define.amd) {
|
|
||||||
define("uikit-htmleditor", ["uikit"], function(){
|
|
||||||
return component || addon(jQuery, jQuery.UIkit);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
})(function($, UI) {
|
|
||||||
|
|
||||||
var editors = [];
|
|
||||||
|
|
||||||
UI.component('htmleditor', {
|
|
||||||
|
|
||||||
defaults: {
|
|
||||||
iframe : false,
|
|
||||||
mode : 'split',
|
|
||||||
markdown : false,
|
|
||||||
autocomplete : true,
|
|
||||||
height : 500,
|
|
||||||
maxsplitsize : 1000,
|
|
||||||
markedOptions: { gfm: true, tables: true, breaks: true, pedantic: true, sanitize: false, smartLists: true, smartypants: false, langPrefix: 'lang-'},
|
|
||||||
codemirror : { mode: 'htmlmixed', lineWrapping: true, dragDrop: false, autoCloseTags: true, matchTags: true, autoCloseBrackets: true, matchBrackets: true, indentUnit: 4, indentWithTabs: false, tabSize: 4, hintOptions: {completionSingle:false} },
|
|
||||||
toolbar : [ 'bold', 'italic', 'strike', 'link', 'image', 'blockquote', 'listUl', 'listOl' ],
|
|
||||||
lblPreview : 'Preview',
|
|
||||||
lblCodeview : 'HTML',
|
|
||||||
lblMarkedview: 'Markdown'
|
|
||||||
},
|
|
||||||
|
|
||||||
init: function() {
|
|
||||||
|
|
||||||
var $this = this, tpl = UI.components.htmleditor.template;
|
|
||||||
|
|
||||||
this.CodeMirror = this.options.CodeMirror || CodeMirror;
|
|
||||||
this.buttons = {};
|
|
||||||
|
|
||||||
tpl = tpl.replace(/\{:lblPreview\}/g, this.options.lblPreview);
|
|
||||||
tpl = tpl.replace(/\{:lblCodeview\}/g, this.options.lblCodeview);
|
|
||||||
|
|
||||||
this.htmleditor = $(tpl);
|
|
||||||
this.content = this.htmleditor.find('.uk-htmleditor-content');
|
|
||||||
this.toolbar = this.htmleditor.find('.uk-htmleditor-toolbar');
|
|
||||||
this.preview = this.htmleditor.find('.uk-htmleditor-preview').children().eq(0);
|
|
||||||
this.code = this.htmleditor.find('.uk-htmleditor-code');
|
|
||||||
|
|
||||||
this.element.before(this.htmleditor).appendTo(this.code);
|
|
||||||
this.editor = this.CodeMirror.fromTextArea(this.element[0], this.options.codemirror);
|
|
||||||
this.editor.htmleditor = this;
|
|
||||||
this.editor.on('change', UI.Utils.debounce(function() { $this.render(); }, 150));
|
|
||||||
this.editor.on('change', function() { $this.editor.save(); });
|
|
||||||
this.code.find('.CodeMirror').css('height', this.options.height);
|
|
||||||
|
|
||||||
// iframe mode?
|
|
||||||
if (this.options.iframe) {
|
|
||||||
|
|
||||||
this.iframe = $('<iframe class="uk-htmleditor-iframe" frameborder="0" scrolling="auto" height="100" width="100%"></iframe>');
|
|
||||||
this.preview.append(this.iframe);
|
|
||||||
|
|
||||||
// must open and close document object to start using it!
|
|
||||||
this.iframe[0].contentWindow.document.open();
|
|
||||||
this.iframe[0].contentWindow.document.close();
|
|
||||||
|
|
||||||
this.preview.container = $(this.iframe[0].contentWindow.document).find('body');
|
|
||||||
|
|
||||||
// append custom stylesheet
|
|
||||||
if (typeof(this.options.iframe) === 'string') {
|
|
||||||
this.preview.container.parent().append('<link rel="stylesheet" href="'+this.options.iframe+'">');
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this.preview.container = this.preview;
|
|
||||||
}
|
|
||||||
|
|
||||||
UI.$win.on('resize', UI.Utils.debounce(function() { $this.fit(); }, 200));
|
|
||||||
|
|
||||||
var previewContainer = this.iframe ? this.preview.container:$this.preview.parent(),
|
|
||||||
codeContent = this.code.find('.CodeMirror-sizer'),
|
|
||||||
codeScroll = this.code.find('.CodeMirror-scroll').on('scroll', UI.Utils.debounce(function() {
|
|
||||||
|
|
||||||
if ($this.htmleditor.attr('data-mode') == 'tab') return;
|
|
||||||
|
|
||||||
// calc position
|
|
||||||
var codeHeight = codeContent.height() - codeScroll.height(),
|
|
||||||
previewHeight = previewContainer[0].scrollHeight - ($this.iframe ? $this.iframe.height() : previewContainer.height()),
|
|
||||||
ratio = previewHeight / codeHeight,
|
|
||||||
previewPostition = codeScroll.scrollTop() * ratio;
|
|
||||||
|
|
||||||
// apply new scroll
|
|
||||||
previewContainer.scrollTop(previewPostition);
|
|
||||||
|
|
||||||
}, 10));
|
|
||||||
|
|
||||||
this.htmleditor.on('click', '.uk-htmleditor-button-code, .uk-htmleditor-button-preview', function(e) {
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
if ($this.htmleditor.attr('data-mode') == 'tab') {
|
|
||||||
|
|
||||||
$this.htmleditor.find('.uk-htmleditor-button-code, .uk-htmleditor-button-preview').removeClass('uk-active').filter(this).addClass('uk-active');
|
|
||||||
|
|
||||||
$this.activetab = $(this).hasClass('uk-htmleditor-button-code') ? 'code' : 'preview';
|
|
||||||
$this.htmleditor.attr('data-active-tab', $this.activetab);
|
|
||||||
$this.editor.refresh();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// toolbar actions
|
|
||||||
this.htmleditor.on('click', 'a[data-htmleditor-button]', function() {
|
|
||||||
|
|
||||||
if (!$this.code.is(':visible')) return;
|
|
||||||
|
|
||||||
$this.trigger('action.' + $(this).data('htmleditor-button'), [$this.editor]);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.preview.parent().css('height', this.code.height());
|
|
||||||
|
|
||||||
// autocomplete
|
|
||||||
if (this.options.autocomplete && this.CodeMirror.showHint && this.CodeMirror.hint && this.CodeMirror.hint.html) {
|
|
||||||
|
|
||||||
this.editor.on('inputRead', UI.Utils.debounce(function() {
|
|
||||||
var doc = $this.editor.getDoc(), POS = doc.getCursor(), mode = $this.CodeMirror.innerMode($this.editor.getMode(), $this.editor.getTokenAt(POS).state).mode.name;
|
|
||||||
|
|
||||||
if (mode == 'xml') { //html depends on xml
|
|
||||||
|
|
||||||
var cur = $this.editor.getCursor(), token = $this.editor.getTokenAt(cur);
|
|
||||||
|
|
||||||
if (token.string.charAt(0) == '<' || token.type == 'attribute') {
|
|
||||||
$this.CodeMirror.showHint($this.editor, $this.CodeMirror.hint.html, { completeSingle: false });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 100));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.debouncedRedraw = UI.Utils.debounce(function () { $this.redraw(); }, 5);
|
|
||||||
|
|
||||||
this.on('init', function() {
|
|
||||||
$this.redraw();
|
|
||||||
});
|
|
||||||
|
|
||||||
this.element.attr('data-uk-check-display', 1).on('uk-check-display', function(e) {
|
|
||||||
if(this.htmleditor.is(":visible")) this.fit();
|
|
||||||
}.bind(this));
|
|
||||||
|
|
||||||
editors.push(this);
|
|
||||||
},
|
|
||||||
|
|
||||||
addButton: function(name, button) {
|
|
||||||
this.buttons[name] = button;
|
|
||||||
},
|
|
||||||
|
|
||||||
addButtons: function(buttons) {
|
|
||||||
$.extend(this.buttons, buttons);
|
|
||||||
},
|
|
||||||
|
|
||||||
replaceInPreview: function(regexp, callback) {
|
|
||||||
|
|
||||||
var editor = this.editor, results = [], value = editor.getValue(), offset = -1;
|
|
||||||
|
|
||||||
this.currentvalue = this.currentvalue.replace(regexp, function() {
|
|
||||||
|
|
||||||
offset = value.indexOf(arguments[0], ++offset);
|
|
||||||
|
|
||||||
var match = {
|
|
||||||
matches: arguments,
|
|
||||||
from : translateOffset(offset),
|
|
||||||
to : translateOffset(offset + arguments[0].length),
|
|
||||||
replace: function(value) {
|
|
||||||
editor.replaceRange(value, match.from, match.to);
|
|
||||||
},
|
|
||||||
inRange: function(cursor) {
|
|
||||||
|
|
||||||
if (cursor.line === match.from.line && cursor.line === match.to.line) {
|
|
||||||
return cursor.ch >= match.from.ch && cursor.ch < match.to.ch;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (cursor.line === match.from.line && cursor.ch >= match.from.ch)
|
|
||||||
|| (cursor.line > match.from.line && cursor.line < match.to.line)
|
|
||||||
|| (cursor.line === match.to.line && cursor.ch < match.to.ch);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var result = callback(match);
|
|
||||||
|
|
||||||
if (result == false) {
|
|
||||||
return arguments[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
results.push(match);
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
|
|
||||||
function translateOffset(offset) {
|
|
||||||
var result = editor.getValue().substring(0, offset).split('\n');
|
|
||||||
return { line: result.length - 1, ch: result[result.length - 1].length }
|
|
||||||
}
|
|
||||||
|
|
||||||
return results;
|
|
||||||
},
|
|
||||||
|
|
||||||
_buildtoolbar: function() {
|
|
||||||
|
|
||||||
if (!(this.options.toolbar && this.options.toolbar.length)) return;
|
|
||||||
|
|
||||||
var $this = this, bar = [];
|
|
||||||
|
|
||||||
this.toolbar.empty();
|
|
||||||
|
|
||||||
this.options.toolbar.forEach(function(button) {
|
|
||||||
if (!$this.buttons[button]) return;
|
|
||||||
|
|
||||||
var title = $this.buttons[button].title ? $this.buttons[button].title : button;
|
|
||||||
|
|
||||||
bar.push('<li><a data-htmleditor-button="'+button+'" title="'+title+'" data-uk-tooltip>'+$this.buttons[button].label+'</a></li>');
|
|
||||||
});
|
|
||||||
|
|
||||||
this.toolbar.html(bar.join('\n'));
|
|
||||||
},
|
|
||||||
|
|
||||||
fit: function() {
|
|
||||||
|
|
||||||
var mode = this.options.mode;
|
|
||||||
|
|
||||||
if (mode == 'split' && this.htmleditor.width() < this.options.maxsplitsize) {
|
|
||||||
mode = 'tab';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mode == 'tab') {
|
|
||||||
if (!this.activetab) {
|
|
||||||
this.activetab = 'code';
|
|
||||||
this.htmleditor.attr('data-active-tab', this.activetab);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.htmleditor.find('.uk-htmleditor-button-code, .uk-htmleditor-button-preview').removeClass('uk-active')
|
|
||||||
.filter(this.activetab == 'code' ? '.uk-htmleditor-button-code' : '.uk-htmleditor-button-preview')
|
|
||||||
.addClass('uk-active');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.editor.refresh();
|
|
||||||
this.preview.parent().css('height', this.code.height());
|
|
||||||
|
|
||||||
this.htmleditor.attr('data-mode', mode);
|
|
||||||
},
|
|
||||||
|
|
||||||
redraw: function() {
|
|
||||||
this._buildtoolbar();
|
|
||||||
this.render();
|
|
||||||
this.fit();
|
|
||||||
},
|
|
||||||
|
|
||||||
getMode: function() {
|
|
||||||
return this.editor.getOption('mode');
|
|
||||||
},
|
|
||||||
|
|
||||||
getCursorMode: function() {
|
|
||||||
var param = { mode: 'html'};
|
|
||||||
this.trigger('cursorMode', [param]);
|
|
||||||
return param.mode;
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function() {
|
|
||||||
|
|
||||||
this.currentvalue = this.editor.getValue();
|
|
||||||
|
|
||||||
// empty code
|
|
||||||
if (!this.currentvalue) {
|
|
||||||
|
|
||||||
this.element.val('');
|
|
||||||
this.preview.container.html('');
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.trigger('render', [this]);
|
|
||||||
this.trigger('renderLate', [this]);
|
|
||||||
|
|
||||||
this.preview.container.html(this.currentvalue);
|
|
||||||
},
|
|
||||||
|
|
||||||
addShortcut: function(name, callback) {
|
|
||||||
var map = {};
|
|
||||||
if (!$.isArray(name)) {
|
|
||||||
name = [name];
|
|
||||||
}
|
|
||||||
|
|
||||||
name.forEach(function(key) {
|
|
||||||
map[key] = callback;
|
|
||||||
});
|
|
||||||
|
|
||||||
this.editor.addKeyMap(map);
|
|
||||||
|
|
||||||
return map;
|
|
||||||
},
|
|
||||||
|
|
||||||
addShortcutAction: function(action, shortcuts) {
|
|
||||||
var editor = this;
|
|
||||||
this.addShortcut(shortcuts, function() {
|
|
||||||
editor.element.trigger('action.' + action, [editor.editor]);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
replaceSelection: function(replace) {
|
|
||||||
|
|
||||||
var text = this.editor.getSelection();
|
|
||||||
|
|
||||||
if (!text.length) {
|
|
||||||
|
|
||||||
var cur = this.editor.getCursor(),
|
|
||||||
curLine = this.editor.getLine(cur.line),
|
|
||||||
start = cur.ch,
|
|
||||||
end = start;
|
|
||||||
|
|
||||||
while (end < curLine.length && /[\w$]+/.test(curLine.charAt(end))) ++end;
|
|
||||||
while (start && /[\w$]+/.test(curLine.charAt(start - 1))) --start;
|
|
||||||
|
|
||||||
var curWord = start != end && curLine.slice(start, end);
|
|
||||||
|
|
||||||
if (curWord) {
|
|
||||||
this.editor.setSelection({ line: cur.line, ch: start}, { line: cur.line, ch: end });
|
|
||||||
text = curWord;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var html = replace.replace('$1', text);
|
|
||||||
|
|
||||||
this.editor.replaceSelection(html, 'end');
|
|
||||||
this.editor.focus();
|
|
||||||
},
|
|
||||||
|
|
||||||
replaceLine: function(replace) {
|
|
||||||
var pos = this.editor.getDoc().getCursor(),
|
|
||||||
text = this.editor.getLine(pos.line),
|
|
||||||
html = replace.replace('$1', text);
|
|
||||||
|
|
||||||
this.editor.replaceRange(html , { line: pos.line, ch: 0 }, { line: pos.line, ch: text.length });
|
|
||||||
this.editor.setCursor({ line: pos.line, ch: html.length });
|
|
||||||
this.editor.focus();
|
|
||||||
},
|
|
||||||
|
|
||||||
save: function() {
|
|
||||||
this.editor.save();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
UI.components.htmleditor.template = [
|
|
||||||
'<div class="uk-htmleditor uk-clearfix" data-mode="split">',
|
|
||||||
'<div class="uk-htmleditor-navbar">',
|
|
||||||
'<ul class="uk-htmleditor-navbar-nav uk-htmleditor-toolbar"></ul>',
|
|
||||||
'<div class="uk-htmleditor-navbar-flip">',
|
|
||||||
'<ul class="uk-htmleditor-navbar-nav">',
|
|
||||||
'<li class="uk-htmleditor-button-code"><a>{:lblCodeview}</a></li>',
|
|
||||||
'<li class="uk-htmleditor-button-preview"><a>{:lblPreview}</a></li>',
|
|
||||||
'<li><a data-htmleditor-button="fullscreen"><i class="uk-icon-expand"></i></a></li>',
|
|
||||||
'</ul>',
|
|
||||||
'</div>',
|
|
||||||
'</div>',
|
|
||||||
'<div class="uk-htmleditor-content">',
|
|
||||||
'<div class="uk-htmleditor-code"></div>',
|
|
||||||
'<div class="uk-htmleditor-preview"><div></div></div>',
|
|
||||||
'</div>',
|
|
||||||
'</div>'
|
|
||||||
].join('');
|
|
||||||
|
|
||||||
|
|
||||||
UI.plugin('htmleditor', 'base', {
|
|
||||||
|
|
||||||
init: function(editor) {
|
|
||||||
|
|
||||||
editor.addButtons({
|
|
||||||
|
|
||||||
fullscreen: {
|
|
||||||
title : 'Fullscreen',
|
|
||||||
label : '<i class="uk-icon-expand"></i>'
|
|
||||||
},
|
|
||||||
bold : {
|
|
||||||
title : 'Bold',
|
|
||||||
label : '<i class="uk-icon-bold"></i>'
|
|
||||||
},
|
|
||||||
italic : {
|
|
||||||
title : 'Italic',
|
|
||||||
label : '<i class="uk-icon-italic"></i>'
|
|
||||||
},
|
|
||||||
strike : {
|
|
||||||
title : 'Strikethrough',
|
|
||||||
label : '<i class="uk-icon-strikethrough"></i>'
|
|
||||||
},
|
|
||||||
blockquote : {
|
|
||||||
title : 'Blockquote',
|
|
||||||
label : '<i class="uk-icon-quote-right"></i>'
|
|
||||||
},
|
|
||||||
link : {
|
|
||||||
title : 'Link',
|
|
||||||
label : '<i class="uk-icon-link"></i>'
|
|
||||||
},
|
|
||||||
image : {
|
|
||||||
title : 'Image',
|
|
||||||
label : '<i class="uk-icon-picture-o"></i>'
|
|
||||||
},
|
|
||||||
listUl : {
|
|
||||||
title : 'Unordered List',
|
|
||||||
label : '<i class="uk-icon-list-ul"></i>'
|
|
||||||
},
|
|
||||||
listOl : {
|
|
||||||
title : 'Ordered List',
|
|
||||||
label : '<i class="uk-icon-list-ol"></i>'
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
addAction('bold', '<strong>$1</strong>');
|
|
||||||
addAction('italic', '<em>$1</em>');
|
|
||||||
addAction('strike', '<del>$1</del>');
|
|
||||||
addAction('blockquote', '<blockquote><p>$1</p></blockquote>', 'replaceLine');
|
|
||||||
addAction('link', '<a href="http://">$1</a>');
|
|
||||||
addAction('image', '<img src="http://" alt="$1">');
|
|
||||||
|
|
||||||
var listfn = function() {
|
|
||||||
if (editor.getCursorMode() == 'html') {
|
|
||||||
|
|
||||||
var cm = editor.editor,
|
|
||||||
pos = cm.getDoc().getCursor(true),
|
|
||||||
posend = cm.getDoc().getCursor(false);
|
|
||||||
|
|
||||||
for (var i=pos.line; i<(posend.line+1);i++) {
|
|
||||||
cm.replaceRange('<li>'+cm.getLine(i)+'</li>', { line: i, ch: 0 }, { line: i, ch: cm.getLine(i).length });
|
|
||||||
}
|
|
||||||
|
|
||||||
cm.setCursor({ line: posend.line, ch: cm.getLine(posend.line).length });
|
|
||||||
cm.focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.on('action.listUl', function() {
|
|
||||||
listfn();
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.on('action.listOl', function() {
|
|
||||||
listfn();
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.htmleditor.on('click', 'a[data-htmleditor-button="fullscreen"]', function() {
|
|
||||||
editor.htmleditor.toggleClass('uk-htmleditor-fullscreen');
|
|
||||||
|
|
||||||
var wrap = editor.editor.getWrapperElement();
|
|
||||||
|
|
||||||
if (editor.htmleditor.hasClass('uk-htmleditor-fullscreen')) {
|
|
||||||
|
|
||||||
editor.editor.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset, width: wrap.style.width, height: wrap.style.height};
|
|
||||||
wrap.style.width = '';
|
|
||||||
wrap.style.height = editor.content.height()+'px';
|
|
||||||
document.documentElement.style.overflow = 'hidden';
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
document.documentElement.style.overflow = '';
|
|
||||||
var info = editor.editor.state.fullScreenRestore;
|
|
||||||
wrap.style.width = info.width; wrap.style.height = info.height;
|
|
||||||
window.scrollTo(info.scrollLeft, info.scrollTop);
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(function() {
|
|
||||||
editor.fit();
|
|
||||||
UI.$win.trigger('resize');
|
|
||||||
}, 50);
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.addShortcut(['Ctrl-S', 'Cmd-S'], function() { editor.element.trigger('htmleditor-save', [editor]); });
|
|
||||||
editor.addShortcutAction('bold', ['Ctrl-B', 'Cmd-B']);
|
|
||||||
|
|
||||||
function addAction(name, replace, mode) {
|
|
||||||
editor.on('action.'+name, function() {
|
|
||||||
if (editor.getCursorMode() == 'html') {
|
|
||||||
editor[mode == 'replaceLine' ? 'replaceLine' : 'replaceSelection'](replace);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
UI.plugin('htmleditor', 'markdown', {
|
|
||||||
|
|
||||||
init: function(editor) {
|
|
||||||
|
|
||||||
var parser = editor.options.marked || marked;
|
|
||||||
|
|
||||||
if (!parser) return;
|
|
||||||
|
|
||||||
parser.setOptions(editor.options.markedOptions);
|
|
||||||
|
|
||||||
if (editor.options.markdown) {
|
|
||||||
enableMarkdown()
|
|
||||||
}
|
|
||||||
|
|
||||||
addAction('bold', '**$1**');
|
|
||||||
addAction('italic', '*$1*');
|
|
||||||
addAction('strike', '~~$1~~');
|
|
||||||
addAction('blockquote', '> $1', 'replaceLine');
|
|
||||||
addAction('link', '[$1](http://)');
|
|
||||||
addAction('image', '');
|
|
||||||
|
|
||||||
editor.on('action.listUl', function() {
|
|
||||||
|
|
||||||
if (editor.getCursorMode() == 'markdown') {
|
|
||||||
|
|
||||||
var cm = editor.editor,
|
|
||||||
pos = cm.getDoc().getCursor(true),
|
|
||||||
posend = cm.getDoc().getCursor(false);
|
|
||||||
|
|
||||||
for (var i=pos.line; i<(posend.line+1);i++) {
|
|
||||||
cm.replaceRange('* '+cm.getLine(i), { line: i, ch: 0 }, { line: i, ch: cm.getLine(i).length });
|
|
||||||
}
|
|
||||||
|
|
||||||
cm.setCursor({ line: posend.line, ch: cm.getLine(posend.line).length });
|
|
||||||
cm.focus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.on('action.listOl', function() {
|
|
||||||
|
|
||||||
if (editor.getCursorMode() == 'markdown') {
|
|
||||||
|
|
||||||
var cm = editor.editor,
|
|
||||||
pos = cm.getDoc().getCursor(true),
|
|
||||||
posend = cm.getDoc().getCursor(false),
|
|
||||||
prefix = 1;
|
|
||||||
|
|
||||||
if (pos.line > 0) {
|
|
||||||
var prevline = cm.getLine(pos.line-1), matches;
|
|
||||||
|
|
||||||
if(matches = prevline.match(/^(\d+)\./)) {
|
|
||||||
prefix = Number(matches[1])+1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i=pos.line; i<(posend.line+1);i++) {
|
|
||||||
cm.replaceRange(prefix+'. '+cm.getLine(i), { line: i, ch: 0 }, { line: i, ch: cm.getLine(i).length });
|
|
||||||
prefix++;
|
|
||||||
}
|
|
||||||
|
|
||||||
cm.setCursor({ line: posend.line, ch: cm.getLine(posend.line).length });
|
|
||||||
cm.focus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.on('renderLate', function() {
|
|
||||||
if (editor.editor.options.mode == 'gfm') {
|
|
||||||
editor.currentvalue = parser(editor.currentvalue);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.on('cursorMode', function(e, param) {
|
|
||||||
if (editor.editor.options.mode == 'gfm') {
|
|
||||||
var pos = editor.editor.getDoc().getCursor();
|
|
||||||
if (!editor.editor.getTokenAt(pos).state.base.htmlState) {
|
|
||||||
param.mode = 'markdown';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$.extend(editor, {
|
|
||||||
|
|
||||||
enableMarkdown: function() {
|
|
||||||
enableMarkdown()
|
|
||||||
this.render();
|
|
||||||
},
|
|
||||||
disableMarkdown: function() {
|
|
||||||
this.editor.setOption('mode', 'htmlmixed');
|
|
||||||
this.htmleditor.find('.uk-htmleditor-button-code a').html(this.options.lblCodeview);
|
|
||||||
this.render();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// switch markdown mode on event
|
|
||||||
editor.on({
|
|
||||||
enableMarkdown : function() { editor.enableMarkdown(); },
|
|
||||||
disableMarkdown : function() { editor.disableMarkdown(); }
|
|
||||||
});
|
|
||||||
|
|
||||||
function enableMarkdown() {
|
|
||||||
editor.editor.setOption('mode', 'gfm');
|
|
||||||
editor.htmleditor.find('.uk-htmleditor-button-code a').html(editor.options.lblMarkedview);
|
|
||||||
}
|
|
||||||
|
|
||||||
function addAction(name, replace, mode) {
|
|
||||||
editor.on('action.'+name, function() {
|
|
||||||
if (editor.getCursorMode() == 'markdown') {
|
|
||||||
editor[mode == 'replaceLine' ? 'replaceLine' : 'replaceSelection'](replace);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// init code
|
|
||||||
$(function() {
|
|
||||||
$('textarea[data-uk-htmleditor]').each(function() {
|
|
||||||
var editor = $(this), obj;
|
|
||||||
|
|
||||||
if (!editor.data('htmleditor')) {
|
|
||||||
obj = UI.htmleditor(editor, UI.Utils.options(editor.attr('data-uk-htmleditor')));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return UI.htmleditor;
|
|
||||||
});
|
|
3
web/js/addons/htmleditor.min.js
vendored
3
web/js/addons/htmleditor.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,575 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Based on Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/
|
|
||||||
*/
|
|
||||||
(function(addon) {
|
|
||||||
|
|
||||||
var component;
|
|
||||||
|
|
||||||
if (jQuery && jQuery.UIkit) {
|
|
||||||
component = addon(jQuery, jQuery.UIkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof define == "function" && define.amd) {
|
|
||||||
define("uikit-nestable", ["uikit"], function(){
|
|
||||||
return component || addon(jQuery, jQuery.UIkit);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
})(function($, UI) {
|
|
||||||
|
|
||||||
var hasTouch = 'ontouchstart' in window,
|
|
||||||
html = $("html"),
|
|
||||||
touchedlists = [],
|
|
||||||
$win = UI.$win;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Detect CSS pointer-events property
|
|
||||||
* events are normally disabled on the dragging element to avoid conflicts
|
|
||||||
* https://github.com/ausi/Feature-detection-technique-for-pointer-events/blob/master/modernizr-pointerevents.js
|
|
||||||
*/
|
|
||||||
var hasPointerEvents = (function() {
|
|
||||||
|
|
||||||
var el = document.createElement('div'), docEl = document.documentElement;
|
|
||||||
|
|
||||||
if (!('pointerEvents' in el.style)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
el.style.pointerEvents = 'auto';
|
|
||||||
el.style.pointerEvents = 'x';
|
|
||||||
|
|
||||||
docEl.appendChild(el);
|
|
||||||
|
|
||||||
var supports = window.getComputedStyle && window.getComputedStyle(el, '').pointerEvents === 'auto';
|
|
||||||
|
|
||||||
docEl.removeChild(el);
|
|
||||||
|
|
||||||
return !!supports;
|
|
||||||
})();
|
|
||||||
|
|
||||||
var eStart = hasTouch ? 'touchstart' : 'mousedown',
|
|
||||||
eMove = hasTouch ? 'touchmove' : 'mousemove',
|
|
||||||
eEnd = hasTouch ? 'touchend' : 'mouseup',
|
|
||||||
eCancel = hasTouch ? 'touchcancel' : 'mouseup';
|
|
||||||
|
|
||||||
|
|
||||||
UI.component('nestable', {
|
|
||||||
|
|
||||||
defaults: {
|
|
||||||
prefix : 'uk',
|
|
||||||
listNodeName : 'ul',
|
|
||||||
itemNodeName : 'li',
|
|
||||||
listBaseClass : '{prefix}-nestable',
|
|
||||||
listClass : '{prefix}-nestable-list',
|
|
||||||
listitemClass : '{prefix}-nestable-list-item',
|
|
||||||
itemClass : '{prefix}-nestable-item',
|
|
||||||
dragClass : '{prefix}-nestable-list-dragged',
|
|
||||||
movingClass : '{prefix}-nestable-moving',
|
|
||||||
handleClass : '{prefix}-nestable-handle',
|
|
||||||
collapsedClass : '{prefix}-collapsed',
|
|
||||||
placeClass : '{prefix}-nestable-placeholder',
|
|
||||||
noDragClass : '{prefix}-nestable-nodrag',
|
|
||||||
emptyClass : '{prefix}-nestable-empty',
|
|
||||||
group : 0,
|
|
||||||
maxDepth : 10,
|
|
||||||
threshold : 20
|
|
||||||
},
|
|
||||||
|
|
||||||
init: function()
|
|
||||||
{
|
|
||||||
var $this = this;
|
|
||||||
|
|
||||||
Object.keys(this.options).forEach(function(key){
|
|
||||||
|
|
||||||
if(String($this.options[key]).indexOf('{prefix}')!=-1) {
|
|
||||||
$this.options[key] = $this.options[key].replace('{prefix}', $this.options.prefix);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.tplempty = '<div class="' + this.options.emptyClass + '"/>';
|
|
||||||
|
|
||||||
this.find(">"+this.options.itemNodeName).addClass(this.options.listitemClass)
|
|
||||||
.end()
|
|
||||||
.find("ul:not(.ignore-list)").addClass(this.options.listClass)
|
|
||||||
.find(">li").addClass(this.options.listitemClass);
|
|
||||||
|
|
||||||
if (!this.element.children(this.options.itemNodeName).length) {
|
|
||||||
this.element.append(this.tplempty);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.element.data("nestable-id", "ID"+(new Date().getTime())+"RAND"+(Math.ceil(Math.random() *100000)));
|
|
||||||
this.reset();
|
|
||||||
this.element.data('nestable-group', this.options.group);
|
|
||||||
this.placeEl = $('<div class="' + this.options.placeClass + '"/>');
|
|
||||||
|
|
||||||
this.find(this.options.itemNodeName).each(function() {
|
|
||||||
$this.setParent($(this));
|
|
||||||
});
|
|
||||||
|
|
||||||
this.on('click', '[data-nestable-action]', function(e) {
|
|
||||||
|
|
||||||
if ($this.dragEl || (!hasTouch && e.button !== 0)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var target = $(e.currentTarget),
|
|
||||||
action = target.data('nestableAction'),
|
|
||||||
item = target.closest($this.options.itemNodeName);
|
|
||||||
if (action === 'collapse') {
|
|
||||||
$this.collapseItem(item);
|
|
||||||
}
|
|
||||||
if (action === 'expand') {
|
|
||||||
$this.expandItem(item);
|
|
||||||
}
|
|
||||||
if (action === 'toggle') {
|
|
||||||
$this.toggleItem(item);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var onStartEvent = function(e) {
|
|
||||||
|
|
||||||
var handle = $(e.target);
|
|
||||||
|
|
||||||
if (!handle.hasClass($this.options.handleClass)) {
|
|
||||||
if (handle.closest('.' + $this.options.noDragClass).length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
handle = handle.closest('.' + $this.options.handleClass);
|
|
||||||
}
|
|
||||||
if (!handle.length || $this.dragEl || (!hasTouch && e.button !== 0) || (hasTouch && e.touches.length !== 1)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
e.preventDefault();
|
|
||||||
$this.dragStart(hasTouch ? e.touches[0] : e);
|
|
||||||
$this.trigger('nestable-start', [$this]);
|
|
||||||
};
|
|
||||||
|
|
||||||
var onMoveEvent = function(e) {
|
|
||||||
if ($this.dragEl) {
|
|
||||||
e.preventDefault();
|
|
||||||
$this.dragMove(hasTouch ? e.touches[0] : e);
|
|
||||||
$this.trigger('nestable-move', [$this]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var onEndEvent = function(e) {
|
|
||||||
if ($this.dragEl) {
|
|
||||||
e.preventDefault();
|
|
||||||
$this.dragStop(hasTouch ? e.touches[0] : e);
|
|
||||||
$this.trigger('nestable-stop', [$this]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (hasTouch) {
|
|
||||||
this.element[0].addEventListener(eStart, onStartEvent, false);
|
|
||||||
window.addEventListener(eMove, onMoveEvent, false);
|
|
||||||
window.addEventListener(eEnd, onEndEvent, false);
|
|
||||||
window.addEventListener(eCancel, onEndEvent, false);
|
|
||||||
} else {
|
|
||||||
this.on(eStart, onStartEvent);
|
|
||||||
$win.on(eMove, onMoveEvent);
|
|
||||||
$win.on(eEnd, onEndEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
serialize: function() {
|
|
||||||
|
|
||||||
var data,
|
|
||||||
depth = 0,
|
|
||||||
list = this;
|
|
||||||
step = function(level, depth) {
|
|
||||||
|
|
||||||
var array = [ ], items = level.children(list.options.itemNodeName);
|
|
||||||
|
|
||||||
items.each(function() {
|
|
||||||
|
|
||||||
var li = $(this),
|
|
||||||
item = $.extend({}, li.data()),
|
|
||||||
sub = li.children(list.options.listNodeName);
|
|
||||||
|
|
||||||
if (sub.length) {
|
|
||||||
item.children = step(sub, depth + 1);
|
|
||||||
}
|
|
||||||
array.push(item);
|
|
||||||
});
|
|
||||||
return array;
|
|
||||||
};
|
|
||||||
|
|
||||||
data = step(list.element, depth);
|
|
||||||
|
|
||||||
return data;
|
|
||||||
},
|
|
||||||
|
|
||||||
list: function(options) {
|
|
||||||
|
|
||||||
var data = [],
|
|
||||||
list = this,
|
|
||||||
depth = 0,
|
|
||||||
options = $.extend({}, list.options, options),
|
|
||||||
step = function(level, depth, parent) {
|
|
||||||
|
|
||||||
var items = level.children(options.itemNodeName);
|
|
||||||
|
|
||||||
items.each(function(index) {
|
|
||||||
var li = $(this),
|
|
||||||
item = $.extend({parent_id: (parent ? parent : null), depth: depth, order: index}, li.data()),
|
|
||||||
sub = li.children(options.listNodeName);
|
|
||||||
|
|
||||||
data.push(item);
|
|
||||||
|
|
||||||
if (sub.length) {
|
|
||||||
step(sub, depth + 1, li.data(options.idProperty || 'id'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
step(list.element, depth);
|
|
||||||
|
|
||||||
return data;
|
|
||||||
},
|
|
||||||
|
|
||||||
reset: function() {
|
|
||||||
|
|
||||||
this.mouse = {
|
|
||||||
offsetX : 0,
|
|
||||||
offsetY : 0,
|
|
||||||
startX : 0,
|
|
||||||
startY : 0,
|
|
||||||
lastX : 0,
|
|
||||||
lastY : 0,
|
|
||||||
nowX : 0,
|
|
||||||
nowY : 0,
|
|
||||||
distX : 0,
|
|
||||||
distY : 0,
|
|
||||||
dirAx : 0,
|
|
||||||
dirX : 0,
|
|
||||||
dirY : 0,
|
|
||||||
lastDirX : 0,
|
|
||||||
lastDirY : 0,
|
|
||||||
distAxX : 0,
|
|
||||||
distAxY : 0
|
|
||||||
};
|
|
||||||
this.moving = false;
|
|
||||||
this.dragEl = null;
|
|
||||||
this.dragRootEl = null;
|
|
||||||
this.dragDepth = 0;
|
|
||||||
this.hasNewRoot = false;
|
|
||||||
this.pointEl = null;
|
|
||||||
|
|
||||||
for (var i=0; i<touchedlists.length; i++) {
|
|
||||||
if (!touchedlists[i].children().length) {
|
|
||||||
touchedlists[i].append(this.tplempty);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
touchedlists = [];
|
|
||||||
},
|
|
||||||
|
|
||||||
toggleItem: function(li) {
|
|
||||||
this[li.hasClass(this.options.collapsedClass) ? "expandItem":"collapseItem"](li);
|
|
||||||
},
|
|
||||||
|
|
||||||
expandItem: function(li) {
|
|
||||||
li.removeClass(this.options.collapsedClass);
|
|
||||||
},
|
|
||||||
|
|
||||||
collapseItem: function(li) {
|
|
||||||
var lists = li.children(this.options.listNodeName);
|
|
||||||
if (lists.length) {
|
|
||||||
li.addClass(this.options.collapsedClass);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
expandAll: function() {
|
|
||||||
var list = this;
|
|
||||||
this.find(list.options.itemNodeName).each(function() {
|
|
||||||
list.expandItem($(this));
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
collapseAll: function() {
|
|
||||||
var list = this;
|
|
||||||
this.find(list.options.itemNodeName).each(function() {
|
|
||||||
list.collapseItem($(this));
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
setParent: function(li) {
|
|
||||||
if (li.children(this.options.listNodeName).length) {
|
|
||||||
li.addClass("uk-parent");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
unsetParent: function(li) {
|
|
||||||
li.removeClass('uk-parent '+this.options.collapsedClass);
|
|
||||||
li.children(this.options.listNodeName).remove();
|
|
||||||
},
|
|
||||||
|
|
||||||
dragStart: function(e) {
|
|
||||||
var mouse = this.mouse,
|
|
||||||
target = $(e.target),
|
|
||||||
dragItem = target.closest(this.options.itemNodeName),
|
|
||||||
offset = dragItem.offset();
|
|
||||||
|
|
||||||
this.placeEl.css('height', dragItem.height());
|
|
||||||
|
|
||||||
mouse.offsetX = e.pageX - offset.left;
|
|
||||||
mouse.offsetY = e.pageY - offset.top;
|
|
||||||
|
|
||||||
mouse.startX = mouse.lastX = offset.left;
|
|
||||||
mouse.startY = mouse.lastY = offset.top;
|
|
||||||
|
|
||||||
this.dragRootEl = this.element;
|
|
||||||
|
|
||||||
this.dragEl = $(document.createElement(this.options.listNodeName)).addClass(this.options.listClass + ' ' + this.options.dragClass);
|
|
||||||
this.dragEl.css('width', dragItem.width());
|
|
||||||
|
|
||||||
this.tmpDragOnSiblings = [dragItem[0].previousSibling, dragItem[0].nextSibling];
|
|
||||||
|
|
||||||
// fix for zepto.js
|
|
||||||
//dragItem.after(this.placeEl).detach().appendTo(this.dragEl);
|
|
||||||
dragItem.after(this.placeEl);
|
|
||||||
dragItem[0].parentNode.removeChild(dragItem[0]);
|
|
||||||
dragItem.appendTo(this.dragEl);
|
|
||||||
|
|
||||||
$(document.body).append(this.dragEl);
|
|
||||||
|
|
||||||
this.dragEl.css({
|
|
||||||
left : offset.left,
|
|
||||||
top : offset.top
|
|
||||||
});
|
|
||||||
|
|
||||||
// total depth of dragging item
|
|
||||||
var i, depth,
|
|
||||||
items = this.dragEl.find(this.options.itemNodeName);
|
|
||||||
for (i = 0; i < items.length; i++) {
|
|
||||||
depth = $(items[i]).parents(this.options.listNodeName).length;
|
|
||||||
if (depth > this.dragDepth) {
|
|
||||||
this.dragDepth = depth;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
html.addClass(this.options.movingClass);
|
|
||||||
},
|
|
||||||
|
|
||||||
dragStop: function(e) {
|
|
||||||
// fix for zepto.js
|
|
||||||
//this.placeEl.replaceWith(this.dragEl.children(this.options.itemNodeName + ':first').detach());
|
|
||||||
var el = this.dragEl.children(this.options.itemNodeName).first();
|
|
||||||
el[0].parentNode.removeChild(el[0]);
|
|
||||||
this.placeEl.replaceWith(el);
|
|
||||||
|
|
||||||
this.dragEl.remove();
|
|
||||||
|
|
||||||
if (this.tmpDragOnSiblings[0]!=el[0].previousSibling || this.tmpDragOnSiblings[0]!=el[0].previousSibling) {
|
|
||||||
|
|
||||||
this.element.trigger('nestable-change',[el, this.hasNewRoot ? "added":"moved"]);
|
|
||||||
|
|
||||||
if (this.hasNewRoot) {
|
|
||||||
this.dragRootEl.trigger('nestable-change', [el, "removed"]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.reset();
|
|
||||||
|
|
||||||
html.removeClass(this.options.movingClass);
|
|
||||||
},
|
|
||||||
|
|
||||||
dragMove: function(e) {
|
|
||||||
var list, parent, prev, next, depth,
|
|
||||||
opt = this.options,
|
|
||||||
mouse = this.mouse;
|
|
||||||
|
|
||||||
this.dragEl.css({
|
|
||||||
left : e.pageX - mouse.offsetX,
|
|
||||||
top : e.pageY - mouse.offsetY
|
|
||||||
});
|
|
||||||
|
|
||||||
// mouse position last events
|
|
||||||
mouse.lastX = mouse.nowX;
|
|
||||||
mouse.lastY = mouse.nowY;
|
|
||||||
// mouse position this events
|
|
||||||
mouse.nowX = e.pageX;
|
|
||||||
mouse.nowY = e.pageY;
|
|
||||||
// distance mouse moved between events
|
|
||||||
mouse.distX = mouse.nowX - mouse.lastX;
|
|
||||||
mouse.distY = mouse.nowY - mouse.lastY;
|
|
||||||
// direction mouse was moving
|
|
||||||
mouse.lastDirX = mouse.dirX;
|
|
||||||
mouse.lastDirY = mouse.dirY;
|
|
||||||
// direction mouse is now moving (on both axis)
|
|
||||||
mouse.dirX = mouse.distX === 0 ? 0 : mouse.distX > 0 ? 1 : -1;
|
|
||||||
mouse.dirY = mouse.distY === 0 ? 0 : mouse.distY > 0 ? 1 : -1;
|
|
||||||
// axis mouse is now moving on
|
|
||||||
var newAx = Math.abs(mouse.distX) > Math.abs(mouse.distY) ? 1 : 0;
|
|
||||||
|
|
||||||
// do nothing on first move
|
|
||||||
if (!mouse.moving) {
|
|
||||||
mouse.dirAx = newAx;
|
|
||||||
mouse.moving = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// calc distance moved on this axis (and direction)
|
|
||||||
if (mouse.dirAx !== newAx) {
|
|
||||||
mouse.distAxX = 0;
|
|
||||||
mouse.distAxY = 0;
|
|
||||||
} else {
|
|
||||||
mouse.distAxX += Math.abs(mouse.distX);
|
|
||||||
if (mouse.dirX !== 0 && mouse.dirX !== mouse.lastDirX) {
|
|
||||||
mouse.distAxX = 0;
|
|
||||||
}
|
|
||||||
mouse.distAxY += Math.abs(mouse.distY);
|
|
||||||
if (mouse.dirY !== 0 && mouse.dirY !== mouse.lastDirY) {
|
|
||||||
mouse.distAxY = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mouse.dirAx = newAx;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* move horizontal
|
|
||||||
*/
|
|
||||||
if (mouse.dirAx && mouse.distAxX >= opt.threshold) {
|
|
||||||
// reset move distance on x-axis for new phase
|
|
||||||
mouse.distAxX = 0;
|
|
||||||
prev = this.placeEl.prev(opt.itemNodeName);
|
|
||||||
// increase horizontal level if previous sibling exists and is not collapsed
|
|
||||||
if (mouse.distX > 0 && prev.length && !prev.hasClass(opt.collapsedClass)) {
|
|
||||||
// cannot increase level when item above is collapsed
|
|
||||||
list = prev.find(opt.listNodeName).last();
|
|
||||||
// check if depth limit has reached
|
|
||||||
depth = this.placeEl.parents(opt.listNodeName).length;
|
|
||||||
if (depth + this.dragDepth <= opt.maxDepth) {
|
|
||||||
// create new sub-level if one doesn't exist
|
|
||||||
if (!list.length) {
|
|
||||||
list = $('<' + opt.listNodeName + '/>').addClass(opt.listClass);
|
|
||||||
list.append(this.placeEl);
|
|
||||||
prev.append(list);
|
|
||||||
this.setParent(prev);
|
|
||||||
} else {
|
|
||||||
// else append to next level up
|
|
||||||
list = prev.children(opt.listNodeName).last();
|
|
||||||
list.append(this.placeEl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// decrease horizontal level
|
|
||||||
if (mouse.distX < 0) {
|
|
||||||
// we can't decrease a level if an item preceeds the current one
|
|
||||||
next = this.placeEl.next(opt.itemNodeName);
|
|
||||||
if (!next.length) {
|
|
||||||
parent = this.placeEl.parent();
|
|
||||||
this.placeEl.closest(opt.itemNodeName).after(this.placeEl);
|
|
||||||
if (!parent.children().length) {
|
|
||||||
this.unsetParent(parent.parent());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var isEmpty = false;
|
|
||||||
|
|
||||||
// find list item under cursor
|
|
||||||
if (!hasPointerEvents) {
|
|
||||||
this.dragEl[0].style.visibility = 'hidden';
|
|
||||||
}
|
|
||||||
this.pointEl = $(document.elementFromPoint(e.pageX - document.body.scrollLeft, e.pageY - (window.pageYOffset || document.documentElement.scrollTop)));
|
|
||||||
if (!hasPointerEvents) {
|
|
||||||
this.dragEl[0].style.visibility = 'visible';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.pointEl.hasClass(opt.handleClass)) {
|
|
||||||
this.pointEl = this.pointEl.closest(opt.itemNodeName);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
var nestableitem = this.pointEl.closest('.'+opt.itemClass);
|
|
||||||
|
|
||||||
if(nestableitem.length) {
|
|
||||||
this.pointEl = nestableitem.closest(opt.itemNodeName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.pointEl.hasClass(opt.emptyClass)) {
|
|
||||||
isEmpty = true;
|
|
||||||
} else if (this.pointEl.data('nestable') && !this.pointEl.children().length) {
|
|
||||||
isEmpty = true;
|
|
||||||
this.pointEl = $(this.tplempty).appendTo(this.pointEl);
|
|
||||||
} else if (!this.pointEl.length || !this.pointEl.hasClass(opt.listitemClass)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// find parent list of item under cursor
|
|
||||||
var pointElRoot = this.element,
|
|
||||||
tmpRoot = this.pointEl.closest('.'+this.options.listBaseClass),
|
|
||||||
isNewRoot = pointElRoot[0] !== this.pointEl.closest('.'+this.options.listBaseClass)[0],
|
|
||||||
$newRoot = tmpRoot;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* move vertical
|
|
||||||
*/
|
|
||||||
if (!mouse.dirAx || isNewRoot || isEmpty) {
|
|
||||||
// check if groups match if dragging over new root
|
|
||||||
if (isNewRoot && opt.group !== $newRoot.data('nestable-group')) {
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
touchedlists.push(pointElRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
// check depth limit
|
|
||||||
depth = this.dragDepth - 1 + this.pointEl.parents(opt.listNodeName).length;
|
|
||||||
|
|
||||||
if (depth > opt.maxDepth) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var before = e.pageY < (this.pointEl.offset().top + this.pointEl.height() / 2);
|
|
||||||
|
|
||||||
parent = this.placeEl.parent();
|
|
||||||
|
|
||||||
// if empty create new list to replace empty placeholder
|
|
||||||
if (isEmpty) {
|
|
||||||
this.pointEl.replaceWith(this.placeEl);
|
|
||||||
} else if (before) {
|
|
||||||
this.pointEl.before(this.placeEl);
|
|
||||||
} else {
|
|
||||||
this.pointEl.after(this.placeEl);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!parent.children().length) {
|
|
||||||
if(!parent.data("nestable")) this.unsetParent(parent.parent());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.dragRootEl.find(opt.itemNodeName).length && !this.dragRootEl.children().length) {
|
|
||||||
this.dragRootEl.append(this.tplempty);
|
|
||||||
}
|
|
||||||
|
|
||||||
// parent root list has changed
|
|
||||||
if (isNewRoot) {
|
|
||||||
this.dragRootEl = tmpRoot;
|
|
||||||
this.hasNewRoot = this.element[0] !== this.dragRootEl[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// init code
|
|
||||||
UI.ready(function(context) {
|
|
||||||
|
|
||||||
$("[data-uk-nestable]", context).each(function(){
|
|
||||||
|
|
||||||
var ele = $(this);
|
|
||||||
|
|
||||||
if(!ele.data("nestable")) {
|
|
||||||
var plugin = UI.nestable(ele, UI.Utils.options(ele.attr("data-uk-nestable")));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return UI.nestable;
|
|
||||||
});
|
|
3
web/js/addons/nestable.min.js
vendored
3
web/js/addons/nestable.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,180 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
(function(addon) {
|
|
||||||
|
|
||||||
var component;
|
|
||||||
|
|
||||||
if (jQuery && jQuery.UIkit) {
|
|
||||||
component = addon(jQuery, jQuery.UIkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof define == "function" && define.amd) {
|
|
||||||
define("uikit-notify", ["uikit"], function(){
|
|
||||||
return component || addon(jQuery, jQuery.UIkit);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
})(function($, UI){
|
|
||||||
|
|
||||||
var containers = {},
|
|
||||||
messages = {},
|
|
||||||
|
|
||||||
notify = function(options){
|
|
||||||
|
|
||||||
if ($.type(options) == 'string') {
|
|
||||||
options = { message: options };
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arguments[1]) {
|
|
||||||
options = $.extend(options, $.type(arguments[1]) == 'string' ? {status:arguments[1]} : arguments[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (new Message(options)).show();
|
|
||||||
},
|
|
||||||
closeAll = function(group, instantly){
|
|
||||||
if(group) {
|
|
||||||
for(var id in messages) { if(group===messages[id].group) messages[id].close(instantly); }
|
|
||||||
} else {
|
|
||||||
for(var id in messages) { messages[id].close(instantly); }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var Message = function(options){
|
|
||||||
|
|
||||||
var $this = this;
|
|
||||||
|
|
||||||
this.options = $.extend({}, Message.defaults, options);
|
|
||||||
|
|
||||||
this.uuid = "ID"+(new Date().getTime())+"RAND"+(Math.ceil(Math.random() * 100000));
|
|
||||||
this.element = $([
|
|
||||||
|
|
||||||
'<div class="uk-notify-message">',
|
|
||||||
'<a class="uk-close"></a>',
|
|
||||||
'<div>'+this.options.message+'</div>',
|
|
||||||
'</div>'
|
|
||||||
|
|
||||||
].join('')).data("notifyMessage", this);
|
|
||||||
|
|
||||||
// status
|
|
||||||
if (this.options.status) {
|
|
||||||
this.element.addClass('uk-notify-message-'+this.options.status);
|
|
||||||
this.currentstatus = this.options.status;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.group = this.options.group;
|
|
||||||
|
|
||||||
messages[this.uuid] = this;
|
|
||||||
|
|
||||||
if(!containers[this.options.pos]) {
|
|
||||||
containers[this.options.pos] = $('<div class="uk-notify uk-notify-'+this.options.pos+'"></div>').appendTo('body').on("click", ".uk-notify-message", function(){
|
|
||||||
$(this).data("notifyMessage").close();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
$.extend(Message.prototype, {
|
|
||||||
|
|
||||||
uuid: false,
|
|
||||||
element: false,
|
|
||||||
timout: false,
|
|
||||||
currentstatus: "",
|
|
||||||
group: false,
|
|
||||||
|
|
||||||
show: function() {
|
|
||||||
|
|
||||||
if (this.element.is(":visible")) return;
|
|
||||||
|
|
||||||
var $this = this;
|
|
||||||
|
|
||||||
containers[this.options.pos].show().prepend(this.element);
|
|
||||||
|
|
||||||
var marginbottom = parseInt(this.element.css("margin-bottom"), 10);
|
|
||||||
|
|
||||||
this.element.css({"opacity":0, "margin-top": -1*this.element.outerHeight(), "margin-bottom":0}).animate({"opacity":1, "margin-top": 0, "margin-bottom":marginbottom}, function(){
|
|
||||||
|
|
||||||
if ($this.options.timeout) {
|
|
||||||
|
|
||||||
var closefn = function(){ $this.close(); };
|
|
||||||
|
|
||||||
$this.timeout = setTimeout(closefn, $this.options.timeout);
|
|
||||||
|
|
||||||
$this.element.hover(
|
|
||||||
function() { clearTimeout($this.timeout); },
|
|
||||||
function() { $this.timeout = setTimeout(closefn, $this.options.timeout); }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
close: function(instantly) {
|
|
||||||
|
|
||||||
var $this = this,
|
|
||||||
finalize = function(){
|
|
||||||
$this.element.remove();
|
|
||||||
|
|
||||||
if(!containers[$this.options.pos].children().length) {
|
|
||||||
containers[$this.options.pos].hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this.options.onClose.apply($this, []);
|
|
||||||
|
|
||||||
delete messages[$this.uuid];
|
|
||||||
};
|
|
||||||
|
|
||||||
if(this.timeout) clearTimeout(this.timeout);
|
|
||||||
|
|
||||||
if(instantly) {
|
|
||||||
finalize();
|
|
||||||
} else {
|
|
||||||
this.element.animate({"opacity":0, "margin-top": -1* this.element.outerHeight(), "margin-bottom":0}, function(){
|
|
||||||
finalize();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
content: function(html){
|
|
||||||
|
|
||||||
var container = this.element.find(">div");
|
|
||||||
|
|
||||||
if(!html) {
|
|
||||||
return container.html();
|
|
||||||
}
|
|
||||||
|
|
||||||
container.html(html);
|
|
||||||
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
status: function(status) {
|
|
||||||
|
|
||||||
if(!status) {
|
|
||||||
return this.currentstatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.element.removeClass('uk-notify-message-'+this.currentstatus).addClass('uk-notify-message-'+status);
|
|
||||||
|
|
||||||
this.currentstatus = status;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Message.defaults = {
|
|
||||||
message: "",
|
|
||||||
status: "",
|
|
||||||
timeout: 5000,
|
|
||||||
group: null,
|
|
||||||
pos: 'top-center',
|
|
||||||
onClose: function() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
UI.notify = notify;
|
|
||||||
UI.notify.message = Message;
|
|
||||||
UI.notify.closeAll = closeAll;
|
|
||||||
|
|
||||||
return notify;
|
|
||||||
});
|
|
3
web/js/addons/notify.min.js
vendored
3
web/js/addons/notify.min.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
!function(a){var b;jQuery&&jQuery.UIkit&&(b=a(jQuery,jQuery.UIkit)),"function"==typeof define&&define.amd&&define("uikit-notify",["uikit"],function(){return b||a(jQuery,jQuery.UIkit)})}(function(a,b){var c={},d={},e=function(b){return"string"==a.type(b)&&(b={message:b}),arguments[1]&&(b=a.extend(b,"string"==a.type(arguments[1])?{status:arguments[1]}:arguments[1])),new g(b).show()},f=function(a,b){if(a)for(var c in d)a===d[c].group&&d[c].close(b);else for(var c in d)d[c].close(b)},g=function(b){this.options=a.extend({},g.defaults,b),this.uuid="ID"+(new Date).getTime()+"RAND"+Math.ceil(1e5*Math.random()),this.element=a(['<div class="uk-notify-message">','<a class="uk-close"></a>',"<div>"+this.options.message+"</div>","</div>"].join("")).data("notifyMessage",this),this.options.status&&(this.element.addClass("uk-notify-message-"+this.options.status),this.currentstatus=this.options.status),this.group=this.options.group,d[this.uuid]=this,c[this.options.pos]||(c[this.options.pos]=a('<div class="uk-notify uk-notify-'+this.options.pos+'"></div>').appendTo("body").on("click",".uk-notify-message",function(){a(this).data("notifyMessage").close()}))};return a.extend(g.prototype,{uuid:!1,element:!1,timout:!1,currentstatus:"",group:!1,show:function(){if(!this.element.is(":visible")){var a=this;c[this.options.pos].show().prepend(this.element);var b=parseInt(this.element.css("margin-bottom"),10);return this.element.css({opacity:0,"margin-top":-1*this.element.outerHeight(),"margin-bottom":0}).animate({opacity:1,"margin-top":0,"margin-bottom":b},function(){if(a.options.timeout){var b=function(){a.close()};a.timeout=setTimeout(b,a.options.timeout),a.element.hover(function(){clearTimeout(a.timeout)},function(){a.timeout=setTimeout(b,a.options.timeout)})}}),this}},close:function(a){var b=this,e=function(){b.element.remove(),c[b.options.pos].children().length||c[b.options.pos].hide(),b.options.onClose.apply(b,[]),delete d[b.uuid]};this.timeout&&clearTimeout(this.timeout),a?e():this.element.animate({opacity:0,"margin-top":-1*this.element.outerHeight(),"margin-bottom":0},function(){e()})},content:function(a){var b=this.element.find(">div");return a?(b.html(a),this):b.html()},status:function(a){return a?(this.element.removeClass("uk-notify-message-"+this.currentstatus).addClass("uk-notify-message-"+a),this.currentstatus=a,this):this.currentstatus}}),g.defaults={message:"",status:"",timeout:5e3,group:null,pos:"top-center",onClose:function(){}},b.notify=e,b.notify.message=g,b.notify.closeAll=f,e});
|
|
@ -1,146 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Based on simplePagination - Copyright (c) 2012 Flavius Matis - http://flaviusmatis.github.com/simplePagination.js/ (MIT)
|
|
||||||
*/
|
|
||||||
(function(addon) {
|
|
||||||
|
|
||||||
var component;
|
|
||||||
|
|
||||||
if (jQuery && jQuery.UIkit) {
|
|
||||||
component = addon(jQuery, jQuery.UIkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof define == "function" && define.amd) {
|
|
||||||
define("uikit-pagination", ["uikit"], function(){
|
|
||||||
return component || addon(jQuery, jQuery.UIkit);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
})(function($, UI){
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
UI.component('pagination', {
|
|
||||||
|
|
||||||
defaults: {
|
|
||||||
items : 1,
|
|
||||||
itemsOnPage : 1,
|
|
||||||
pages : 0,
|
|
||||||
displayedPages : 3,
|
|
||||||
edges : 3,
|
|
||||||
currentPage : 1,
|
|
||||||
lblPrev : false,
|
|
||||||
lblNext : false,
|
|
||||||
onSelectPage : function() {}
|
|
||||||
},
|
|
||||||
|
|
||||||
init: function() {
|
|
||||||
|
|
||||||
var $this = this;
|
|
||||||
|
|
||||||
this.pages = this.options.pages ? this.options.pages : Math.ceil(this.options.items / this.options.itemsOnPage) ? Math.ceil(this.options.items / this.options.itemsOnPage) : 1;
|
|
||||||
this.currentPage = this.options.currentPage - 1;
|
|
||||||
this.halfDisplayed = this.options.displayedPages / 2;
|
|
||||||
|
|
||||||
this.on("click", "a[data-page]", function(e){
|
|
||||||
e.preventDefault();
|
|
||||||
$this.selectPage($(this).data("page"));
|
|
||||||
});
|
|
||||||
|
|
||||||
this._render();
|
|
||||||
},
|
|
||||||
|
|
||||||
_getInterval: function() {
|
|
||||||
|
|
||||||
return {
|
|
||||||
start: Math.ceil(this.currentPage > this.halfDisplayed ? Math.max(Math.min(this.currentPage - this.halfDisplayed, (this.pages - this.options.displayedPages)), 0) : 0),
|
|
||||||
end : Math.ceil(this.currentPage > this.halfDisplayed ? Math.min(this.currentPage + this.halfDisplayed, this.pages) : Math.min(this.options.displayedPages, this.pages))
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function(pages) {
|
|
||||||
this.pages = pages ? pages : this.pages;
|
|
||||||
this._render();
|
|
||||||
},
|
|
||||||
|
|
||||||
selectPage: function(pageIndex, pages) {
|
|
||||||
this.currentPage = pageIndex;
|
|
||||||
this.render(pages);
|
|
||||||
|
|
||||||
this.options.onSelectPage.apply(this, [pageIndex]);
|
|
||||||
this.trigger('uk-select-page', [pageIndex, this]);
|
|
||||||
},
|
|
||||||
|
|
||||||
_render: function() {
|
|
||||||
|
|
||||||
var o = this.options, interval = this._getInterval(), i;
|
|
||||||
|
|
||||||
this.element.empty();
|
|
||||||
|
|
||||||
// Generate Prev link
|
|
||||||
if (o.lblPrev) this._append(o.currentPage - 1, {text: o.lblPrev});
|
|
||||||
|
|
||||||
// Generate start edges
|
|
||||||
if (interval.start > 0 && o.edges > 0) {
|
|
||||||
|
|
||||||
var end = Math.min(o.edges, interval.start);
|
|
||||||
|
|
||||||
for (i = 0; i < end; i++) this._append(i);
|
|
||||||
|
|
||||||
if (o.edges < interval.start && (interval.start - o.edges != 1)) {
|
|
||||||
this.element.append('<li><span>...</span></li>');
|
|
||||||
} else if (interval.start - o.edges == 1) {
|
|
||||||
this._append(o.edges);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate interval links
|
|
||||||
for (i = interval.start; i < interval.end; i++) this._append(i);
|
|
||||||
|
|
||||||
// Generate end edges
|
|
||||||
if (interval.end < this.pages && o.edges > 0) {
|
|
||||||
|
|
||||||
if (this.pages - o.edges > interval.end && (this.pages - o.edges - interval.end != 1)) {
|
|
||||||
this.element.append('<li><span>...</span></li>');
|
|
||||||
} else if (this.pages - o.edges - interval.end == 1) {
|
|
||||||
this._append(interval.end++);
|
|
||||||
}
|
|
||||||
|
|
||||||
var begin = Math.max(this.pages - o.edges, interval.end);
|
|
||||||
|
|
||||||
for (i = begin; i < this.pages; i++) this._append(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate Next link (unless option is set for at front)
|
|
||||||
if (o.lblNext) this._append(o.currentPage + 1, {text: o.lblNext});
|
|
||||||
},
|
|
||||||
|
|
||||||
_append: function(pageIndex, opts) {
|
|
||||||
|
|
||||||
var $this = this, item, link, options;
|
|
||||||
|
|
||||||
pageIndex = pageIndex < 0 ? 0 : (pageIndex < this.pages ? pageIndex : this.pages - 1);
|
|
||||||
options = $.extend({ text: pageIndex + 1 }, opts);
|
|
||||||
|
|
||||||
item = (pageIndex == this.currentPage) ? '<li class="uk-active"><span>' + (options.text) + '</span></li>'
|
|
||||||
: '<li><a href="#page-'+(pageIndex+1)+'" data-page="'+pageIndex+'">'+options.text+'</a></li>';
|
|
||||||
|
|
||||||
this.element.append(item);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// init code
|
|
||||||
UI.ready(function(context) {
|
|
||||||
|
|
||||||
$("[data-uk-pagination]", context).each(function(){
|
|
||||||
var ele = $(this);
|
|
||||||
|
|
||||||
if (!ele.data("pagination")) {
|
|
||||||
var obj = UI.pagination(ele, UI.Utils.options(ele.attr("data-uk-pagination")));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return UI.pagination;
|
|
||||||
});
|
|
3
web/js/addons/pagination.min.js
vendored
3
web/js/addons/pagination.min.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
!function(a){var b;jQuery&&jQuery.UIkit&&(b=a(jQuery,jQuery.UIkit)),"function"==typeof define&&define.amd&&define("uikit-pagination",["uikit"],function(){return b||a(jQuery,jQuery.UIkit)})}(function(a,b){"use strict";return b.component("pagination",{defaults:{items:1,itemsOnPage:1,pages:0,displayedPages:3,edges:3,currentPage:1,lblPrev:!1,lblNext:!1,onSelectPage:function(){}},init:function(){var b=this;this.pages=this.options.pages?this.options.pages:Math.ceil(this.options.items/this.options.itemsOnPage)?Math.ceil(this.options.items/this.options.itemsOnPage):1,this.currentPage=this.options.currentPage-1,this.halfDisplayed=this.options.displayedPages/2,this.on("click","a[data-page]",function(c){c.preventDefault(),b.selectPage(a(this).data("page"))}),this._render()},_getInterval:function(){return{start:Math.ceil(this.currentPage>this.halfDisplayed?Math.max(Math.min(this.currentPage-this.halfDisplayed,this.pages-this.options.displayedPages),0):0),end:Math.ceil(this.currentPage>this.halfDisplayed?Math.min(this.currentPage+this.halfDisplayed,this.pages):Math.min(this.options.displayedPages,this.pages))}},render:function(a){this.pages=a?a:this.pages,this._render()},selectPage:function(a,b){this.currentPage=a,this.render(b),this.options.onSelectPage.apply(this,[a]),this.trigger("uk-select-page",[a,this])},_render:function(){var a,b=this.options,c=this._getInterval();if(this.element.empty(),b.lblPrev&&this._append(b.currentPage-1,{text:b.lblPrev}),c.start>0&&b.edges>0){var d=Math.min(b.edges,c.start);for(a=0;d>a;a++)this._append(a);b.edges<c.start&&c.start-b.edges!=1?this.element.append("<li><span>...</span></li>"):c.start-b.edges==1&&this._append(b.edges)}for(a=c.start;a<c.end;a++)this._append(a);if(c.end<this.pages&&b.edges>0){this.pages-b.edges>c.end&&this.pages-b.edges-c.end!=1?this.element.append("<li><span>...</span></li>"):this.pages-b.edges-c.end==1&&this._append(c.end++);var e=Math.max(this.pages-b.edges,c.end);for(a=e;a<this.pages;a++)this._append(a)}b.lblNext&&this._append(b.currentPage+1,{text:b.lblNext})},_append:function(b,c){var d,e;b=0>b?0:b<this.pages?b:this.pages-1,e=a.extend({text:b+1},c),d=b==this.currentPage?'<li class="uk-active"><span>'+e.text+"</span></li>":'<li><a href="#page-'+(b+1)+'" data-page="'+b+'">'+e.text+"</a></li>",this.element.append(d)}}),b.ready(function(c){a("[data-uk-pagination]",c).each(function(){var c=a(this);if(!c.data("pagination")){b.pagination(c,b.Utils.options(c.attr("data-uk-pagination")))}})}),b.pagination});
|
|
@ -1,90 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
(function(addon) {
|
|
||||||
|
|
||||||
var component;
|
|
||||||
|
|
||||||
if (jQuery && jQuery.UIkit) {
|
|
||||||
component = addon(jQuery, jQuery.UIkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof define == "function" && define.amd) {
|
|
||||||
define("uikit-search", ["uikit"], function(){
|
|
||||||
return component || addon(jQuery, jQuery.UIkit);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
})(function($, UI){
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
UI.component('search', {
|
|
||||||
defaults: {
|
|
||||||
msgResultsHeader : 'Search Results',
|
|
||||||
msgMoreResults : 'More Results',
|
|
||||||
msgNoResults : 'No results found',
|
|
||||||
template : '<ul class="uk-nav uk-nav-search uk-autocomplete-results">\
|
|
||||||
{{#msgResultsHeader}}<li class="uk-nav-header uk-skip">{{msgResultsHeader}}</li>{{/msgResultsHeader}}\
|
|
||||||
{{#items && items.length}}\
|
|
||||||
{{~items}}\
|
|
||||||
<li data-url="{{!$item.url}}">\
|
|
||||||
<a href="{{!$item.url}}">\
|
|
||||||
{{{$item.title}}}\
|
|
||||||
{{#$item.text}}<div>{{{$item.text}}}</div>{{/$item.text}}\
|
|
||||||
</a>\
|
|
||||||
</li>\
|
|
||||||
{{/items}}\
|
|
||||||
{{#msgMoreResults}}\
|
|
||||||
<li class="uk-nav-divider uk-skip"></li>\
|
|
||||||
<li class="uk-search-moreresults" data-moreresults="true"><a href="#" onclick="jQuery(this).closest(\'form\').submit();">{{msgMoreResults}}</a></li>\
|
|
||||||
{{/msgMoreResults}}\
|
|
||||||
{{/end}}\
|
|
||||||
{{^items.length}}\
|
|
||||||
{{#msgNoResults}}<li class="uk-skip"><a>{{msgNoResults}}</a></li>{{/msgNoResults}}\
|
|
||||||
{{/end}}\
|
|
||||||
</ul>',
|
|
||||||
|
|
||||||
renderer: function(data) {
|
|
||||||
|
|
||||||
var $this = this, opts = this.options;
|
|
||||||
|
|
||||||
this.dropdown.append(this.template({"items":data.results || [], "msgResultsHeader":opts.msgResultsHeader, "msgMoreResults": opts.msgMoreResults, "msgNoResults": opts.msgNoResults}));
|
|
||||||
this.show();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
init: function() {
|
|
||||||
var $this = this;
|
|
||||||
|
|
||||||
this.autocomplete = UI.autocomplete(this.element, this.options);
|
|
||||||
|
|
||||||
this.autocomplete.dropdown.addClass('uk-dropdown-search');
|
|
||||||
|
|
||||||
this.autocomplete.input.on("keyup", function(){
|
|
||||||
$this.element[$this.autocomplete.input.val() ? "addClass":"removeClass"]("uk-active");
|
|
||||||
}).closest("form").on("reset", function(){
|
|
||||||
$this.value="";
|
|
||||||
$this.element.removeClass("uk-active");
|
|
||||||
});
|
|
||||||
|
|
||||||
this.on('autocomplete-select', function(e, data) {
|
|
||||||
if (data.url) {
|
|
||||||
location.href = data.url;
|
|
||||||
} else if(data.moreresults) {
|
|
||||||
this.autocomplete.input.closest('form').submit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.element.data("search", this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// init code
|
|
||||||
UI.$doc.on("focus.search.uikit", "[data-uk-search]", function(e) {
|
|
||||||
var ele = $(this);
|
|
||||||
|
|
||||||
if (!ele.data("search")) {
|
|
||||||
var obj = UI.search(ele, UI.Utils.options(ele.attr("data-uk-search")));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
3
web/js/addons/search.min.js
vendored
3
web/js/addons/search.min.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
!function(a){var b;jQuery&&jQuery.UIkit&&(b=a(jQuery,jQuery.UIkit)),"function"==typeof define&&define.amd&&define("uikit-search",["uikit"],function(){return b||a(jQuery,jQuery.UIkit)})}(function(a,b){"use strict";b.component("search",{defaults:{msgResultsHeader:"Search Results",msgMoreResults:"More Results",msgNoResults:"No results found",template:'<ul class="uk-nav uk-nav-search uk-autocomplete-results"> {{#msgResultsHeader}}<li class="uk-nav-header uk-skip">{{msgResultsHeader}}</li>{{/msgResultsHeader}} {{#items && items.length}} {{~items}} <li data-url="{{!$item.url}}"> <a href="{{!$item.url}}"> {{{$item.title}}} {{#$item.text}}<div>{{{$item.text}}}</div>{{/$item.text}} </a> </li> {{/items}} {{#msgMoreResults}} <li class="uk-nav-divider uk-skip"></li> <li class="uk-search-moreresults" data-moreresults="true"><a href="#" onclick="jQuery(this).closest(\'form\').submit();">{{msgMoreResults}}</a></li> {{/msgMoreResults}} {{/end}} {{^items.length}} {{#msgNoResults}}<li class="uk-skip"><a>{{msgNoResults}}</a></li>{{/msgNoResults}} {{/end}} </ul>',renderer:function(a){var b=this.options;this.dropdown.append(this.template({items:a.results||[],msgResultsHeader:b.msgResultsHeader,msgMoreResults:b.msgMoreResults,msgNoResults:b.msgNoResults})),this.show()}},init:function(){var a=this;this.autocomplete=b.autocomplete(this.element,this.options),this.autocomplete.dropdown.addClass("uk-dropdown-search"),this.autocomplete.input.on("keyup",function(){a.element[a.autocomplete.input.val()?"addClass":"removeClass"]("uk-active")}).closest("form").on("reset",function(){a.value="",a.element.removeClass("uk-active")}),this.on("autocomplete-select",function(a,b){b.url?location.href=b.url:b.moreresults&&this.autocomplete.input.closest("form").submit()}),this.element.data("search",this)}}),b.$doc.on("focus.search.uikit","[data-uk-search]",function(){var c=a(this);if(!c.data("search")){b.search(c,b.Utils.options(c.attr("data-uk-search")))}})});
|
|
@ -1,514 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Based on nativesortable - Copyright (c) Brian Grinstead - https://github.com/bgrins/nativesortable
|
|
||||||
*/
|
|
||||||
(function(addon) {
|
|
||||||
|
|
||||||
var component;
|
|
||||||
|
|
||||||
if (jQuery && jQuery.UIkit) {
|
|
||||||
component = addon(jQuery, jQuery.UIkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof define == "function" && define.amd) {
|
|
||||||
define("uikit-sortable", ["uikit"], function(){
|
|
||||||
return component || addon(jQuery, jQuery.UIkit);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
})(function($, UI){
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var supportsTouch = ('ontouchstart' in window) || (window.DocumentTouch && document instanceof DocumentTouch),
|
|
||||||
supportsDragAndDrop = !supportsTouch && (function() {
|
|
||||||
var div = document.createElement('div');
|
|
||||||
return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div);
|
|
||||||
})(),
|
|
||||||
|
|
||||||
draggingPlaceholder, moving, dragging, clickedlink, delayIdle;
|
|
||||||
|
|
||||||
// disable native dragndrop support for now
|
|
||||||
supportsDragAndDrop = false;
|
|
||||||
|
|
||||||
UI.component('sortable', {
|
|
||||||
|
|
||||||
defaults: {
|
|
||||||
|
|
||||||
warp : false,
|
|
||||||
animation : 150,
|
|
||||||
threshold : 10,
|
|
||||||
|
|
||||||
childClass : 'uk-sortable-item',
|
|
||||||
placeholderClass : 'uk-sortable-placeholder',
|
|
||||||
overClass : 'uk-sortable-over',
|
|
||||||
draggingClass : 'uk-sortable-dragged',
|
|
||||||
dragMovingClass : 'uk-sortable-moving',
|
|
||||||
dragCustomClass : '',
|
|
||||||
handleClass : false,
|
|
||||||
|
|
||||||
stop : function() {},
|
|
||||||
start : function() {},
|
|
||||||
change : function() {}
|
|
||||||
},
|
|
||||||
|
|
||||||
init: function() {
|
|
||||||
|
|
||||||
var $this = this,
|
|
||||||
element = this.element[0],
|
|
||||||
currentlyDraggingElement = null,
|
|
||||||
currentlyDraggingTarget = null,
|
|
||||||
children;
|
|
||||||
|
|
||||||
if (supportsDragAndDrop) {
|
|
||||||
this.element.children().attr("draggable", "true");
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// prevent leaving page after link clicking
|
|
||||||
this.element.on('mousedown touchstart', 'a[href]', function(e) {
|
|
||||||
clickedlink = $(this);
|
|
||||||
}).on('click', 'a[href]', function(e) {
|
|
||||||
clickedlink = $(this);
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var handleDragStart = delegate(function(e) {
|
|
||||||
|
|
||||||
moving = false;
|
|
||||||
dragging = false;
|
|
||||||
|
|
||||||
var target = $(e.target), children = $this.element.children();
|
|
||||||
|
|
||||||
if (!supportsTouch && e.button==2) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this.options.handleClass) {
|
|
||||||
|
|
||||||
var handle = target.hasClass($this.options.handleClass) ? target : target.closest('.'+$this.options.handleClass, element);
|
|
||||||
|
|
||||||
if (!handle.length) {
|
|
||||||
//e.preventDefault();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.dataTransfer) {
|
|
||||||
e.dataTransfer.effectAllowed = 'move';
|
|
||||||
e.dataTransfer.dropEffect = 'move';
|
|
||||||
e.dataTransfer.setData('Text', "*"); // Need to set to something or else drag doesn't start
|
|
||||||
}
|
|
||||||
|
|
||||||
currentlyDraggingElement = this;
|
|
||||||
|
|
||||||
// init drag placeholder
|
|
||||||
if (draggingPlaceholder) draggingPlaceholder.remove();
|
|
||||||
|
|
||||||
var $current = $(currentlyDraggingElement), offset = $current.offset();
|
|
||||||
|
|
||||||
delayIdle = {
|
|
||||||
|
|
||||||
pos : { x:e.pageX, y:e.pageY },
|
|
||||||
threshold : $this.options.threshold,
|
|
||||||
'apply' : function() {
|
|
||||||
|
|
||||||
draggingPlaceholder = $('<div class="'+([$this.options.draggingClass, $this.options.dragCustomClass].join(' '))+'"></div>').css({
|
|
||||||
display : 'none',
|
|
||||||
top : offset.top,
|
|
||||||
left : offset.left,
|
|
||||||
width : $current.width(),
|
|
||||||
height : $current.height(),
|
|
||||||
padding : $current.css('padding')
|
|
||||||
}).data('mouse-offset', {
|
|
||||||
'left': offset.left - parseInt(e.pageX, 10),
|
|
||||||
'top' : offset.top - parseInt(e.pageY, 10)
|
|
||||||
}).append($current.html()).appendTo('body');
|
|
||||||
|
|
||||||
draggingPlaceholder.$current = $current;
|
|
||||||
draggingPlaceholder.$sortable = $this;
|
|
||||||
|
|
||||||
addFakeDragHandlers();
|
|
||||||
|
|
||||||
$this.options.start(this, currentlyDraggingElement);
|
|
||||||
$this.trigger('sortable-start', [$this, currentlyDraggingElement]);
|
|
||||||
|
|
||||||
delayIdle = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!supportsDragAndDrop) {
|
|
||||||
e.preventDefault();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var handleDragOver = delegate(function(e) {
|
|
||||||
|
|
||||||
if (!currentlyDraggingElement) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.preventDefault) {
|
|
||||||
e.preventDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
var handleDragEnter = delegate($.UIkit.Utils.debounce(function(e) {
|
|
||||||
|
|
||||||
if (!currentlyDraggingElement || currentlyDraggingElement === this) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prevent dragenter on a child from allowing a dragleave on the container
|
|
||||||
var previousCounter = $this.dragenterData(this);
|
|
||||||
|
|
||||||
$this.dragenterData(this, previousCounter + 1);
|
|
||||||
|
|
||||||
if (previousCounter === 0) {
|
|
||||||
|
|
||||||
$(this).addClass($this.options.overClass);
|
|
||||||
|
|
||||||
if (!$this.options.warp) {
|
|
||||||
$this.moveElementNextTo(currentlyDraggingElement, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}), 40);
|
|
||||||
|
|
||||||
var handleDragLeave = delegate(function(e) {
|
|
||||||
|
|
||||||
// Prevent dragenter on a child from allowing a dragleave on the container
|
|
||||||
var previousCounter = $this.dragenterData(this);
|
|
||||||
$this.dragenterData(this, previousCounter - 1);
|
|
||||||
|
|
||||||
// This is a fix for child elements firing dragenter before the parent fires dragleave
|
|
||||||
if (!$this.dragenterData(this)) {
|
|
||||||
$(this).removeClass($this.options.overClass);
|
|
||||||
$this.dragenterData(this, false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var handleDrop = delegate(function(e) {
|
|
||||||
|
|
||||||
|
|
||||||
if (e.type === 'drop') {
|
|
||||||
|
|
||||||
if (e.stopPropagation) {
|
|
||||||
e.stopPropagation();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.preventDefault) {
|
|
||||||
e.preventDefault();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dragging) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this.options.warp) {
|
|
||||||
var thisSibling = currentlyDraggingElement.nextSibling;
|
|
||||||
this.parentNode.insertBefore(currentlyDraggingElement, this);
|
|
||||||
this.parentNode.insertBefore(this, thisSibling);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this.options.change(this, currentlyDraggingElement);
|
|
||||||
$this.trigger('sortable-change', [$this, currentlyDraggingElement]);
|
|
||||||
});
|
|
||||||
|
|
||||||
var handleDragEnd = function(e) {
|
|
||||||
|
|
||||||
currentlyDraggingElement = null;
|
|
||||||
currentlyDraggingTarget = null;
|
|
||||||
|
|
||||||
$this.element.children().each(function() {
|
|
||||||
if (this.nodeType === 1) {
|
|
||||||
$(this).removeClass($this.options.overClass).removeClass($this.options.placeholderClass).removeClass($this.options.childClass);
|
|
||||||
$this.dragenterData(this, false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('html').removeClass($this.options.dragMovingClass);
|
|
||||||
|
|
||||||
removeFakeDragHandlers();
|
|
||||||
|
|
||||||
$this.options.stop(this);
|
|
||||||
$this.trigger('sortable-stop', [$this]);
|
|
||||||
|
|
||||||
draggingPlaceholder.remove();
|
|
||||||
draggingPlaceholder = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
var handleTouchMove = delegate(function(e) {
|
|
||||||
|
|
||||||
if (!currentlyDraggingElement ||
|
|
||||||
currentlyDraggingElement === this ||
|
|
||||||
currentlyDraggingTarget === this) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
children.removeClass($this.options.overClass);
|
|
||||||
currentlyDraggingTarget = this;
|
|
||||||
|
|
||||||
if (!$this.options.warp) {
|
|
||||||
$this.moveElementNextTo(currentlyDraggingElement, this);
|
|
||||||
} else {
|
|
||||||
$(this).addClass($this.options.overClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
return prevent(e);
|
|
||||||
});
|
|
||||||
|
|
||||||
function delegate(fn) {
|
|
||||||
return function(e) {
|
|
||||||
|
|
||||||
var touch = (supportsTouch && e.touches && e.touches[0]) || { },
|
|
||||||
target = touch.target || e.target;
|
|
||||||
|
|
||||||
// Fix event.target for a touch event
|
|
||||||
if (supportsTouch && document.elementFromPoint) {
|
|
||||||
target = document.elementFromPoint(e.pageX - document.body.scrollLeft, e.pageY - document.body.scrollTop);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($(target).hasClass($this.options.childClass)) {
|
|
||||||
fn.apply(target, [e]);
|
|
||||||
} else if (target !== element) {
|
|
||||||
|
|
||||||
// If a child is initiating the event or ending it, then use the container as context for the callback.
|
|
||||||
var context = moveUpToChildNode(element, target);
|
|
||||||
|
|
||||||
if (context) {
|
|
||||||
fn.apply(context, [e]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Opera and mobile devices do not support drag and drop. http://caniuse.com/dragndrop
|
|
||||||
// Bind/unbind standard mouse/touch events as a polyfill.
|
|
||||||
function addFakeDragHandlers() {
|
|
||||||
if (!supportsDragAndDrop) {
|
|
||||||
if (supportsTouch) {
|
|
||||||
element.addEventListener("touchmove", handleTouchMove, false);
|
|
||||||
} else {
|
|
||||||
element.addEventListener('mouseover', handleDragEnter, false);
|
|
||||||
element.addEventListener('mouseout', handleDragLeave, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
element.addEventListener(supportsTouch ? 'touchend' : 'mouseup', handleDrop, false);
|
|
||||||
document.addEventListener(supportsTouch ? 'touchend' : 'mouseup', handleDragEnd, false);
|
|
||||||
document.addEventListener("selectstart", prevent, false);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeFakeDragHandlers() {
|
|
||||||
if (!supportsDragAndDrop) {
|
|
||||||
if (supportsTouch) {
|
|
||||||
element.removeEventListener("touchmove", handleTouchMove, false);
|
|
||||||
} else {
|
|
||||||
element.removeEventListener('mouseover', handleDragEnter, false);
|
|
||||||
element.removeEventListener('mouseout', handleDragLeave, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
element.removeEventListener(supportsTouch ? 'touchend' : 'mouseup', handleDrop, false);
|
|
||||||
document.removeEventListener(supportsTouch ? 'touchend' : 'mouseup', handleDragEnd, false);
|
|
||||||
document.removeEventListener("selectstart", prevent, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (supportsDragAndDrop) {
|
|
||||||
element.addEventListener('dragstart', handleDragStart, false);
|
|
||||||
element.addEventListener('dragenter', handleDragEnter, false);
|
|
||||||
element.addEventListener('dragleave', handleDragLeave, false);
|
|
||||||
element.addEventListener('drop', handleDrop, false);
|
|
||||||
element.addEventListener('dragover', handleDragOver, false);
|
|
||||||
element.addEventListener('dragend', handleDragEnd, false);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
element.addEventListener(supportsTouch ? 'touchstart':'mousedown', handleDragStart, false);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
dragenterData: function(element, val) {
|
|
||||||
|
|
||||||
element = $(element);
|
|
||||||
|
|
||||||
if (arguments.length == 1) {
|
|
||||||
return parseInt(element.attr('data-child-dragenter'), 10) || 0;
|
|
||||||
} else if (!val) {
|
|
||||||
element.removeAttr('data-child-dragenter');
|
|
||||||
} else {
|
|
||||||
element.attr('data-child-dragenter', Math.max(0, val));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
moveElementNextTo: function(element, elementToMoveNextTo) {
|
|
||||||
|
|
||||||
dragging = true;
|
|
||||||
|
|
||||||
var $this = this,
|
|
||||||
list = $(element).parent().css('min-height', ''),
|
|
||||||
next = isBelow(element, elementToMoveNextTo) ? elementToMoveNextTo : elementToMoveNextTo.nextSibling,
|
|
||||||
children = list.children(),
|
|
||||||
count = children.length;
|
|
||||||
|
|
||||||
if($this.options.warp || !$this.options.animation) {
|
|
||||||
elementToMoveNextTo.parentNode.insertBefore(element, next);
|
|
||||||
UI.Utils.checkDisplay($this.element);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
list.css('min-height', list.height());
|
|
||||||
|
|
||||||
children.stop().each(function(){
|
|
||||||
var ele = $(this),
|
|
||||||
offset = ele.position();
|
|
||||||
|
|
||||||
offset.width = ele.width();
|
|
||||||
|
|
||||||
ele.data('offset-before', offset);
|
|
||||||
});
|
|
||||||
|
|
||||||
elementToMoveNextTo.parentNode.insertBefore(element, next);
|
|
||||||
|
|
||||||
children = list.children().each(function() {
|
|
||||||
var ele = $(this);
|
|
||||||
ele.data('offset-after', ele.position());
|
|
||||||
}).each(function() {
|
|
||||||
var ele = $(this),
|
|
||||||
before = ele.data('offset-before');
|
|
||||||
ele.css({'position':'absolute', 'top':before.top, 'left':before.left, 'min-width':before.width });
|
|
||||||
});
|
|
||||||
|
|
||||||
children.each(function(){
|
|
||||||
|
|
||||||
var ele = $(this),
|
|
||||||
before = ele.data('offset-before'),
|
|
||||||
offset = ele.data('offset-after');
|
|
||||||
|
|
||||||
ele.css('pointer-events', 'none').width();
|
|
||||||
|
|
||||||
setTimeout(function(){
|
|
||||||
ele.animate({'top':offset.top, 'left':offset.left}, $this.options.animation, function() {
|
|
||||||
ele.css({'position':'','top':'', 'left':'', 'min-width': '', 'pointer-events':''}).removeClass($this.options.overClass).attr('data-child-dragenter', '');
|
|
||||||
count--
|
|
||||||
if (!count) {
|
|
||||||
list.css('min-height', '');
|
|
||||||
UI.Utils.checkDisplay(ele);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, 0);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// helpers
|
|
||||||
|
|
||||||
function isBelow(el1, el2) {
|
|
||||||
|
|
||||||
var parent = el1.parentNode;
|
|
||||||
|
|
||||||
if (el2.parentNode != parent) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var cur = el1.previousSibling;
|
|
||||||
|
|
||||||
while (cur && cur.nodeType !== 9) {
|
|
||||||
if (cur === el2) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
cur = cur.previousSibling;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function moveUpToChildNode(parent, child) {
|
|
||||||
var cur = child;
|
|
||||||
if (cur == parent) { return null; }
|
|
||||||
|
|
||||||
while (cur) {
|
|
||||||
if (cur.parentNode === parent) {
|
|
||||||
return cur;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur = cur.parentNode;
|
|
||||||
if ( !cur || !cur.ownerDocument || cur.nodeType === 11 ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function prevent(e) {
|
|
||||||
if (e.stopPropagation) {
|
|
||||||
e.stopPropagation();
|
|
||||||
}
|
|
||||||
if (e.preventDefault) {
|
|
||||||
e.preventDefault();
|
|
||||||
}
|
|
||||||
e.returnValue = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// auto init
|
|
||||||
UI.ready(function(context) {
|
|
||||||
|
|
||||||
$("[data-uk-sortable]", context).each(function(){
|
|
||||||
|
|
||||||
var ele = $(this);
|
|
||||||
|
|
||||||
if(!ele.data("sortable")) {
|
|
||||||
var plugin = UI.sortable(ele, UI.Utils.options(ele.attr("data-uk-sortable")));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
UI.$doc.on('mousemove touchmove', function(e) {
|
|
||||||
|
|
||||||
if (delayIdle) {
|
|
||||||
if (Math.abs(e.pageX - delayIdle.pos.x) > delayIdle.threshold || Math.abs(e.pageY - delayIdle.pos.y) > delayIdle.threshold) {
|
|
||||||
delayIdle.apply();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (draggingPlaceholder) {
|
|
||||||
|
|
||||||
if (!moving) {
|
|
||||||
moving = true;
|
|
||||||
draggingPlaceholder.show();
|
|
||||||
|
|
||||||
draggingPlaceholder.$current.addClass(draggingPlaceholder.$sortable.options.placeholderClass);
|
|
||||||
draggingPlaceholder.$sortable.element.children().addClass(draggingPlaceholder.$sortable.options.childClass);
|
|
||||||
|
|
||||||
$('html').addClass(draggingPlaceholder.$sortable.options.dragMovingClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
var offset = draggingPlaceholder.data('mouse-offset'),
|
|
||||||
left = parseInt(e.originalEvent.pageX, 10) + offset.left,
|
|
||||||
top = parseInt(e.originalEvent.pageY, 10) + offset.top;
|
|
||||||
|
|
||||||
draggingPlaceholder.css({'left': left, 'top': top });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
UI.$doc.on('mouseup touchend', function() {
|
|
||||||
|
|
||||||
if(!moving && clickedlink) {
|
|
||||||
location.href = clickedlink.attr('href');
|
|
||||||
}
|
|
||||||
|
|
||||||
delayIdle = clickedlink = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
return UI.sortable;
|
|
||||||
});
|
|
3
web/js/addons/sortable.min.js
vendored
3
web/js/addons/sortable.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,241 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
(function(addon) {
|
|
||||||
|
|
||||||
var component;
|
|
||||||
|
|
||||||
if (jQuery && jQuery.UIkit) {
|
|
||||||
component = addon(jQuery, jQuery.UIkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof define == "function" && define.amd) {
|
|
||||||
define("uikit-sticky", ["uikit"], function(){
|
|
||||||
return component || addon(jQuery, jQuery.UIkit);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
})(function($, UI){
|
|
||||||
|
|
||||||
var $win = UI.$win,
|
|
||||||
$doc = UI.$doc,
|
|
||||||
sticked = [];
|
|
||||||
|
|
||||||
UI.component('sticky', {
|
|
||||||
|
|
||||||
defaults: {
|
|
||||||
top : 0,
|
|
||||||
bottom : 0,
|
|
||||||
animation : '',
|
|
||||||
clsinit : 'uk-sticky-init',
|
|
||||||
clsactive : 'uk-active',
|
|
||||||
getWidthFrom : '',
|
|
||||||
media : false,
|
|
||||||
target : false
|
|
||||||
},
|
|
||||||
|
|
||||||
init: function() {
|
|
||||||
|
|
||||||
var stickyId = this.element.attr('id') || ("s"+Math.ceil(Math.random()*10000)),
|
|
||||||
wrapper = $('<div class="uk-sticky-placeholder"></div>').css({
|
|
||||||
'height' : this.element.css('position') != 'absolute' ? this.element.outerHeight() : '',
|
|
||||||
'float' : this.element.css("float") != "none" ? this.element.css("float") : '',
|
|
||||||
'margin' : this.element.css("margin")
|
|
||||||
});
|
|
||||||
|
|
||||||
wrapper = this.element.css('margin', 0).wrap(wrapper).parent();
|
|
||||||
|
|
||||||
this.sticky = {
|
|
||||||
options : this.options,
|
|
||||||
element : this.element,
|
|
||||||
currentTop : null,
|
|
||||||
wrapper : wrapper,
|
|
||||||
init : false,
|
|
||||||
getWidthFrom : this.options.getWidthFrom || wrapper,
|
|
||||||
reset : function(force) {
|
|
||||||
|
|
||||||
var finalize = function() {
|
|
||||||
this.element.css({"position":"", "top":"", "width":"", "left":"", "margin":"0"});
|
|
||||||
this.element.removeClass([this.options.animation, 'uk-animation-reverse', this.options.clsactive].join(' '));
|
|
||||||
|
|
||||||
this.currentTop = null;
|
|
||||||
this.animate = false;
|
|
||||||
}.bind(this);
|
|
||||||
|
|
||||||
|
|
||||||
if (!force && this.options.animation && UI.support.animation) {
|
|
||||||
|
|
||||||
this.animate = true;
|
|
||||||
|
|
||||||
this.element.removeClass(this.options.animation).one(UI.support.animation.end, function(){
|
|
||||||
finalize();
|
|
||||||
}).width(); // force redraw
|
|
||||||
|
|
||||||
this.element.addClass(this.options.animation+' '+'uk-animation-reverse');
|
|
||||||
} else {
|
|
||||||
finalize();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
check: function() {
|
|
||||||
|
|
||||||
if (this.options.media) {
|
|
||||||
|
|
||||||
switch(typeof(this.options.media)) {
|
|
||||||
case 'number':
|
|
||||||
if (window.innerWidth < this.options.media) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'string':
|
|
||||||
if (window.matchMedia && !window.matchMedia(this.options.media).matches) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var scrollTop = $win.scrollTop(),
|
|
||||||
documentHeight = $doc.height(),
|
|
||||||
dwh = documentHeight - $win.height(),
|
|
||||||
extra = (scrollTop > dwh) ? dwh - scrollTop : 0,
|
|
||||||
elementTop = this.wrapper.offset().top,
|
|
||||||
etse = elementTop - this.options.top - extra;
|
|
||||||
|
|
||||||
return (scrollTop >= etse);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
sticked.push(this.sticky);
|
|
||||||
},
|
|
||||||
|
|
||||||
update: function() {
|
|
||||||
scroller();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function scroller() {
|
|
||||||
|
|
||||||
if (!sticked.length) return;
|
|
||||||
|
|
||||||
var scrollTop = $win.scrollTop(),
|
|
||||||
documentHeight = $doc.height(),
|
|
||||||
dwh = documentHeight - $win.height(),
|
|
||||||
extra = (scrollTop > dwh) ? dwh - scrollTop : 0,
|
|
||||||
cls, newTop;
|
|
||||||
|
|
||||||
if(scrollTop < 0) return;
|
|
||||||
|
|
||||||
|
|
||||||
for (var i = 0; i < sticked.length; i++) {
|
|
||||||
|
|
||||||
if (!sticked[i].element.is(":visible") || sticked[i].animate) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var sticky = sticked[i];
|
|
||||||
|
|
||||||
if (!sticky.check()) {
|
|
||||||
|
|
||||||
if (sticky.currentTop !== null) {
|
|
||||||
sticky.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (sticky.options.top < 0) {
|
|
||||||
newTop = 0;
|
|
||||||
} else {
|
|
||||||
newTop = documentHeight - sticky.element.outerHeight() - sticky.options.top - sticky.options.bottom - scrollTop - extra;
|
|
||||||
newTop = newTop < 0 ? newTop + sticky.options.top : sticky.options.top;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sticky.currentTop != newTop) {
|
|
||||||
|
|
||||||
sticky.element.css({
|
|
||||||
"position" : "fixed",
|
|
||||||
"top" : newTop,
|
|
||||||
"width" : (typeof sticky.getWidthFrom !== 'undefined') ? $(sticky.getWidthFrom).width() : sticky.element.width(),
|
|
||||||
"left" : sticky.wrapper.offset().left
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!sticky.init) {
|
|
||||||
|
|
||||||
sticky.element.addClass(sticky.options.clsinit);
|
|
||||||
|
|
||||||
if (location.hash && scrollTop > 0 && sticky.options.target) {
|
|
||||||
|
|
||||||
var $target = $(location.hash);
|
|
||||||
|
|
||||||
if ($target.length) {
|
|
||||||
|
|
||||||
setTimeout((function($target, sticky){
|
|
||||||
|
|
||||||
return function() {
|
|
||||||
|
|
||||||
sticky.element.width(); // force redraw
|
|
||||||
|
|
||||||
var offset = $target.offset(),
|
|
||||||
maxoffset = offset.top + $target.outerHeight(),
|
|
||||||
stickyOffset = sticky.element.offset(),
|
|
||||||
stickyHeight = sticky.element.outerHeight(),
|
|
||||||
stickyMaxOffset = stickyOffset.top + stickyHeight;
|
|
||||||
|
|
||||||
if (stickyOffset.top < maxoffset && offset.top < stickyMaxOffset) {
|
|
||||||
scrollTop = offset.top - stickyHeight - sticky.options.target;
|
|
||||||
window.scrollTo(0, scrollTop);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
})($target, sticky), 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sticky.element.addClass(sticky.options.clsactive);
|
|
||||||
sticky.element.css('margin', '');
|
|
||||||
|
|
||||||
if (sticky.options.animation && sticky.init) {
|
|
||||||
sticky.element.addClass(sticky.options.animation);
|
|
||||||
}
|
|
||||||
|
|
||||||
sticky.currentTop = newTop;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sticky.init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// should be more efficient than using $win.scroll(scroller):
|
|
||||||
$doc.on('uk-scroll', scroller);
|
|
||||||
$win.on('resize orientationchange', UI.Utils.debounce(function() {
|
|
||||||
|
|
||||||
if (!sticked.length) return;
|
|
||||||
|
|
||||||
for (var i = 0; i < sticked.length; i++) {
|
|
||||||
sticked[i].reset(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
scroller();
|
|
||||||
}, 100));
|
|
||||||
|
|
||||||
// init code
|
|
||||||
UI.ready(function(context) {
|
|
||||||
|
|
||||||
setTimeout(function(){
|
|
||||||
|
|
||||||
$("[data-uk-sticky]", context).each(function(){
|
|
||||||
|
|
||||||
var $ele = $(this);
|
|
||||||
|
|
||||||
if(!$ele.data("sticky")) {
|
|
||||||
UI.sticky($ele, UI.Utils.options($ele.attr('data-uk-sticky')));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
scroller();
|
|
||||||
}, 0);
|
|
||||||
});
|
|
||||||
|
|
||||||
return $.fn.uksticky;
|
|
||||||
});
|
|
3
web/js/addons/sticky.min.js
vendored
3
web/js/addons/sticky.min.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
!function(a){var b;jQuery&&jQuery.UIkit&&(b=a(jQuery,jQuery.UIkit)),"function"==typeof define&&define.amd&&define("uikit-sticky",["uikit"],function(){return b||a(jQuery,jQuery.UIkit)})}(function(a,b){function c(){if(f.length){var b,c=d.scrollTop(),g=e.height(),h=g-d.height(),i=c>h?h-c:0;if(!(0>c))for(var j=0;j<f.length;j++)if(f[j].element.is(":visible")&&!f[j].animate){var k=f[j];if(k.check()){if(k.options.top<0?b=0:(b=g-k.element.outerHeight()-k.options.top-k.options.bottom-c-i,b=0>b?b+k.options.top:k.options.top),k.currentTop!=b){if(k.element.css({position:"fixed",top:b,width:"undefined"!=typeof k.getWidthFrom?a(k.getWidthFrom).width():k.element.width(),left:k.wrapper.offset().left}),!k.init&&(k.element.addClass(k.options.clsinit),location.hash&&c>0&&k.options.target)){var l=a(location.hash);l.length&&setTimeout(function(a,b){return function(){b.element.width();var d=a.offset(),e=d.top+a.outerHeight(),f=b.element.offset(),g=b.element.outerHeight(),h=f.top+g;f.top<e&&d.top<h&&(c=d.top-g-b.options.target,window.scrollTo(0,c))}}(l,k),0)}k.element.addClass(k.options.clsactive),k.element.css("margin",""),k.options.animation&&k.init&&k.element.addClass(k.options.animation),k.currentTop=b}}else null!==k.currentTop&&k.reset();k.init=!0}}}var d=b.$win,e=b.$doc,f=[];return b.component("sticky",{defaults:{top:0,bottom:0,animation:"",clsinit:"uk-sticky-init",clsactive:"uk-active",getWidthFrom:"",media:!1,target:!1},init:function(){var c=(this.element.attr("id")||"s"+Math.ceil(1e4*Math.random()),a('<div class="uk-sticky-placeholder"></div>').css({height:"absolute"!=this.element.css("position")?this.element.outerHeight():"","float":"none"!=this.element.css("float")?this.element.css("float"):"",margin:this.element.css("margin")}));c=this.element.css("margin",0).wrap(c).parent(),this.sticky={options:this.options,element:this.element,currentTop:null,wrapper:c,init:!1,getWidthFrom:this.options.getWidthFrom||c,reset:function(a){var c=function(){this.element.css({position:"",top:"",width:"",left:"",margin:"0"}),this.element.removeClass([this.options.animation,"uk-animation-reverse",this.options.clsactive].join(" ")),this.currentTop=null,this.animate=!1}.bind(this);!a&&this.options.animation&&b.support.animation?(this.animate=!0,this.element.removeClass(this.options.animation).one(b.support.animation.end,function(){c()}).width(),this.element.addClass(this.options.animation+" uk-animation-reverse")):c()},check:function(){if(this.options.media)switch(typeof this.options.media){case"number":if(window.innerWidth<this.options.media)return!1;break;case"string":if(window.matchMedia&&!window.matchMedia(this.options.media).matches)return!1}var a=d.scrollTop(),b=e.height(),c=b-d.height(),f=a>c?c-a:0,g=this.wrapper.offset().top,h=g-this.options.top-f;return a>=h}},f.push(this.sticky)},update:function(){c()}}),e.on("uk-scroll",c),d.on("resize orientationchange",b.Utils.debounce(function(){if(f.length){for(var a=0;a<f.length;a++)f[a].reset(!0);c()}},100)),b.ready(function(d){setTimeout(function(){a("[data-uk-sticky]",d).each(function(){var c=a(this);c.data("sticky")||b.sticky(c,b.Utils.options(c.attr("data-uk-sticky")))}),c()},0)}),a.fn.uksticky});
|
|
@ -1,165 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
(function(addon) {
|
|
||||||
|
|
||||||
var component;
|
|
||||||
|
|
||||||
if (jQuery && jQuery.UIkit) {
|
|
||||||
component = addon(jQuery, jQuery.UIkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof define == "function" && define.amd) {
|
|
||||||
define("uikit-search", ["uikit"], function(){
|
|
||||||
return component || addon(jQuery, jQuery.UIkit);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
})(function($, UI){
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var times = {'12h':[], '24h':[]};
|
|
||||||
|
|
||||||
for(var i = 0, h=''; i<24; i++) {
|
|
||||||
|
|
||||||
h = ''+i;
|
|
||||||
|
|
||||||
if(i<10) h = '0'+h;
|
|
||||||
|
|
||||||
times['24h'].push({value: (h+':00')});
|
|
||||||
times['24h'].push({value: (h+':30')});
|
|
||||||
|
|
||||||
if (i<13) {
|
|
||||||
times['12h'].push({value: (h+':00 AM')});
|
|
||||||
times['12h'].push({value: (h+':30 AM')});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i > 12) {
|
|
||||||
|
|
||||||
h = h-12;
|
|
||||||
|
|
||||||
if (h < 10) h = '0'+String(h);
|
|
||||||
|
|
||||||
times['12h'].push({value: (h+':00 PM')});
|
|
||||||
times['12h'].push({value: (h+':30 PM')});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
UI.component('timepicker', {
|
|
||||||
|
|
||||||
defaults: {
|
|
||||||
format : '24h',
|
|
||||||
delay : 0
|
|
||||||
},
|
|
||||||
|
|
||||||
init: function() {
|
|
||||||
|
|
||||||
var $this = this;
|
|
||||||
|
|
||||||
this.options.minLength = 0;
|
|
||||||
this.options.template = '<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>';
|
|
||||||
|
|
||||||
this.options.source = function(release) {
|
|
||||||
release(times[$this.options.format] || times['12h']);
|
|
||||||
};
|
|
||||||
|
|
||||||
this.element.wrap('<div class="uk-autocomplete"></div>');
|
|
||||||
|
|
||||||
this.autocomplete = UI.autocomplete(this.element.parent(), this.options);
|
|
||||||
this.autocomplete.dropdown.addClass('uk-dropdown-small uk-dropdown-scrollable');
|
|
||||||
|
|
||||||
this.autocomplete.on('autocomplete-show', function() {
|
|
||||||
|
|
||||||
var selected = $this.autocomplete.dropdown.find('[data-value="'+$this.autocomplete.input.val()+'"]');
|
|
||||||
|
|
||||||
setTimeout(function(){
|
|
||||||
$this.autocomplete.pick(selected, true);
|
|
||||||
}, 10);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.autocomplete.input.on('focus', function(){
|
|
||||||
|
|
||||||
$this.autocomplete.value = Math.random();
|
|
||||||
$this.autocomplete.triggercomplete();
|
|
||||||
|
|
||||||
}).on('blur', function() {
|
|
||||||
$this.checkTime();
|
|
||||||
});
|
|
||||||
|
|
||||||
this.element.data("timepicker", this);
|
|
||||||
},
|
|
||||||
|
|
||||||
checkTime: function() {
|
|
||||||
|
|
||||||
var arr, timeArray, meridian = 'AM', hour, minute, time = this.autocomplete.input.val();
|
|
||||||
|
|
||||||
if (this.options.format == '12h') {
|
|
||||||
arr = time.split(' ');
|
|
||||||
timeArray = arr[0].split(':');
|
|
||||||
meridian = arr[1];
|
|
||||||
} else {
|
|
||||||
timeArray = time.split(':');
|
|
||||||
}
|
|
||||||
|
|
||||||
hour = parseInt(timeArray[0], 10);
|
|
||||||
minute = parseInt(timeArray[1], 10);
|
|
||||||
|
|
||||||
if (isNaN(hour)) hour = 0;
|
|
||||||
if (isNaN(minute)) minute = 0;
|
|
||||||
|
|
||||||
if (this.options.format == '12h') {
|
|
||||||
if (hour > 12) {
|
|
||||||
hour = 12;
|
|
||||||
} else if (hour < 0) {
|
|
||||||
hour = 12;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (meridian === 'am' || meridian === 'a') {
|
|
||||||
meridian = 'AM';
|
|
||||||
} else if (meridian === 'pm' || meridian === 'p') {
|
|
||||||
meridian = 'PM';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (meridian !== 'AM' && meridian !== 'PM') {
|
|
||||||
meridian = 'AM';
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (hour >= 24) {
|
|
||||||
hour = 23;
|
|
||||||
} else if (hour < 0) {
|
|
||||||
hour = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (minute < 0) {
|
|
||||||
minute = 0;
|
|
||||||
} else if (minute >= 60) {
|
|
||||||
minute = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.autocomplete.input.val(this.formatTime(hour, minute, meridian));
|
|
||||||
},
|
|
||||||
|
|
||||||
formatTime: function(hour, minute, meridian) {
|
|
||||||
hour = hour < 10 ? '0' + hour : hour;
|
|
||||||
minute = minute < 10 ? '0' + minute : minute;
|
|
||||||
return hour + ':' + minute + (this.options.format == '12h' ? ' ' + meridian : '');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// init code
|
|
||||||
UI.$doc.on("focus.timepicker.uikit", "[data-uk-timepicker]", function(e) {
|
|
||||||
var ele = $(this);
|
|
||||||
|
|
||||||
if (!ele.data("timepicker")) {
|
|
||||||
var obj = UI.timepicker(ele, UI.Utils.options(ele.attr("data-uk-timepicker")));
|
|
||||||
|
|
||||||
setTimeout(function(){
|
|
||||||
obj.autocomplete.input.focus();
|
|
||||||
}, 20);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
3
web/js/addons/timepicker.min.js
vendored
3
web/js/addons/timepicker.min.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
!function(a){var b;jQuery&&jQuery.UIkit&&(b=a(jQuery,jQuery.UIkit)),"function"==typeof define&&define.amd&&define("uikit-search",["uikit"],function(){return b||a(jQuery,jQuery.UIkit)})}(function(a,b){"use strict";for(var c={"12h":[],"24h":[]},d=0,e="";24>d;d++)e=""+d,10>d&&(e="0"+e),c["24h"].push({value:e+":00"}),c["24h"].push({value:e+":30"}),13>d&&(c["12h"].push({value:e+":00 AM"}),c["12h"].push({value:e+":30 AM"})),d>12&&(e-=12,10>e&&(e="0"+String(e)),c["12h"].push({value:e+":00 PM"}),c["12h"].push({value:e+":30 PM"}));b.component("timepicker",{defaults:{format:"24h",delay:0},init:function(){var a=this;this.options.minLength=0,this.options.template='<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>',this.options.source=function(b){b(c[a.options.format]||c["12h"])},this.element.wrap('<div class="uk-autocomplete"></div>'),this.autocomplete=b.autocomplete(this.element.parent(),this.options),this.autocomplete.dropdown.addClass("uk-dropdown-small uk-dropdown-scrollable"),this.autocomplete.on("autocomplete-show",function(){var b=a.autocomplete.dropdown.find('[data-value="'+a.autocomplete.input.val()+'"]');setTimeout(function(){a.autocomplete.pick(b,!0)},10)}),this.autocomplete.input.on("focus",function(){a.autocomplete.value=Math.random(),a.autocomplete.triggercomplete()}).on("blur",function(){a.checkTime()}),this.element.data("timepicker",this)},checkTime:function(){var a,b,c,d,e="AM",f=this.autocomplete.input.val();"12h"==this.options.format?(a=f.split(" "),b=a[0].split(":"),e=a[1]):b=f.split(":"),c=parseInt(b[0],10),d=parseInt(b[1],10),isNaN(c)&&(c=0),isNaN(d)&&(d=0),"12h"==this.options.format?(c>12?c=12:0>c&&(c=12),"am"===e||"a"===e?e="AM":("pm"===e||"p"===e)&&(e="PM"),"AM"!==e&&"PM"!==e&&(e="AM")):c>=24?c=23:0>c&&(c=0),0>d?d=0:d>=60&&(d=0),this.autocomplete.input.val(this.formatTime(c,d,e))},formatTime:function(a,b,c){return a=10>a?"0"+a:a,b=10>b?"0"+b:b,a+":"+b+("12h"==this.options.format?" "+c:"")}}),b.$doc.on("focus.timepicker.uikit","[data-uk-timepicker]",function(){var c=a(this);if(!c.data("timepicker")){var d=b.timepicker(c,b.Utils.options(c.attr("data-uk-timepicker")));setTimeout(function(){d.autocomplete.input.focus()},20)}})});
|
|
@ -1,253 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
(function(addon) {
|
|
||||||
|
|
||||||
var component;
|
|
||||||
|
|
||||||
if (jQuery && jQuery.UIkit) {
|
|
||||||
component = addon(jQuery, jQuery.UIkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof define == "function" && define.amd) {
|
|
||||||
define("uikit-upload", ["uikit"], function(){
|
|
||||||
return component || addon(jQuery, jQuery.UIkit);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
})(function($, UI){
|
|
||||||
|
|
||||||
UI.component('uploadSelect', {
|
|
||||||
|
|
||||||
|
|
||||||
init: function() {
|
|
||||||
|
|
||||||
var $this = this;
|
|
||||||
|
|
||||||
this.on("change", function() {
|
|
||||||
xhrupload($this.element[0].files, $this.options);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
UI.component('uploadDrop', {
|
|
||||||
|
|
||||||
defaults: {
|
|
||||||
'dragoverClass': 'uk-dragover'
|
|
||||||
},
|
|
||||||
|
|
||||||
init: function() {
|
|
||||||
|
|
||||||
var $this = this, hasdragCls = false;
|
|
||||||
|
|
||||||
this.on("drop", function(e){
|
|
||||||
|
|
||||||
if (e.dataTransfer && e.dataTransfer.files) {
|
|
||||||
|
|
||||||
e.stopPropagation();
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
$this.element.removeClass($this.options.dragoverClass);
|
|
||||||
$this.element.trigger('uk.dropped', [e.dataTransfer.files]);
|
|
||||||
|
|
||||||
xhrupload(e.dataTransfer.files, $this.options);
|
|
||||||
}
|
|
||||||
|
|
||||||
}).on("dragenter", function(e){
|
|
||||||
e.stopPropagation();
|
|
||||||
e.preventDefault();
|
|
||||||
}).on("dragover", function(e){
|
|
||||||
e.stopPropagation();
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
if (!hasdragCls) {
|
|
||||||
$this.element.addClass($this.options.dragoverClass);
|
|
||||||
hasdragCls = true;
|
|
||||||
}
|
|
||||||
}).on("dragleave", function(e){
|
|
||||||
e.stopPropagation();
|
|
||||||
e.preventDefault();
|
|
||||||
$this.element.removeClass($this.options.dragoverClass);
|
|
||||||
hasdragCls = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
UI.support.ajaxupload = (function() {
|
|
||||||
|
|
||||||
function supportFileAPI() {
|
|
||||||
var fi = document.createElement('INPUT'); fi.type = 'file'; return 'files' in fi;
|
|
||||||
}
|
|
||||||
|
|
||||||
function supportAjaxUploadProgressEvents() {
|
|
||||||
var xhr = new XMLHttpRequest(); return !! (xhr && ('upload' in xhr) && ('onprogress' in xhr.upload));
|
|
||||||
}
|
|
||||||
|
|
||||||
function supportFormData() {
|
|
||||||
return !! window.FormData;
|
|
||||||
}
|
|
||||||
|
|
||||||
return supportFileAPI() && supportAjaxUploadProgressEvents() && supportFormData();
|
|
||||||
})();
|
|
||||||
|
|
||||||
if (UI.support.ajaxupload){
|
|
||||||
$.event.props.push("dataTransfer");
|
|
||||||
}
|
|
||||||
|
|
||||||
function xhrupload(files, settings) {
|
|
||||||
|
|
||||||
if (!UI.support.ajaxupload){
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
settings = $.extend({}, xhrupload.defaults, settings);
|
|
||||||
|
|
||||||
if (!files.length){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (settings.allow !== '*.*') {
|
|
||||||
|
|
||||||
for(var i=0,file;file=files[i];i++) {
|
|
||||||
|
|
||||||
if(!matchName(settings.allow, file.name)) {
|
|
||||||
|
|
||||||
if(typeof(settings.notallowed) == 'string') {
|
|
||||||
alert(settings.notallowed);
|
|
||||||
} else {
|
|
||||||
settings.notallowed(file, settings);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var complete = settings.complete;
|
|
||||||
|
|
||||||
if (settings.single){
|
|
||||||
|
|
||||||
var count = files.length,
|
|
||||||
uploaded = 0,
|
|
||||||
allow = true;
|
|
||||||
|
|
||||||
settings.beforeAll(files);
|
|
||||||
|
|
||||||
settings.complete = function(response, xhr){
|
|
||||||
|
|
||||||
uploaded = uploaded + 1;
|
|
||||||
|
|
||||||
complete(response, xhr);
|
|
||||||
|
|
||||||
if (settings.filelimit && uploaded >= settings.filelimit){
|
|
||||||
allow = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (allow && uploaded<count){
|
|
||||||
upload([files[uploaded]], settings);
|
|
||||||
} else {
|
|
||||||
settings.allcomplete(response, xhr);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
upload([files[0]], settings);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
settings.complete = function(response, xhr){
|
|
||||||
complete(response, xhr);
|
|
||||||
settings.allcomplete(response, xhr);
|
|
||||||
};
|
|
||||||
|
|
||||||
upload(files, settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
function upload(files, settings){
|
|
||||||
|
|
||||||
// upload all at once
|
|
||||||
var formData = new FormData(), xhr = new XMLHttpRequest();
|
|
||||||
|
|
||||||
if (settings.before(settings, files)===false) return;
|
|
||||||
|
|
||||||
for (var i = 0, f; f = files[i]; i++) { formData.append(settings.param, f); }
|
|
||||||
for (var p in settings.params) { formData.append(p, settings.params[p]); }
|
|
||||||
|
|
||||||
// Add any event handlers here...
|
|
||||||
xhr.upload.addEventListener("progress", function(e){
|
|
||||||
var percent = (e.loaded / e.total)*100;
|
|
||||||
settings.progress(percent, e);
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
xhr.addEventListener("loadstart", function(e){ settings.loadstart(e); }, false);
|
|
||||||
xhr.addEventListener("load", function(e){ settings.load(e); }, false);
|
|
||||||
xhr.addEventListener("loadend", function(e){ settings.loadend(e); }, false);
|
|
||||||
xhr.addEventListener("error", function(e){ settings.error(e); }, false);
|
|
||||||
xhr.addEventListener("abort", function(e){ settings.abort(e); }, false);
|
|
||||||
|
|
||||||
xhr.open(settings.method, settings.action, true);
|
|
||||||
|
|
||||||
xhr.onreadystatechange = function() {
|
|
||||||
|
|
||||||
settings.readystatechange(xhr);
|
|
||||||
|
|
||||||
if (xhr.readyState==4){
|
|
||||||
|
|
||||||
var response = xhr.responseText;
|
|
||||||
|
|
||||||
if (settings.type=="json") {
|
|
||||||
try {
|
|
||||||
response = $.parseJSON(response);
|
|
||||||
} catch(e) {
|
|
||||||
response = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
settings.complete(response, xhr);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
settings.beforeSend(xhr);
|
|
||||||
xhr.send(formData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
xhrupload.defaults = {
|
|
||||||
'action': '',
|
|
||||||
'single': true,
|
|
||||||
'method': 'POST',
|
|
||||||
'param' : 'files[]',
|
|
||||||
'params': {},
|
|
||||||
'allow' : '*.*',
|
|
||||||
'type' : 'text',
|
|
||||||
'filelimit': false,
|
|
||||||
|
|
||||||
// events
|
|
||||||
'before' : function(o){},
|
|
||||||
'beforeSend' : function(xhr){},
|
|
||||||
'beforeAll' : function(){},
|
|
||||||
'loadstart' : function(){},
|
|
||||||
'load' : function(){},
|
|
||||||
'loadend' : function(){},
|
|
||||||
'error' : function(){},
|
|
||||||
'abort' : function(){},
|
|
||||||
'progress' : function(){},
|
|
||||||
'complete' : function(){},
|
|
||||||
'allcomplete' : function(){},
|
|
||||||
'readystatechange': function(){},
|
|
||||||
'notallowed' : function(file, settings){ alert('Only the following file types are allowed: '+settings.allow); }
|
|
||||||
};
|
|
||||||
|
|
||||||
function matchName(pattern, path) {
|
|
||||||
|
|
||||||
var parsedPattern = '^' + pattern.replace(/\//g, '\\/').
|
|
||||||
replace(/\*\*/g, '(\\/[^\\/]+)*').
|
|
||||||
replace(/\*/g, '[^\\/]+').
|
|
||||||
replace(/((?!\\))\?/g, '$1.') + '$';
|
|
||||||
|
|
||||||
parsedPattern = '^' + parsedPattern + '$';
|
|
||||||
|
|
||||||
return (path.match(new RegExp(parsedPattern, 'i')) !== null);
|
|
||||||
}
|
|
||||||
|
|
||||||
UI.Utils.xhrupload = xhrupload;
|
|
||||||
|
|
||||||
return xhrupload;
|
|
||||||
});
|
|
3
web/js/addons/upload.min.js
vendored
3
web/js/addons/upload.min.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
||||||
|
|
||||||
!function(a){var b;jQuery&&jQuery.UIkit&&(b=a(jQuery,jQuery.UIkit)),"function"==typeof define&&define.amd&&define("uikit-upload",["uikit"],function(){return b||a(jQuery,jQuery.UIkit)})}(function(a,b){function c(e,f){function g(b,c){var d=new FormData,e=new XMLHttpRequest;if(c.before(c,b)!==!1){for(var f,g=0;f=b[g];g++)d.append(c.param,f);for(var h in c.params)d.append(h,c.params[h]);e.upload.addEventListener("progress",function(a){var b=a.loaded/a.total*100;c.progress(b,a)},!1),e.addEventListener("loadstart",function(a){c.loadstart(a)},!1),e.addEventListener("load",function(a){c.load(a)},!1),e.addEventListener("loadend",function(a){c.loadend(a)},!1),e.addEventListener("error",function(a){c.error(a)},!1),e.addEventListener("abort",function(a){c.abort(a)},!1),e.open(c.method,c.action,!0),e.onreadystatechange=function(){if(c.readystatechange(e),4==e.readyState){var b=e.responseText;if("json"==c.type)try{b=a.parseJSON(b)}catch(d){b=!1}c.complete(b,e)}},c.beforeSend(e),e.send(d)}}if(!b.support.ajaxupload)return this;if(f=a.extend({},c.defaults,f),e.length){if("*.*"!==f.allow)for(var h,i=0;h=e[i];i++)if(!d(f.allow,h.name))return void("string"==typeof f.notallowed?alert(f.notallowed):f.notallowed(h,f));var j=f.complete;if(f.single){var k=e.length,l=0,m=!0;f.beforeAll(e),f.complete=function(a,b){l+=1,j(a,b),f.filelimit&&l>=f.filelimit&&(m=!1),m&&k>l?g([e[l]],f):f.allcomplete(a,b)},g([e[0]],f)}else f.complete=function(a,b){j(a,b),f.allcomplete(a,b)},g(e,f)}}function d(a,b){var c="^"+a.replace(/\//g,"\\/").replace(/\*\*/g,"(\\/[^\\/]+)*").replace(/\*/g,"[^\\/]+").replace(/((?!\\))\?/g,"$1.")+"$";return c="^"+c+"$",null!==b.match(new RegExp(c,"i"))}return b.component("uploadSelect",{init:function(){var a=this;this.on("change",function(){c(a.element[0].files,a.options)})}}),b.component("uploadDrop",{defaults:{dragoverClass:"uk-dragover"},init:function(){var a=this,b=!1;this.on("drop",function(b){b.dataTransfer&&b.dataTransfer.files&&(b.stopPropagation(),b.preventDefault(),a.element.removeClass(a.options.dragoverClass),a.element.trigger("uk.dropped",[b.dataTransfer.files]),c(b.dataTransfer.files,a.options))}).on("dragenter",function(a){a.stopPropagation(),a.preventDefault()}).on("dragover",function(c){c.stopPropagation(),c.preventDefault(),b||(a.element.addClass(a.options.dragoverClass),b=!0)}).on("dragleave",function(c){c.stopPropagation(),c.preventDefault(),a.element.removeClass(a.options.dragoverClass),b=!1})}}),b.support.ajaxupload=function(){function a(){var a=document.createElement("INPUT");return a.type="file","files"in a}function b(){var a=new XMLHttpRequest;return!!(a&&"upload"in a&&"onprogress"in a.upload)}function c(){return!!window.FormData}return a()&&b()&&c()}(),b.support.ajaxupload&&a.event.props.push("dataTransfer"),c.defaults={action:"",single:!0,method:"POST",param:"files[]",params:{},allow:"*.*",type:"text",filelimit:!1,before:function(){},beforeSend:function(){},beforeAll:function(){},loadstart:function(){},load:function(){},loadend:function(){},error:function(){},abort:function(){},progress:function(){},complete:function(){},allcomplete:function(){},readystatechange:function(){},notallowed:function(a,b){alert("Only the following file types are allowed: "+b.allow)}},b.Utils.xhrupload=c,c});
|
|
2594
web/js/uikit.js
2594
web/js/uikit.js
File diff suppressed because it is too large
Load Diff
4
web/js/uikit.min.js
vendored
4
web/js/uikit.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user