first commit
This commit is contained in:
@@ -0,0 +1,135 @@
|
||||
function TextEncoderLite() {
|
||||
}
|
||||
function TextDecoderLite() {
|
||||
}
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// Taken from https://github.com/feross/buffer/blob/master/index.js
|
||||
// Thanks Feross et al! :-)
|
||||
|
||||
function utf8ToBytes (string, units) {
|
||||
units = units || Infinity
|
||||
var codePoint
|
||||
var length = string.length
|
||||
var leadSurrogate = null
|
||||
var bytes = []
|
||||
var i = 0
|
||||
|
||||
for (; i < length; i++) {
|
||||
codePoint = string.charCodeAt(i)
|
||||
|
||||
// is surrogate component
|
||||
if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
||||
// last char was a lead
|
||||
if (leadSurrogate) {
|
||||
// 2 leads in a row
|
||||
if (codePoint < 0xDC00) {
|
||||
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
||||
leadSurrogate = codePoint
|
||||
continue
|
||||
} else {
|
||||
// valid surrogate pair
|
||||
codePoint = leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 | 0x10000
|
||||
leadSurrogate = null
|
||||
}
|
||||
} else {
|
||||
// no lead yet
|
||||
|
||||
if (codePoint > 0xDBFF) {
|
||||
// unexpected trail
|
||||
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
||||
continue
|
||||
} else if (i + 1 === length) {
|
||||
// unpaired lead
|
||||
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
||||
continue
|
||||
} else {
|
||||
// valid lead
|
||||
leadSurrogate = codePoint
|
||||
continue
|
||||
}
|
||||
}
|
||||
} else if (leadSurrogate) {
|
||||
// valid bmp char, but last char was a lead
|
||||
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
||||
leadSurrogate = null
|
||||
}
|
||||
|
||||
// encode utf8
|
||||
if (codePoint < 0x80) {
|
||||
if ((units -= 1) < 0) break
|
||||
bytes.push(codePoint)
|
||||
} else if (codePoint < 0x800) {
|
||||
if ((units -= 2) < 0) break
|
||||
bytes.push(
|
||||
codePoint >> 0x6 | 0xC0,
|
||||
codePoint & 0x3F | 0x80
|
||||
)
|
||||
} else if (codePoint < 0x10000) {
|
||||
if ((units -= 3) < 0) break
|
||||
bytes.push(
|
||||
codePoint >> 0xC | 0xE0,
|
||||
codePoint >> 0x6 & 0x3F | 0x80,
|
||||
codePoint & 0x3F | 0x80
|
||||
)
|
||||
} else if (codePoint < 0x200000) {
|
||||
if ((units -= 4) < 0) break
|
||||
bytes.push(
|
||||
codePoint >> 0x12 | 0xF0,
|
||||
codePoint >> 0xC & 0x3F | 0x80,
|
||||
codePoint >> 0x6 & 0x3F | 0x80,
|
||||
codePoint & 0x3F | 0x80
|
||||
)
|
||||
} else {
|
||||
throw new Error('Invalid code point')
|
||||
}
|
||||
}
|
||||
|
||||
return bytes
|
||||
}
|
||||
|
||||
function utf8Slice (buf, start, end) {
|
||||
var res = ''
|
||||
var tmp = ''
|
||||
end = Math.min(buf.length, end || Infinity)
|
||||
start = start || 0;
|
||||
|
||||
for (var i = start; i < end; i++) {
|
||||
if (buf[i] <= 0x7F) {
|
||||
res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])
|
||||
tmp = ''
|
||||
} else {
|
||||
tmp += '%' + buf[i].toString(16)
|
||||
}
|
||||
}
|
||||
|
||||
return res + decodeUtf8Char(tmp)
|
||||
}
|
||||
|
||||
function decodeUtf8Char (str) {
|
||||
try {
|
||||
return decodeURIComponent(str)
|
||||
} catch (err) {
|
||||
return String.fromCharCode(0xFFFD) // UTF 8 invalid char
|
||||
}
|
||||
}
|
||||
|
||||
TextEncoderLite.prototype.encode = function (str) {
|
||||
var result;
|
||||
|
||||
if ('undefined' === typeof Uint8Array) {
|
||||
result = utf8ToBytes(str);
|
||||
} else {
|
||||
result = new Uint8Array(utf8ToBytes(str));
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
TextDecoderLite.prototype.decode = function (bytes) {
|
||||
return utf8Slice(bytes, 0, bytes.length);
|
||||
}
|
||||
|
||||
}());
|
||||
515
wp-content/plugins/wp-file-download-light/app/admin/assets/js/bootbox.js
vendored
Normal file
515
wp-content/plugins/wp-file-download-light/app/admin/assets/js/bootbox.js
vendored
Normal file
@@ -0,0 +1,515 @@
|
||||
/**
|
||||
* bootbox.js v3.0.0
|
||||
*
|
||||
* http://bootboxjs.com/license.txt
|
||||
*/
|
||||
var bootbox = window.bootbox || (function(document, $) {
|
||||
|
||||
var _animate = true,
|
||||
_backdrop = 'static',
|
||||
_defaultHref = 'javascript:;',
|
||||
_classes = '',
|
||||
_icons = {},
|
||||
/* last var should always be the public object we'll return */
|
||||
that = {};
|
||||
|
||||
|
||||
that.setIcons = function(icons) {
|
||||
_icons = icons;
|
||||
if (typeof _icons !== 'object' || _icons == null) {
|
||||
_icons = {};
|
||||
}
|
||||
};
|
||||
|
||||
that.alert = function(/*str, label, cb*/) {
|
||||
var str = "",
|
||||
label = _translate('Ok'),
|
||||
cb = null;
|
||||
|
||||
switch (arguments.length) {
|
||||
case 1:
|
||||
// no callback, default button label
|
||||
str = arguments[0];
|
||||
break;
|
||||
case 2:
|
||||
// callback *or* custom button label dependent on type
|
||||
str = arguments[0];
|
||||
if (typeof arguments[1] == 'function') {
|
||||
cb = arguments[1];
|
||||
} else {
|
||||
label = arguments[1];
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
// callback and custom button label
|
||||
str = arguments[0];
|
||||
label = arguments[1];
|
||||
cb = arguments[2];
|
||||
break;
|
||||
default:
|
||||
throw new Error("Incorrect number of arguments: expected 1-3");
|
||||
break;
|
||||
}
|
||||
|
||||
return that.dialog(str, {
|
||||
// only button (ok)
|
||||
"label" : label,
|
||||
"icon" : _icons.OK,
|
||||
"callback": cb
|
||||
}, {
|
||||
// ensure that the escape key works; either invoking the user's
|
||||
// callback or true to just close the dialog
|
||||
"onEscape": cb || true
|
||||
});
|
||||
};
|
||||
|
||||
that.confirm = function(/*str, labelCancel, labelOk, cb*/) {
|
||||
var str = "",
|
||||
labelCancel = _translate('Cancel'),
|
||||
labelOk = _translate('Confirm'),
|
||||
cb = null;
|
||||
|
||||
switch (arguments.length) {
|
||||
case 1:
|
||||
str = arguments[0];
|
||||
break;
|
||||
case 2:
|
||||
str = arguments[0];
|
||||
if (typeof arguments[1] == 'function') {
|
||||
cb = arguments[1];
|
||||
} else {
|
||||
labelCancel = arguments[1];
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
str = arguments[0];
|
||||
labelCancel = arguments[1];
|
||||
if (typeof arguments[2] == 'function') {
|
||||
cb = arguments[2];
|
||||
} else {
|
||||
labelOk = arguments[2];
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
str = arguments[0];
|
||||
labelCancel = arguments[1];
|
||||
labelOk = arguments[2];
|
||||
cb = arguments[3];
|
||||
break;
|
||||
default:
|
||||
throw new Error("Incorrect number of arguments: expected 1-4");
|
||||
break;
|
||||
}
|
||||
|
||||
var cancelCallback = function() {
|
||||
if (typeof cb === 'function') {
|
||||
cb(false);
|
||||
}
|
||||
};
|
||||
|
||||
var confirmCallback = function() {
|
||||
if (typeof cb === 'function') {
|
||||
cb(true);
|
||||
}
|
||||
};
|
||||
|
||||
return that.dialog(str, [{
|
||||
// first button (cancel)
|
||||
"label" : labelCancel,
|
||||
"icon" : _icons.CANCEL,
|
||||
"callback": cancelCallback
|
||||
}, {
|
||||
// second button (confirm)
|
||||
"label" : labelOk,
|
||||
"icon" : _icons.CONFIRM,
|
||||
"callback": confirmCallback
|
||||
}], {
|
||||
// escape key bindings
|
||||
"onEscape": cancelCallback
|
||||
});
|
||||
};
|
||||
|
||||
that.prompt = function(/*str, labelCancel, labelOk, cb, defaultVal*/) {
|
||||
var str = "",
|
||||
labelCancel = _translate('Cancel'),
|
||||
labelOk = _translate('Confirm'),
|
||||
cb = null,
|
||||
defaultVal = "";
|
||||
|
||||
switch (arguments.length) {
|
||||
case 1:
|
||||
str = arguments[0];
|
||||
break;
|
||||
case 2:
|
||||
str = arguments[0];
|
||||
if (typeof arguments[1] == 'function') {
|
||||
cb = arguments[1];
|
||||
} else {
|
||||
labelCancel = arguments[1];
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
str = arguments[0];
|
||||
labelCancel = arguments[1];
|
||||
if (typeof arguments[2] == 'function') {
|
||||
cb = arguments[2];
|
||||
} else {
|
||||
labelOk = arguments[2];
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
str = arguments[0];
|
||||
labelCancel = arguments[1];
|
||||
labelOk = arguments[2];
|
||||
cb = arguments[3];
|
||||
break;
|
||||
case 5:
|
||||
str = arguments[0];
|
||||
labelCancel = arguments[1];
|
||||
labelOk = arguments[2];
|
||||
cb = arguments[3];
|
||||
defaultVal = arguments[4];
|
||||
break;
|
||||
default:
|
||||
throw new Error("Incorrect number of arguments: expected 1-5");
|
||||
break;
|
||||
}
|
||||
|
||||
var header = str;
|
||||
|
||||
// let's keep a reference to the form object for later
|
||||
var form = $("<form></form>");
|
||||
form.append("<input autocomplete=off type=text value='" + defaultVal + "' />");
|
||||
|
||||
var cancelCallback = function() {
|
||||
if (typeof cb === 'function') {
|
||||
// yep, native prompts dismiss with null, whereas native
|
||||
// confirms dismiss with false...
|
||||
cb(null);
|
||||
}
|
||||
};
|
||||
|
||||
var confirmCallback = function() {
|
||||
if (typeof cb === 'function') {
|
||||
cb(form.find("input[type=text]").val());
|
||||
}
|
||||
};
|
||||
|
||||
var div = that.dialog(form, [{
|
||||
// first button (cancel)
|
||||
"label" : labelCancel,
|
||||
"icon" : _icons.CANCEL,
|
||||
"callback": cancelCallback
|
||||
}, {
|
||||
// second button (confirm)
|
||||
"label" : labelOk,
|
||||
"icon" : _icons.CONFIRM,
|
||||
"callback": confirmCallback
|
||||
}], {
|
||||
// prompts need a few extra options
|
||||
"header" : header,
|
||||
// explicitly tell dialog NOT to show the dialog...
|
||||
"show" : false,
|
||||
"onEscape": cancelCallback
|
||||
});
|
||||
|
||||
// ... the reason the prompt needs to be hidden is because we need
|
||||
// to bind our own "shown" handler, after creating the modal but
|
||||
// before any show(n) events are triggered
|
||||
// @see https://github.com/makeusabrew/bootbox/issues/69
|
||||
|
||||
div.on("shown", function() {
|
||||
form.find("input[type=text]").focus();
|
||||
|
||||
// ensure that submitting the form (e.g. with the enter key)
|
||||
// replicates the behaviour of a normal prompt()
|
||||
form.on("submit", function(e) {
|
||||
e.preventDefault();
|
||||
div.find(".button-primary").click();
|
||||
});
|
||||
});
|
||||
|
||||
div.modal("show");
|
||||
div.fadeIn();
|
||||
return div;
|
||||
};
|
||||
|
||||
that.dialog = function(str, handlers, options) {
|
||||
var buttons = "",
|
||||
callbacks = [],
|
||||
options = options || {};
|
||||
|
||||
// check for single object and convert to array if necessary
|
||||
if (handlers == null) {
|
||||
handlers = [];
|
||||
} else if (typeof handlers.length == 'undefined') {
|
||||
handlers = [handlers];
|
||||
}
|
||||
|
||||
var i = handlers.length;
|
||||
while (i--) {
|
||||
var label = null,
|
||||
href = null,
|
||||
_class = null,
|
||||
icon = '',
|
||||
callback = null;
|
||||
|
||||
if (typeof handlers[i]['label'] == 'undefined' &&
|
||||
typeof handlers[i]['class'] == 'undefined' &&
|
||||
typeof handlers[i]['callback'] == 'undefined') {
|
||||
// if we've got nothing we expect, check for condensed format
|
||||
|
||||
var propCount = 0, // condensed will only match if this == 1
|
||||
property = null; // save the last property we found
|
||||
|
||||
// be nicer to count the properties without this, but don't think it's possible...
|
||||
for (var j in handlers[i]) {
|
||||
property = j;
|
||||
if (++propCount > 1) {
|
||||
// forget it, too many properties
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (propCount == 1 && typeof handlers[i][j] == 'function') {
|
||||
// matches condensed format of label -> function
|
||||
handlers[i]['label'] = property;
|
||||
handlers[i]['callback'] = handlers[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof handlers[i]['callback']== 'function') {
|
||||
callback = handlers[i]['callback'];
|
||||
}
|
||||
|
||||
if (handlers[i]['class']) {
|
||||
_class = handlers[i]['class'];
|
||||
} else if (i == handlers.length -1 && handlers.length <= 2) {
|
||||
// always add a primary to the main option in a two-button dialog
|
||||
_class = 'button-primary';
|
||||
}
|
||||
|
||||
if (handlers[i]['label']) {
|
||||
label = handlers[i]['label'];
|
||||
} else {
|
||||
label = "Option "+(i+1);
|
||||
}
|
||||
|
||||
if (handlers[i]['icon']) {
|
||||
icon = "<i class='"+handlers[i]['icon']+"'></i> ";
|
||||
}
|
||||
|
||||
if (handlers[i]['href']) {
|
||||
href = handlers[i]['href'];
|
||||
}
|
||||
else {
|
||||
href = _defaultHref;
|
||||
}
|
||||
|
||||
buttons = "<a data-handler='"+i+"' class='button "+_class+"' href='" + href + "'>"+icon+""+label+"</a>" + buttons;
|
||||
|
||||
callbacks[i] = callback;
|
||||
}
|
||||
|
||||
// @see https://github.com/makeusabrew/bootbox/issues/46#issuecomment-8235302
|
||||
// and https://github.com/twitter/bootstrap/issues/4474
|
||||
// for an explanation of the inline overflow: hidden
|
||||
// @see https://github.com/twitter/bootstrap/issues/4854
|
||||
// for an explanation of tabIndex=-1
|
||||
|
||||
var parts = ["<div class='bootbox modal' tabindex='-1' style='overflow:hidden;'>"];
|
||||
|
||||
if (options['header']) {
|
||||
var closeButton = '';
|
||||
if (typeof options['headerCloseButton'] == 'undefined' || options['headerCloseButton']) {
|
||||
closeButton = "<a href='"+_defaultHref+"' class='close'>×</a>";
|
||||
}
|
||||
|
||||
parts.push("<div class='modal-header'>"+closeButton+"<h3>"+options['header']+"</h3></div>");
|
||||
}
|
||||
|
||||
// push an empty body into which we'll inject the proper content later
|
||||
parts.push("<div class='modal-body'></div>");
|
||||
|
||||
if (buttons) {
|
||||
parts.push("<div class='modal-footer'>"+buttons+"</div>");
|
||||
}
|
||||
|
||||
parts.push("</div>");
|
||||
|
||||
var div = $(parts.join("\n"));
|
||||
|
||||
// check whether we should fade in/out
|
||||
var shouldFade = (typeof options.animate === 'undefined') ? _animate : options.animate;
|
||||
|
||||
if (shouldFade) {
|
||||
div.addClass("fade");
|
||||
}
|
||||
|
||||
var optionalClasses = (typeof options.classes === 'undefined') ? _classes : options.classes;
|
||||
if (optionalClasses) {
|
||||
div.addClass(optionalClasses);
|
||||
}
|
||||
|
||||
// now we've built up the div properly we can inject the content whether it was a string or a jQuery object
|
||||
div.find(".modal-body").html(str);
|
||||
|
||||
div.on('hidden', function() {
|
||||
div.remove();
|
||||
});
|
||||
|
||||
// hook into the modal's keyup trigger to check for the escape key
|
||||
div.on('keyup.dismiss.modal', function(e) {
|
||||
// any truthy value passed to onEscape will dismiss the dialog...
|
||||
if (e.which == 27 && options.onEscape) {
|
||||
if (typeof options.onEscape === 'function') {
|
||||
// ... but only a function will be invoked (obviously)
|
||||
options.onEscape();
|
||||
}
|
||||
|
||||
div.modal('hide');
|
||||
}
|
||||
});
|
||||
|
||||
// well, *if* we have a primary - give the first dom element focus
|
||||
div.on('shown', function() {
|
||||
div.find("a.button-primary:first").focus();
|
||||
});
|
||||
|
||||
// wire up button handlers
|
||||
div.on('click', '.modal-footer a, a.close', function(e) {
|
||||
|
||||
var handler = $(this).data("handler"),
|
||||
cb = callbacks[handler],
|
||||
hideModal = null;
|
||||
|
||||
// sort of @see https://github.com/makeusabrew/bootbox/pull/68 - heavily adapted
|
||||
// if we've got a custom href attribute, all bets are off
|
||||
if (typeof handler !== 'undefined' &&
|
||||
typeof handlers[handler]['href'] !== 'undefined') {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
if (typeof cb == 'function') {
|
||||
hideModal = cb();
|
||||
}
|
||||
|
||||
// the only way hideModal *will* be false is if a callback exists and
|
||||
// returns it as a value. in those situations, don't hide the dialog
|
||||
// @see https://github.com/makeusabrew/bootbox/pull/25
|
||||
if (hideModal !== false) {
|
||||
div.modal("hide");
|
||||
$('.modal-backdrop').remove();
|
||||
}
|
||||
});
|
||||
|
||||
// stick the modal right at the bottom of the main body out of the way
|
||||
$("#mybootstrap").append(div);
|
||||
|
||||
div.modal({
|
||||
// unless explicitly overridden take whatever our default backdrop value is
|
||||
backdrop : (typeof options.backdrop === 'undefined') ? _backdrop : options.backdrop,
|
||||
// ignore bootstrap's keyboard options; we'll handle this ourselves (more fine-grained control)
|
||||
keyboard : false,
|
||||
// @ see https://github.com/makeusabrew/bootbox/issues/69
|
||||
// we *never* want the modal to be shown before we can bind stuff to it
|
||||
// this method can also take a 'show' option, but we'll only use that
|
||||
// later if we need to
|
||||
show : false
|
||||
});
|
||||
|
||||
// @see https://github.com/makeusabrew/bootbox/issues/64
|
||||
// @see https://github.com/makeusabrew/bootbox/issues/60
|
||||
// ...caused by...
|
||||
// @see https://github.com/twitter/bootstrap/issues/4781
|
||||
div.on("show", function(e) {
|
||||
$(document).off("focusin.modal");
|
||||
});
|
||||
|
||||
if (typeof options.show === 'undefined' || options.show === true) {
|
||||
div.modal("show");
|
||||
div.addClass('in');
|
||||
}
|
||||
|
||||
return div;
|
||||
};
|
||||
|
||||
/**
|
||||
* #modal is deprecated in v3; it can still be used but no guarantees are
|
||||
* made - have never been truly convinced of its merit but perhaps just
|
||||
* needs a tidyup and some TLC
|
||||
*/
|
||||
that.modal = function(/*str, label, options*/) {
|
||||
var str;
|
||||
var label;
|
||||
var options;
|
||||
|
||||
var defaultOptions = {
|
||||
"onEscape": null,
|
||||
"keyboard": true,
|
||||
"backdrop": _backdrop
|
||||
};
|
||||
|
||||
switch (arguments.length) {
|
||||
case 1:
|
||||
str = arguments[0];
|
||||
break;
|
||||
case 2:
|
||||
str = arguments[0];
|
||||
if (typeof arguments[1] == 'object') {
|
||||
options = arguments[1];
|
||||
} else {
|
||||
label = arguments[1];
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
str = arguments[0];
|
||||
label = arguments[1];
|
||||
options = arguments[2];
|
||||
break;
|
||||
default:
|
||||
throw new Error("Incorrect number of arguments: expected 1-3");
|
||||
break;
|
||||
}
|
||||
|
||||
defaultOptions['header'] = label;
|
||||
|
||||
if (typeof options == 'object') {
|
||||
options = $.extend(defaultOptions, options);
|
||||
} else {
|
||||
options = defaultOptions;
|
||||
}
|
||||
|
||||
return that.dialog(str, [], options);
|
||||
};
|
||||
|
||||
|
||||
that.hideAll = function() {
|
||||
$(".bootbox").modal("hide");
|
||||
};
|
||||
|
||||
that.animate = function(animate) {
|
||||
_animate = animate;
|
||||
};
|
||||
|
||||
that.backdrop = function(backdrop) {
|
||||
_backdrop = backdrop;
|
||||
};
|
||||
|
||||
that.classes = function(classes) {
|
||||
_classes = classes;
|
||||
};
|
||||
|
||||
function _translate(str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
return that;
|
||||
|
||||
}(document, window.jQuery));
|
||||
|
||||
// @see https://github.com/makeusabrew/bootbox/issues/71
|
||||
window.bootbox = bootbox;
|
||||
395
wp-content/plugins/wp-file-download-light/app/admin/assets/js/bootstrap-slider.js
vendored
Normal file
395
wp-content/plugins/wp-file-download-light/app/admin/assets/js/bootstrap-slider.js
vendored
Normal file
@@ -0,0 +1,395 @@
|
||||
/* =========================================================
|
||||
* bootstrap-slider.js v2.0.0
|
||||
* http://www.eyecon.ro/bootstrap-slider
|
||||
* =========================================================
|
||||
* Copyright 2012 Stefan Petre
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ========================================================= */
|
||||
|
||||
!function( $ ) {
|
||||
|
||||
var Slider = function(element, options) {
|
||||
this.element = $(element);
|
||||
this.picker = $('<div class="slider">'+
|
||||
'<div class="slider-track">'+
|
||||
'<div class="slider-selection"></div>'+
|
||||
'<div class="slider-handle"></div>'+
|
||||
'<div class="slider-handle"></div>'+
|
||||
'</div>'+
|
||||
'<div class="tooltip bottom"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'+
|
||||
'</div>')
|
||||
.insertBefore(this.element)
|
||||
.append(this.element);
|
||||
this.id = this.element.data('slider-id')||options.id;
|
||||
if (this.id) {
|
||||
this.picker[0].id = this.id;
|
||||
}
|
||||
|
||||
if (typeof Modernizr !== 'undefined' && Modernizr.touch) {
|
||||
this.touchCapable = true;
|
||||
}
|
||||
|
||||
var tooltip = this.element.data('slider-tooltip')||options.tooltip;
|
||||
|
||||
this.tooltip = this.picker.find('.tooltip');
|
||||
this.tooltipInner = this.tooltip.find('div.tooltip-inner');
|
||||
|
||||
this.orientation = this.element.data('slider-orientation')||options.orientation;
|
||||
switch(this.orientation) {
|
||||
case 'vertical':
|
||||
this.picker.addClass('slider-vertical');
|
||||
this.stylePos = 'top';
|
||||
this.mousePos = 'pageY';
|
||||
this.sizePos = 'offsetHeight';
|
||||
this.tooltip.addClass('right')[0].style.left = '100%';
|
||||
break;
|
||||
default:
|
||||
this.picker
|
||||
.addClass('slider-horizontal')
|
||||
.css('width', this.element.outerWidth());
|
||||
this.orientation = 'horizontal';
|
||||
this.stylePos = 'left';
|
||||
this.mousePos = 'pageX';
|
||||
this.sizePos = 'offsetWidth';
|
||||
this.tooltip.addClass('top')[0].style.top = -this.tooltip.outerHeight() + 34 + 'px';
|
||||
break;
|
||||
}
|
||||
|
||||
this.min = this.element.data('slider-min')||options.min;
|
||||
this.max = this.element.data('slider-max')||options.max;
|
||||
this.step = this.element.data('slider-step')||options.step;
|
||||
this.value = this.element.data('slider-value')||options.value;
|
||||
if (this.value[1]) {
|
||||
this.range = true;
|
||||
}
|
||||
|
||||
this.selection = this.element.data('slider-selection')||options.selection;
|
||||
this.selectionEl = this.picker.find('.slider-selection');
|
||||
if (this.selection === 'none') {
|
||||
this.selectionEl.addClass('hide');
|
||||
}
|
||||
this.selectionElStyle = this.selectionEl[0].style;
|
||||
|
||||
|
||||
this.handle1 = this.picker.find('.slider-handle:first');
|
||||
this.handle1Stype = this.handle1[0].style;
|
||||
this.handle2 = this.picker.find('.slider-handle:last');
|
||||
this.handle2Stype = this.handle2[0].style;
|
||||
|
||||
var handle = this.element.data('slider-handle')||options.handle;
|
||||
switch(handle) {
|
||||
case 'round':
|
||||
this.handle1.addClass('round');
|
||||
this.handle2.addClass('round');
|
||||
break
|
||||
case 'triangle':
|
||||
this.handle1.addClass('triangle');
|
||||
this.handle2.addClass('triangle');
|
||||
break
|
||||
}
|
||||
|
||||
if (this.range) {
|
||||
this.value[0] = Math.max(this.min, Math.min(this.max, this.value[0]));
|
||||
this.value[1] = Math.max(this.min, Math.min(this.max, this.value[1]));
|
||||
} else {
|
||||
this.value = [ Math.max(this.min, Math.min(this.max, this.value))];
|
||||
this.handle2.addClass('hide');
|
||||
if (this.selection == 'after') {
|
||||
this.value[1] = this.max;
|
||||
} else {
|
||||
this.value[1] = this.min;
|
||||
}
|
||||
}
|
||||
this.diff = this.max - this.min;
|
||||
this.percentage = [
|
||||
(this.value[0]-this.min)*100/this.diff,
|
||||
(this.value[1]-this.min)*100/this.diff,
|
||||
this.step*100/this.diff
|
||||
];
|
||||
|
||||
this.offset = this.picker.offset();
|
||||
this.size = this.picker[0][this.sizePos];
|
||||
|
||||
this.formater = options.formater;
|
||||
|
||||
this.layout();
|
||||
|
||||
if (this.touchCapable) {
|
||||
// Touch: Bind touch events:
|
||||
this.picker.on({
|
||||
touchstart: $.proxy(this.mousedown, this)
|
||||
});
|
||||
} else {
|
||||
this.picker.on({
|
||||
mousedown: $.proxy(this.mousedown, this)
|
||||
});
|
||||
}
|
||||
|
||||
if (tooltip === 'show') {
|
||||
this.picker.on({
|
||||
mouseenter: $.proxy(this.showTooltip, this),
|
||||
mouseleave: $.proxy(this.hideTooltip, this)
|
||||
});
|
||||
} else if (tooltip === 'always') {
|
||||
this.tooltip.addClass('show');
|
||||
}
|
||||
else {
|
||||
this.tooltip.addClass('hide');
|
||||
}
|
||||
|
||||
this.picker.wrap('<div class="slidercontainer" />');
|
||||
this.picker.parent().addClass(this.element.data('slider-stype'));
|
||||
};
|
||||
|
||||
Slider.prototype = {
|
||||
constructor: Slider,
|
||||
|
||||
over: false,
|
||||
inDrag: false,
|
||||
|
||||
showTooltip: function(){
|
||||
this.tooltip.addClass('in');
|
||||
//var left = Math.round(this.percent*this.width);
|
||||
//this.tooltip.css('left', left - this.tooltip.outerWidth()/2);
|
||||
this.over = true;
|
||||
},
|
||||
|
||||
hideTooltip: function(){
|
||||
if (this.inDrag === false) {
|
||||
this.tooltip.removeClass('in');
|
||||
}
|
||||
this.over = false;
|
||||
},
|
||||
|
||||
layout: function(){
|
||||
this.handle1Stype[this.stylePos] = this.percentage[0]+'%';
|
||||
this.handle2Stype[this.stylePos] = this.percentage[1]+'%';
|
||||
if (this.orientation == 'vertical') {
|
||||
this.selectionElStyle.top = Math.min(this.percentage[0], this.percentage[1]) +'%';
|
||||
this.selectionElStyle.height = Math.abs(this.percentage[0] - this.percentage[1]) +'%';
|
||||
} else {
|
||||
this.selectionElStyle.left = Math.min(this.percentage[0], this.percentage[1]) +'%';
|
||||
this.selectionElStyle.width = Math.abs(this.percentage[0] - this.percentage[1]) +'%';
|
||||
}
|
||||
if (this.range) {
|
||||
this.tooltipInner.text(
|
||||
this.formater(this.value[0]) +
|
||||
' : ' +
|
||||
this.formater(this.value[1])
|
||||
);
|
||||
this.tooltip[0].style[this.stylePos] = this.size * (this.percentage[0] + (this.percentage[1] - this.percentage[0])/2)/100 - (this.orientation === 'vertical' ? this.tooltip.outerHeight()/2 : this.tooltip.outerWidth()/2) +'px';
|
||||
} else {
|
||||
this.tooltipInner.text(
|
||||
this.formater(this.value[0])
|
||||
);
|
||||
this.tooltip[0].style[this.stylePos] = this.size * this.percentage[0]/100 - (this.orientation === 'vertical' ? this.tooltip.outerHeight()/2 : this.tooltip.outerWidth()/2) +'px';
|
||||
}
|
||||
},
|
||||
|
||||
mousedown: function(ev) {
|
||||
|
||||
// Touch: Get the original event:
|
||||
if (this.touchCapable && ev.type === 'touchstart') {
|
||||
ev = ev.originalEvent;
|
||||
}
|
||||
|
||||
this.offset = this.picker.offset();
|
||||
this.size = this.picker[0][this.sizePos];
|
||||
|
||||
var percentage = this.getPercentage(ev);
|
||||
|
||||
if (this.range) {
|
||||
var diff1 = Math.abs(this.percentage[0] - percentage);
|
||||
var diff2 = Math.abs(this.percentage[1] - percentage);
|
||||
this.dragged = (diff1 < diff2) ? 0 : 1;
|
||||
} else {
|
||||
this.dragged = 0;
|
||||
}
|
||||
|
||||
this.percentage[this.dragged] = percentage;
|
||||
this.layout();
|
||||
|
||||
if (this.touchCapable) {
|
||||
// Touch: Bind touch events:
|
||||
$(document).on({
|
||||
touchmove: $.proxy(this.mousemove, this),
|
||||
touchend: $.proxy(this.mouseup, this)
|
||||
});
|
||||
} else {
|
||||
$(document).on({
|
||||
mousemove: $.proxy(this.mousemove, this),
|
||||
mouseup: $.proxy(this.mouseup, this)
|
||||
});
|
||||
}
|
||||
|
||||
this.inDrag = true;
|
||||
var val = this.calculateValue();
|
||||
this.element.trigger({
|
||||
type: 'slideStart',
|
||||
value: val
|
||||
}).trigger({
|
||||
type: 'slide',
|
||||
value: val
|
||||
});
|
||||
return false;
|
||||
},
|
||||
|
||||
mousemove: function(ev) {
|
||||
|
||||
// Touch: Get the original event:
|
||||
if (this.touchCapable && ev.type === 'touchmove') {
|
||||
ev = ev.originalEvent;
|
||||
}
|
||||
|
||||
var percentage = this.getPercentage(ev);
|
||||
if (this.range) {
|
||||
if (this.dragged === 0 && this.percentage[1] < percentage) {
|
||||
this.percentage[0] = this.percentage[1];
|
||||
this.dragged = 1;
|
||||
} else if (this.dragged === 1 && this.percentage[0] > percentage) {
|
||||
this.percentage[1] = this.percentage[0];
|
||||
this.dragged = 0;
|
||||
}
|
||||
}
|
||||
this.percentage[this.dragged] = percentage;
|
||||
this.layout();
|
||||
var val = this.calculateValue();
|
||||
this.element
|
||||
.trigger({
|
||||
type: 'slide',
|
||||
value: val
|
||||
})
|
||||
.data('value', val)
|
||||
.prop('value', val);
|
||||
return false;
|
||||
},
|
||||
|
||||
mouseup: function(ev) {
|
||||
if (this.touchCapable) {
|
||||
// Touch: Bind touch events:
|
||||
$(document).off({
|
||||
touchmove: this.mousemove,
|
||||
touchend: this.mouseup
|
||||
});
|
||||
} else {
|
||||
$(document).off({
|
||||
mousemove: this.mousemove,
|
||||
mouseup: this.mouseup
|
||||
});
|
||||
}
|
||||
|
||||
this.inDrag = false;
|
||||
if (this.over == false) {
|
||||
this.hideTooltip();
|
||||
}
|
||||
this.element;
|
||||
var val = this.calculateValue();
|
||||
this.element.val(val);
|
||||
this.element
|
||||
.trigger({
|
||||
type: 'slideStop',
|
||||
value: val
|
||||
})
|
||||
.data('value', val)
|
||||
.prop('value', val);
|
||||
return false;
|
||||
},
|
||||
|
||||
calculateValue: function() {
|
||||
var val;
|
||||
if (this.range) {
|
||||
val = [
|
||||
(this.min + Math.round((this.diff * this.percentage[0]/100)/this.step)*this.step),
|
||||
(this.min + Math.round((this.diff * this.percentage[1]/100)/this.step)*this.step)
|
||||
];
|
||||
this.value = val;
|
||||
} else {
|
||||
val = (this.min + Math.round((this.diff * this.percentage[0]/100)/this.step)*this.step);
|
||||
this.value = [val, this.value[1]];
|
||||
}
|
||||
return val;
|
||||
},
|
||||
|
||||
getPercentage: function(ev) {
|
||||
if (this.touchCapable) {
|
||||
ev = ev.touches[0];
|
||||
}
|
||||
var percentage = (ev[this.mousePos] - this.offset[this.stylePos])*100/this.size;
|
||||
percentage = Math.round(percentage/this.percentage[2])*this.percentage[2];
|
||||
return Math.max(0, Math.min(100, percentage));
|
||||
},
|
||||
|
||||
getValue: function() {
|
||||
if (this.range) {
|
||||
return this.value;
|
||||
}
|
||||
return this.value[0];
|
||||
},
|
||||
|
||||
setValue: function(val) {
|
||||
this.value = val;
|
||||
|
||||
if (this.range) {
|
||||
this.value[0] = Math.max(this.min, Math.min(this.max, this.value[0]));
|
||||
this.value[1] = Math.max(this.min, Math.min(this.max, this.value[1]));
|
||||
} else {
|
||||
this.value = [ Math.max(this.min, Math.min(this.max, this.value))];
|
||||
this.handle2.addClass('hide');
|
||||
if (this.selection == 'after') {
|
||||
this.value[1] = this.max;
|
||||
} else {
|
||||
this.value[1] = this.min;
|
||||
}
|
||||
}
|
||||
this.diff = this.max - this.min;
|
||||
this.percentage = [
|
||||
(this.value[0]-this.min)*100/this.diff,
|
||||
(this.value[1]-this.min)*100/this.diff,
|
||||
this.step*100/this.diff
|
||||
];
|
||||
this.layout();
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.slider = function ( option, val ) {
|
||||
return this.each(function () {
|
||||
var $this = $(this),
|
||||
data = $this.data('slider'),
|
||||
options = typeof option === 'object' && option;
|
||||
if (!data) {
|
||||
$this.data('slider', (data = new Slider(this, $.extend({}, $.fn.slider.defaults,options))));
|
||||
}
|
||||
if (typeof option == 'string') {
|
||||
data[option](val);
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
$.fn.slider.defaults = {
|
||||
min: 0,
|
||||
max: 10,
|
||||
step: 1,
|
||||
orientation: 'horizontal',
|
||||
value: 5,
|
||||
selection: 'before',
|
||||
tooltip: 'show',
|
||||
handle: 'round',
|
||||
formater: function(value) {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.slider.Constructor = Slider;
|
||||
|
||||
}( window.jQuery );
|
||||
2170
wp-content/plugins/wp-file-download-light/app/admin/assets/js/bootstrap.js
vendored
Normal file
2170
wp-content/plugins/wp-file-download-light/app/admin/assets/js/bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7
wp-content/plugins/wp-file-download-light/app/admin/assets/js/bootstrap.min.js
vendored
Normal file
7
wp-content/plugins/wp-file-download-light/app/admin/assets/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
Calendar.setup=function(g){function f(h,i){if(typeof g[h]=="undefined"){g[h]=i}}f("inputField",null);f("displayArea",null);f("button",null);f("eventName","click");f("ifFormat","%Y/%m/%d");f("daFormat","%Y/%m/%d");f("singleClick",true);f("disableFunc",null);f("dateStatusFunc",g.disableFunc);f("dateTooltipFunc",null);f("dateText",null);f("firstDay",null);f("align","Br");f("range",[1900,2999]);f("weekNumbers",true);f("flat",null);f("flatCallback",null);f("onSelect",null);f("onClose",null);f("onUpdate",null);f("date",null);f("showsTime",false);f("timeFormat","24");f("electric",true);f("step",2);f("position",null);f("cache",false);f("showOthers",false);f("multiple",null);var c=["inputField","displayArea","button"];for(var b in c){if(typeof g[c[b]]=="string"){g[c[b]]=document.getElementById(g[c[b]])}}if(!(g.flat||g.multiple||g.inputField||g.displayArea||g.button)){alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code");return false}function a(i){var h=i.params;var j=(i.dateClicked||h.electric);if(j&&h.inputField){h.inputField.value=i.date.print(h.ifFormat);if(typeof h.inputField.onchange=="function"){h.inputField.onchange()}}if(j&&h.displayArea){h.displayArea.innerHTML=i.date.print(h.daFormat)}if(j&&typeof h.onUpdate=="function"){h.onUpdate(i)}if(j&&h.flat){if(typeof h.flatCallback=="function"){h.flatCallback(i)}}if(j&&h.singleClick&&i.dateClicked){i.callCloseHandler()}}if(g.flat!=null){if(typeof g.flat=="string"){g.flat=document.getElementById(g.flat)}if(!g.flat){alert("Calendar.setup:\n Flat specified but can't find parent.");return false}var e=new Calendar(g.firstDay,g.date,g.onSelect||a);e.setDateToolTipHandler(g.dateTooltipFunc);e.showsOtherMonths=g.showOthers;e.showsTime=g.showsTime;e.time24=(g.timeFormat=="24");e.params=g;e.weekNumbers=g.weekNumbers;e.setRange(g.range[0],g.range[1]);e.setDateStatusHandler(g.dateStatusFunc);e.getDateText=g.dateText;if(g.ifFormat){e.setDateFormat(g.ifFormat)}if(g.inputField&&typeof g.inputField.value=="string"){e.parseDate(g.inputField.value)}e.create(g.flat);e.show();return false}var d=g.button||g.displayArea||g.inputField;d["on"+g.eventName]=function(){var h=g.inputField||g.displayArea;var k=g.inputField?g.ifFormat:g.daFormat;var o=false;var m=window.calendar;if(h){g.date=Date.parseDate(h.value||h.innerHTML,k)}if(!(m&&g.cache)){window.calendar=m=new Calendar(g.firstDay,g.date,g.onSelect||a,g.onClose||function(i){i.hide()});m.setDateToolTipHandler(g.dateTooltipFunc);m.showsTime=g.showsTime;m.time24=(g.timeFormat=="24");m.weekNumbers=g.weekNumbers;o=true}else{if(g.date){m.setDate(g.date)}m.hide()}if(g.multiple){m.multiple={};for(var j=g.multiple.length;--j>=0;){var n=g.multiple[j];var l=n.print("%Y%m%d");m.multiple[l]=n}}m.showsOtherMonths=g.showOthers;m.yearStep=g.step;m.setRange(g.range[0],g.range[1]);m.params=g;m.setDateStatusHandler(g.dateStatusFunc);m.getDateText=g.dateText;m.setDateFormat(k);if(o){m.create()}m.refresh();if(!g.position){m.showAtElement(g.button||g.displayArea||g.inputField,g.align)}else{m.showAt(g.position[0],g.position[1])}return false};return e};
|
||||
File diff suppressed because one or more lines are too long
1
wp-content/plugins/wp-file-download-light/app/admin/assets/js/chosen.jquery.min.js
vendored
Normal file
1
wp-content/plugins/wp-file-download-light/app/admin/assets/js/chosen.jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,110 @@
|
||||
'use strict'
|
||||
|
||||
var lookup = []
|
||||
var revLookup = []
|
||||
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
||||
|
||||
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
||||
for (var i = 0, len = code.length; i < len; ++i) {
|
||||
lookup[i] = code[i]
|
||||
revLookup[code.charCodeAt(i)] = i
|
||||
}
|
||||
|
||||
revLookup['-'.charCodeAt(0)] = 62
|
||||
revLookup['_'.charCodeAt(0)] = 63
|
||||
|
||||
function placeHoldersCount (b64) {
|
||||
var len = b64.length
|
||||
if (len % 4 > 0) {
|
||||
throw new Error('Invalid string. Length must be a multiple of 4')
|
||||
}
|
||||
|
||||
// the number of equal signs (place holders)
|
||||
// if there are two placeholders, than the two characters before it
|
||||
// represent one byte
|
||||
// if there is only one, then the three characters before it represent 2 bytes
|
||||
// this is just a cheap hack to not do indexOf twice
|
||||
return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
|
||||
}
|
||||
|
||||
function byteLength (b64) {
|
||||
// base64 is 4/3 + up to two characters of the original data
|
||||
return b64.length * 3 / 4 - placeHoldersCount(b64)
|
||||
}
|
||||
|
||||
function toByteArray (b64) {
|
||||
var i, j, l, tmp, placeHolders, arr
|
||||
var len = b64.length
|
||||
placeHolders = placeHoldersCount(b64)
|
||||
|
||||
arr = new Arr(len * 3 / 4 - placeHolders)
|
||||
|
||||
// if there are placeholders, only get up to the last complete 4 chars
|
||||
l = placeHolders > 0 ? len - 4 : len
|
||||
|
||||
var L = 0
|
||||
|
||||
for (i = 0, j = 0; i < l; i += 4, j += 3) {
|
||||
tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
|
||||
arr[L++] = (tmp >> 16) & 0xFF
|
||||
arr[L++] = (tmp >> 8) & 0xFF
|
||||
arr[L++] = tmp & 0xFF
|
||||
}
|
||||
|
||||
if (placeHolders === 2) {
|
||||
tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
|
||||
arr[L++] = tmp & 0xFF
|
||||
} else if (placeHolders === 1) {
|
||||
tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
|
||||
arr[L++] = (tmp >> 8) & 0xFF
|
||||
arr[L++] = tmp & 0xFF
|
||||
}
|
||||
|
||||
return arr
|
||||
}
|
||||
|
||||
function tripletToBase64 (num) {
|
||||
return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
|
||||
}
|
||||
|
||||
function encodeChunk (uint8, start, end) {
|
||||
var tmp
|
||||
var output = []
|
||||
for (var i = start; i < end; i += 3) {
|
||||
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
|
||||
output.push(tripletToBase64(tmp))
|
||||
}
|
||||
return output.join('')
|
||||
}
|
||||
|
||||
function fromByteArray (uint8) {
|
||||
var tmp
|
||||
var len = uint8.length
|
||||
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
|
||||
var output = ''
|
||||
var parts = []
|
||||
var maxChunkLength = 16383 // must be multiple of 3
|
||||
|
||||
// go through the array every three bytes, we'll deal with trailing stuff later
|
||||
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
||||
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
||||
}
|
||||
|
||||
// pad the end with zeros, but make sure to not forget the extra bytes
|
||||
if (extraBytes === 1) {
|
||||
tmp = uint8[len - 1]
|
||||
output += lookup[tmp >> 2]
|
||||
output += lookup[(tmp << 4) & 0x3F]
|
||||
output += '=='
|
||||
} else if (extraBytes === 2) {
|
||||
tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
|
||||
output += lookup[tmp >> 10]
|
||||
output += lookup[(tmp >> 4) & 0x3F]
|
||||
output += lookup[(tmp << 2) & 0x3F]
|
||||
output += '='
|
||||
}
|
||||
|
||||
parts.push(output)
|
||||
|
||||
return parts.join('')
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
@@ -0,0 +1,188 @@
|
||||
// jQuery File Tree Plugin
|
||||
//
|
||||
// Version 1.0
|
||||
//
|
||||
// Base on the work of Cory S.N. LaViska A Beautiful Site (http://abeautifulsite.net/)
|
||||
// Dual-licensed under the GNU General Public License and the MIT License
|
||||
// Icons from famfamfam silk icon set thanks to http://www.famfamfam.com/lab/icons/silk/
|
||||
//
|
||||
// Usage : $('#jao').jaofiletree(wpfd_options);
|
||||
//
|
||||
// Author: Damien Barrère
|
||||
// Website: http://www.crac-design.com
|
||||
|
||||
(function( $ ) {
|
||||
|
||||
var wpfd_options = {
|
||||
'root' : '/',
|
||||
'script' : 'connectors/jaoconnector.php',
|
||||
'showroot' : 'root',
|
||||
'onclick' : function(elem,type,file){},
|
||||
'oncheck' : function(elem,checked,type,file){},
|
||||
'usecheckboxes' : true, //can be true files dirs or false
|
||||
'expandSpeed' : 500,
|
||||
'collapseSpeed' : 500,
|
||||
'expandEasing' : null,
|
||||
'collapseEasing' : null,
|
||||
'canselect' : true
|
||||
};
|
||||
|
||||
var wpfd_methods = {
|
||||
|
||||
init : function( o ) {
|
||||
if($(this).length==0){
|
||||
return;
|
||||
}
|
||||
$this = $(this);
|
||||
$.extend(wpfd_options,o);
|
||||
|
||||
if(wpfd_options.showroot!=''){
|
||||
checkboxes = '';
|
||||
if(wpfd_options.usecheckboxes===true || wpfd_options.usecheckboxes==='dirs'){
|
||||
checkboxes = '<input type="checkbox" />';
|
||||
}
|
||||
$this.html('<ul class="jaofiletree"><li class="drive directory collapsed selected">'+checkboxes+'<a href="#" data-file="'+wpfd_options.root+'" data-type="dir">'+wpfd_options.showroot+'</a></li></ul>');
|
||||
}
|
||||
wpfd_methods.openfolder(wpfd_options.root);
|
||||
},
|
||||
open : function(dir){
|
||||
wpfd_methods.openfolder(dir);
|
||||
},
|
||||
close : function(dir){
|
||||
wpfd_methods.closedir(dir);
|
||||
},
|
||||
getchecked : function(){
|
||||
var list = new Array();
|
||||
var ik = 0;
|
||||
$this.find('input:checked + a').each(function(){
|
||||
list[ik] = {
|
||||
type : $(this).attr('data-type'),
|
||||
file : $(this).attr('data-file')
|
||||
}
|
||||
ik++;
|
||||
});
|
||||
return list;
|
||||
},
|
||||
getselected : function(){
|
||||
var list = new Array();
|
||||
var ik = 0;
|
||||
$this.find('li.selected > a').each(function(){
|
||||
list[ik] = {
|
||||
type : $(this).attr('data-type'),
|
||||
file : $(this).attr('data-file')
|
||||
}
|
||||
ik++;
|
||||
});
|
||||
return list;
|
||||
},
|
||||
|
||||
openfolder : function(dir) {
|
||||
if($this.find('a[data-file="'+dir+'"]').parent().hasClass('expanded')){
|
||||
return;
|
||||
}
|
||||
var ret;
|
||||
ret = $.ajax({
|
||||
url : wpfd_options.script,
|
||||
data : {dir : dir},
|
||||
context : $this,
|
||||
dataType: 'json',
|
||||
beforeSend : function(){this.find('a[data-file="'+dir+'"]').parent().addClass('wait');}
|
||||
}).done(function(datas) {
|
||||
ret = '<ul class="jaofiletree" style="display: none">';
|
||||
for(ij=0; ij<datas.length; ij++){
|
||||
if(datas[ij].type=='dir'){
|
||||
classe = 'directory collapsed';
|
||||
isdir = '/';
|
||||
}else{
|
||||
classe = 'file ext_'+datas[ij].ext;
|
||||
isdir = '';
|
||||
}
|
||||
ret += '<li class="'+classe+'">'
|
||||
if(wpfd_options.usecheckboxes===true || (wpfd_options.usecheckboxes==='dirs' && datas[ij].type=='dir') || (wpfd_options.usecheckboxes==='files' && datas[ij].type=='file')){
|
||||
ret += '<input type="checkbox" data-file="'+dir+datas[ij].file+'" data-type="'+datas[ij].type+'"/>';
|
||||
}
|
||||
else{
|
||||
// ret += '<input disabled="disabled" type="checkbox" data-file="'+dir+datas[ij].file+'" data-type="'+datas[ij].type+'"/>';
|
||||
}
|
||||
ret += '<a href="#" data-file="'+dir+datas[ij].file+isdir+'" data-type="'+datas[ij].type+'">'+datas[ij].file+'</a>';
|
||||
ret += '</li>';
|
||||
}
|
||||
ret += '</ul>';
|
||||
|
||||
this.find('a[data-file="'+dir+'"]').parent().removeClass('wait').removeClass('collapsed').addClass('expanded');
|
||||
this.find('a[data-file="'+dir+'"]').after(ret);
|
||||
this.find('a[data-file="'+dir+'"]').next().slideDown(wpfd_options.expandSpeed,wpfd_options.expandEasing);
|
||||
|
||||
if(wpfd_options.usecheckboxes){
|
||||
this.find('li input[type="checkbox"]').attr('checked',null);
|
||||
this.find('a[data-file="'+dir+'"]').prev(':not(:disabled)').attr('checked','checked');
|
||||
this.find('a[data-file="'+dir+'"] + ul li input[type="checkbox"]:not(:disabled)').attr('checked','checked');
|
||||
}
|
||||
|
||||
wpfd_methods.setevents();
|
||||
}).done(function(){
|
||||
//Trigger custom event
|
||||
$this.trigger('afteropen');
|
||||
$this.trigger('afterupdate');
|
||||
});
|
||||
},
|
||||
|
||||
closedir : function(dir) {
|
||||
$this.find('a[data-file="'+dir+'"]').next().slideUp(wpfd_options.collapseSpeed,wpfd_options.collapseEasing,function(){$(this).remove();});
|
||||
$this.find('a[data-file="'+dir+'"]').parent().removeClass('expanded').addClass('collapsed');
|
||||
wpfd_methods.setevents();
|
||||
|
||||
//Trigger custom event
|
||||
$this.trigger('afterclose');
|
||||
$this.trigger('afterupdate');
|
||||
|
||||
},
|
||||
|
||||
setevents : function(){
|
||||
$this.find('li a').unbind('click');
|
||||
//Bind userdefined function on click an element
|
||||
$this.find('li a').bind('click', function() {
|
||||
wpfd_options.onclick(this, $(this).attr('data-type'),$(this).attr('data-file'));
|
||||
if(wpfd_options.usecheckboxes && $(this).attr('data-type')=='file'){
|
||||
$this.find('li input[type="checkbox"]').attr('checked',null);
|
||||
$(this).prev(':not(:disabled)').attr('checked','checked');
|
||||
$(this).prev(':not(:disabled)').trigger('check');
|
||||
}
|
||||
if(wpfd_options.canselect){
|
||||
$this.find('li').removeClass('selected');
|
||||
$(this).parent().addClass('selected');
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//Bind checkbox check/uncheck
|
||||
$this.find('li input[type="checkbox"]').bind('change', function() {
|
||||
wpfd_options.oncheck(this,$(this).is(':checked'), $(this).next().attr('data-type'),$(this).next().attr('data-file'));
|
||||
if($(this).is(':checked')){
|
||||
$this.trigger('check');
|
||||
}else{
|
||||
$this.trigger('uncheck');
|
||||
}
|
||||
});
|
||||
//Bind for collapse or expand elements
|
||||
$this.find('li.directory.collapsed a').bind('click', function() {
|
||||
if (!$(this).parent().hasClass('wait')) {
|
||||
wpfd_methods.open($(this).attr('data-file'));
|
||||
}
|
||||
return false;}
|
||||
);
|
||||
$this.find('li.directory.expanded a').bind('click', function() {wpfd_methods.close($(this).attr('data-file'));return false;});
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
$.fn.wpfd_jaofiletree = function( method ) {
|
||||
// Method calling logic
|
||||
if ( wpfd_methods[method] ) {
|
||||
return wpfd_methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
|
||||
} else if ( typeof method === 'object' || ! method ) {
|
||||
return wpfd_methods.init.apply( this, arguments );
|
||||
} else {
|
||||
//error
|
||||
}
|
||||
};
|
||||
})( jQuery );
|
||||
13
wp-content/plugins/wp-file-download-light/app/admin/assets/js/jquery-ui-1.11.4.custom.min.js
vendored
Normal file
13
wp-content/plugins/wp-file-download-light/app/admin/assets/js/jquery-ui-1.11.4.custom.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,117 @@
|
||||
/*!
|
||||
* jQuery Cookie Plugin v1.4.1
|
||||
* https://github.com/carhartl/jquery-cookie
|
||||
*
|
||||
* Copyright 2013 Klaus Hartl
|
||||
* Released under the MIT license
|
||||
*/
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// CommonJS
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
|
||||
var pluses = /\+/g;
|
||||
|
||||
function encode(s) {
|
||||
return config.raw ? s : encodeURIComponent(s);
|
||||
}
|
||||
|
||||
function decode(s) {
|
||||
return config.raw ? s : decodeURIComponent(s);
|
||||
}
|
||||
|
||||
function stringifyCookieValue(value) {
|
||||
return encode(config.json ? JSON.stringify(value) : String(value));
|
||||
}
|
||||
|
||||
function parseCookieValue(s) {
|
||||
if (s.indexOf('"') === 0) {
|
||||
// This is a quoted cookie as according to RFC2068, unescape...
|
||||
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
||||
}
|
||||
|
||||
try {
|
||||
// Replace server-side written pluses with spaces.
|
||||
// If we can't decode the cookie, ignore it, it's unusable.
|
||||
// If we can't parse the cookie, ignore it, it's unusable.
|
||||
s = decodeURIComponent(s.replace(pluses, ' '));
|
||||
return config.json ? JSON.parse(s) : s;
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
function read(s, converter) {
|
||||
var value = config.raw ? s : parseCookieValue(s);
|
||||
return $.isFunction(converter) ? converter(value) : value;
|
||||
}
|
||||
|
||||
var config = $.cookie = function (key, value, options) {
|
||||
|
||||
// Write
|
||||
|
||||
if (value !== undefined && !$.isFunction(value)) {
|
||||
options = $.extend({}, config.defaults, options);
|
||||
|
||||
if (typeof options.expires === 'number') {
|
||||
var days = options.expires, t = options.expires = new Date();
|
||||
t.setTime(+t + days * 864e+5);
|
||||
}
|
||||
|
||||
return (document.cookie = [
|
||||
encode(key), '=', stringifyCookieValue(value),
|
||||
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
||||
options.path ? '; path=' + options.path : '',
|
||||
options.domain ? '; domain=' + options.domain : '',
|
||||
options.secure ? '; secure' : ''
|
||||
].join(''));
|
||||
}
|
||||
|
||||
// Read
|
||||
|
||||
var result = key ? undefined : {};
|
||||
|
||||
// To prevent the for loop in the first place assign an empty array
|
||||
// in case there are no cookies at all. Also prevents odd result when
|
||||
// calling $.cookie().
|
||||
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||
|
||||
for (var i = 0, l = cookies.length; i < l; i++) {
|
||||
var parts = cookies[i].split('=');
|
||||
var name = decode(parts.shift());
|
||||
var cookie = parts.join('=');
|
||||
|
||||
if (key && key === name) {
|
||||
// If second argument (value) is a function it's a converter...
|
||||
result = read(cookie, value);
|
||||
break;
|
||||
}
|
||||
|
||||
// Prevent storing a cookie that we couldn't decode.
|
||||
if (!key && (cookie = read(cookie)) !== undefined) {
|
||||
result[name] = cookie;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
config.defaults = {};
|
||||
|
||||
$.removeCookie = function (key, options) {
|
||||
if ($.cookie(key) === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Must not alter options, thus extending a fresh object...
|
||||
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
|
||||
return !$.cookie(key);
|
||||
};
|
||||
|
||||
}));
|
||||
@@ -0,0 +1,518 @@
|
||||
/*global jQuery:false, alert:false */
|
||||
|
||||
/*
|
||||
* Default text - jQuery plugin for html5 dragging files from desktop to browser
|
||||
*
|
||||
* Author: Weixi Yen
|
||||
*
|
||||
* Email: [Firstname][Lastname]@gmail.com
|
||||
*
|
||||
* Copyright (c) 2010 Resopollution
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* Project home:
|
||||
* http://www.github.com/weixiyen/jquery-filedrop
|
||||
*
|
||||
* Version: 0.1.0
|
||||
*
|
||||
* Features:
|
||||
* Allows sending of extra parameters with file.
|
||||
* Works with Firefox 3.6+
|
||||
* Future-compliant with HTML5 spec (will work with Webkit browsers and IE9)
|
||||
* Usage:
|
||||
* See README at project homepage
|
||||
*
|
||||
*/
|
||||
;(function($) {
|
||||
|
||||
jQuery.event.props.push("dataTransfer");
|
||||
|
||||
var default_opts = {
|
||||
fallback_id: '',
|
||||
url: '',
|
||||
refresh: 1000,
|
||||
paramname: 'userfile',
|
||||
allowedfiletypes:[],
|
||||
maxfiles: 25, // Ignored if queuefiles is set > 0
|
||||
maxfilesize: 1, // MB file size limit
|
||||
queuefiles: 0, // Max files before queueing (for large volume uploads)
|
||||
queuewait: 200, // Queue wait time if full
|
||||
data: {},
|
||||
headers: {},
|
||||
drop: empty,
|
||||
dragStart: empty,
|
||||
dragEnter: empty,
|
||||
dragOver: empty,
|
||||
dragLeave: empty,
|
||||
docEnter: empty,
|
||||
docOver: empty,
|
||||
docLeave: empty,
|
||||
beforeEach: empty,
|
||||
afterAll: empty,
|
||||
rename: empty,
|
||||
error: function(err, file, i, status) {
|
||||
alert(err);
|
||||
},
|
||||
uploadStarted: empty,
|
||||
uploadFinished: empty,
|
||||
progressUpdated: empty,
|
||||
globalProgressUpdated: empty,
|
||||
speedUpdated: empty
|
||||
},
|
||||
errors = ["BrowserNotSupported", "TooManyFiles", "FileTooLarge", "FileTypeNotAllowed", "NotFound", "NotReadable", "AbortError", "ReadError"],
|
||||
doc_leave_timer, stop_loop = false,
|
||||
files_count = 0,
|
||||
files,
|
||||
useBinaryUrl = window.FileReader && !jQuery.isFunction(FileReader.prototype.readAsBinaryString);
|
||||
|
||||
$.fn.filedrop = function(options) {
|
||||
var opts = $.extend({}, default_opts, options),
|
||||
global_progress = [];
|
||||
|
||||
this.on('drop', drop).on('dragstart', opts.dragStart).on('dragenter', dragEnter).on('dragover', dragOver).on('dragleave', dragLeave);
|
||||
$(document).on('drop', docDrop).on('dragenter', docEnter).on('dragover', docOver).on('dragleave', docLeave);
|
||||
|
||||
$('#' + opts.fallback_id).change(function(e) {
|
||||
opts.drop(e);
|
||||
files = e.target.files;
|
||||
files_count = files.length;
|
||||
upload();
|
||||
});
|
||||
|
||||
function drop(e) {
|
||||
if( opts.drop.call(this, e) === false ) return false;
|
||||
files = e.dataTransfer.files;
|
||||
if (files === null || files === undefined || files.length === 0) {
|
||||
opts.error(errors[0]);
|
||||
return false;
|
||||
}
|
||||
files_count = files.length;
|
||||
upload();
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
function getBuilder(filename, filedata, mime, boundary) {
|
||||
var dashdash = '--',
|
||||
crlf = '\r\n',
|
||||
builder = '';
|
||||
|
||||
if (opts.data) {
|
||||
var params = $.param(opts.data).replace(/\+/g, '%20').split(/&/);
|
||||
|
||||
$.each(params, function() {
|
||||
var pair = this.split("=", 2),
|
||||
name = decodeURIComponent(pair[0]),
|
||||
val = decodeURIComponent(pair[1]);
|
||||
|
||||
builder += dashdash;
|
||||
builder += boundary;
|
||||
builder += crlf;
|
||||
builder += 'Content-Disposition: form-data; name="' + name + '"';
|
||||
builder += crlf;
|
||||
builder += crlf;
|
||||
builder += val;
|
||||
builder += crlf;
|
||||
});
|
||||
}
|
||||
|
||||
builder += dashdash;
|
||||
builder += boundary;
|
||||
builder += crlf;
|
||||
builder += 'Content-Disposition: form-data; name="' + opts.paramname + '"';
|
||||
builder += '; filename="' + filename + '"';
|
||||
builder += crlf;
|
||||
|
||||
builder += 'Content-Type: ' + mime;
|
||||
builder += crlf;
|
||||
builder += crlf;
|
||||
|
||||
if (useBinaryUrl) {
|
||||
if (filedata !== null) {
|
||||
builder += atob(filedata.split(',')[1]);
|
||||
}
|
||||
}else {
|
||||
builder += filedata;
|
||||
}
|
||||
builder += crlf;
|
||||
|
||||
builder += dashdash;
|
||||
builder += boundary;
|
||||
builder += dashdash;
|
||||
builder += crlf;
|
||||
return builder;
|
||||
}
|
||||
|
||||
function progress(e) {
|
||||
if (e.lengthComputable) {
|
||||
var percentage = Math.round((e.loaded * 100) / e.total);
|
||||
if (this.currentProgress !== percentage) {
|
||||
|
||||
this.currentProgress = percentage;
|
||||
opts.progressUpdated(this.index, this.file, this.currentProgress);
|
||||
|
||||
global_progress[this.global_progress_index] = this.currentProgress;
|
||||
globalProgress();
|
||||
|
||||
var elapsed = new Date().getTime();
|
||||
var diffTime = elapsed - this.currentStart;
|
||||
if (diffTime >= opts.refresh) {
|
||||
var diffData = e.loaded - this.startData;
|
||||
var speed = diffData / diffTime; // KB per second
|
||||
opts.speedUpdated(this.index, this.file, speed);
|
||||
this.startData = e.loaded;
|
||||
this.currentStart = elapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function globalProgress() {
|
||||
if (global_progress.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var total = 0, index;
|
||||
for (index in global_progress) {
|
||||
if(global_progress.hasOwnProperty(index)) {
|
||||
total = total + global_progress[index];
|
||||
}
|
||||
}
|
||||
|
||||
opts.globalProgressUpdated(Math.round(total / global_progress.length));
|
||||
}
|
||||
|
||||
// Respond to an upload
|
||||
function upload() {
|
||||
stop_loop = false;
|
||||
|
||||
if (!files) {
|
||||
opts.error(errors[0]);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (opts.allowedfiletypes.push && opts.allowedfiletypes.length) {
|
||||
for(var fileIndex = files.length;fileIndex--;) {
|
||||
if(!files[fileIndex].type || $.inArray(files[fileIndex].type, opts.allowedfiletypes) < 0) {
|
||||
opts.error(errors[3], files[fileIndex]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var filesDone = 0,
|
||||
filesRejected = 0;
|
||||
|
||||
if (files_count > opts.maxfiles && opts.queuefiles === 0) {
|
||||
opts.error(errors[1]);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Define queues to manage upload process
|
||||
var workQueue = [];
|
||||
var processingQueue = [];
|
||||
var doneQueue = [];
|
||||
|
||||
// Add everything to the workQueue
|
||||
for (var i = 0; i < files_count; i++) {
|
||||
workQueue.push(i);
|
||||
}
|
||||
|
||||
// Helper function to enable pause of processing to wait
|
||||
// for in process queue to complete
|
||||
var pause = function(timeout) {
|
||||
setTimeout(process, timeout);
|
||||
return;
|
||||
};
|
||||
|
||||
// Process an upload, recursive
|
||||
var process = function() {
|
||||
|
||||
var fileIndex;
|
||||
|
||||
if (stop_loop) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check to see if are in queue mode
|
||||
if (opts.queuefiles > 0 && processingQueue.length >= opts.queuefiles) {
|
||||
return pause(opts.queuewait);
|
||||
} else {
|
||||
// Take first thing off work queue
|
||||
fileIndex = workQueue[0];
|
||||
workQueue.splice(0, 1);
|
||||
|
||||
// Add to processing queue
|
||||
processingQueue.push(fileIndex);
|
||||
}
|
||||
|
||||
try {
|
||||
if (beforeEach(files[fileIndex]) !== false) {
|
||||
if (fileIndex === files_count) {
|
||||
return;
|
||||
}
|
||||
var reader = new FileReader(),
|
||||
max_file_size = 1048576 * opts.maxfilesize;
|
||||
|
||||
reader.index = fileIndex;
|
||||
if (files[fileIndex].size > max_file_size) {
|
||||
opts.error(errors[2], files[fileIndex], fileIndex);
|
||||
// Remove from queue
|
||||
processingQueue.forEach(function(value, key) {
|
||||
if (value === fileIndex) {
|
||||
processingQueue.splice(key, 1);
|
||||
}
|
||||
});
|
||||
filesRejected++;
|
||||
return true;
|
||||
}
|
||||
|
||||
reader.onerror = function(e) {
|
||||
switch(e.target.error.code) {
|
||||
case e.target.error.NOT_FOUND_ERR:
|
||||
opts.error(errors[4]);
|
||||
return false;
|
||||
case e.target.error.NOT_READABLE_ERR:
|
||||
opts.error(errors[5]);
|
||||
return false;
|
||||
case e.target.error.ABORT_ERR:
|
||||
opts.error(errors[6]);
|
||||
return false;
|
||||
default:
|
||||
opts.error(errors[7]);
|
||||
return false;
|
||||
};
|
||||
};
|
||||
|
||||
reader.onloadend = !opts.beforeSend ? send : function (e) {
|
||||
opts.beforeSend(files[fileIndex], fileIndex, function () { send(e); });
|
||||
};
|
||||
if (!useBinaryUrl) {
|
||||
reader.readAsBinaryString(files[fileIndex]);
|
||||
} else {
|
||||
reader.readAsDataURL(files[fileIndex]);
|
||||
}
|
||||
|
||||
} else {
|
||||
filesRejected++;
|
||||
}
|
||||
} catch (err) {
|
||||
// Remove from queue
|
||||
processingQueue.forEach(function(value, key) {
|
||||
if (value === fileIndex) {
|
||||
processingQueue.splice(key, 1);
|
||||
}
|
||||
});
|
||||
if (window.console){ console.error(err); }
|
||||
opts.error(errors[0]);
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we still have work to do,
|
||||
if (workQueue.length > 0) {
|
||||
process();
|
||||
}
|
||||
};
|
||||
|
||||
var send = function(e) {
|
||||
|
||||
var fileIndex = ((typeof(e.srcElement) === "undefined") || e.srcElement === null? e.target : e.srcElement).index;
|
||||
|
||||
// Sometimes the index is not attached to the
|
||||
// event object. Find it by size. Hack for sure.
|
||||
if (e.target.index === undefined) {
|
||||
e.target.index = getIndexBySize(e.total);
|
||||
}
|
||||
|
||||
var xhr = new XMLHttpRequest(),
|
||||
upload = xhr.upload,
|
||||
file = files[e.target.index],
|
||||
index = e.target.index,
|
||||
start_time = new Date().getTime(),
|
||||
boundary = '------multipartformboundary' + (new Date()).getTime(),
|
||||
global_progress_index = global_progress.length,
|
||||
builder,
|
||||
newName = rename(file.name),
|
||||
mime = file.type;
|
||||
|
||||
if (opts.withCredentials) {
|
||||
xhr.withCredentials = opts.withCredentials;
|
||||
}
|
||||
|
||||
if (typeof newName === "string") {
|
||||
builder = getBuilder(newName, e.target.result, mime, boundary);
|
||||
} else {
|
||||
builder = getBuilder(file.name, e.target.result, mime, boundary);
|
||||
}
|
||||
|
||||
upload.index = index;
|
||||
upload.file = file;
|
||||
upload.downloadStartTime = start_time;
|
||||
upload.currentStart = start_time;
|
||||
upload.currentProgress = 0;
|
||||
upload.global_progress_index = global_progress_index;
|
||||
upload.startData = 0;
|
||||
upload.addEventListener("progress", progress, false);
|
||||
|
||||
// Allow url to be a method
|
||||
if (jQuery.isFunction(opts.url)) {
|
||||
xhr.open("POST", opts.url(), true);
|
||||
} else {
|
||||
xhr.open("POST", opts.url, true);
|
||||
}
|
||||
|
||||
xhr.setRequestHeader('content-type', 'multipart/form-data; boundary=' + boundary);
|
||||
|
||||
// Add headers
|
||||
$.each(opts.headers, function(k, v) {
|
||||
xhr.setRequestHeader(k, v);
|
||||
});
|
||||
|
||||
xhr.sendAsBinary(builder);
|
||||
|
||||
global_progress[global_progress_index] = 0;
|
||||
globalProgress();
|
||||
|
||||
opts.uploadStarted(index, file, files_count);
|
||||
|
||||
xhr.onload = function() {
|
||||
var serverResponse = null;
|
||||
|
||||
if (xhr.responseText) {
|
||||
try {
|
||||
serverResponse = jQuery.parseJSON(xhr.responseText);
|
||||
}
|
||||
catch (e) {
|
||||
serverResponse = xhr.responseText;
|
||||
}
|
||||
}
|
||||
|
||||
var now = new Date().getTime(),
|
||||
timeDiff = now - start_time,
|
||||
result = opts.uploadFinished(index, file, serverResponse, timeDiff, xhr);
|
||||
filesDone++;
|
||||
|
||||
// Remove from processing queue
|
||||
processingQueue.forEach(function(value, key) {
|
||||
if (value === fileIndex) {
|
||||
processingQueue.splice(key, 1);
|
||||
}
|
||||
});
|
||||
|
||||
// Add to donequeue
|
||||
doneQueue.push(fileIndex);
|
||||
|
||||
// Make sure the global progress is updated
|
||||
global_progress[global_progress_index] = 100;
|
||||
globalProgress();
|
||||
|
||||
if (filesDone === (files_count - filesRejected)) {
|
||||
afterAll();
|
||||
}
|
||||
if (result === false) {
|
||||
stop_loop = true;
|
||||
}
|
||||
|
||||
|
||||
// Pass any errors to the error option
|
||||
if (xhr.status < 200 || xhr.status > 299) {
|
||||
opts.error(xhr.statusText, file, fileIndex, xhr.status);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// Initiate the processing loop
|
||||
process();
|
||||
}
|
||||
|
||||
function getIndexBySize(size) {
|
||||
for (var i = 0; i < files_count; i++) {
|
||||
if (files[i].size === size) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function rename(name) {
|
||||
return opts.rename(name);
|
||||
}
|
||||
|
||||
function beforeEach(file) {
|
||||
return opts.beforeEach(file);
|
||||
}
|
||||
|
||||
function afterAll() {
|
||||
return opts.afterAll();
|
||||
}
|
||||
|
||||
function dragEnter(e) {
|
||||
clearTimeout(doc_leave_timer);
|
||||
e.preventDefault();
|
||||
opts.dragEnter.call(this, e);
|
||||
}
|
||||
|
||||
function dragOver(e) {
|
||||
clearTimeout(doc_leave_timer);
|
||||
e.preventDefault();
|
||||
opts.docOver.call(this, e);
|
||||
opts.dragOver.call(this, e);
|
||||
}
|
||||
|
||||
function dragLeave(e) {
|
||||
clearTimeout(doc_leave_timer);
|
||||
opts.dragLeave.call(this, e);
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function docDrop(e) {
|
||||
e.preventDefault();
|
||||
opts.docLeave.call(this, e);
|
||||
return false;
|
||||
}
|
||||
|
||||
function docEnter(e) {
|
||||
clearTimeout(doc_leave_timer);
|
||||
e.preventDefault();
|
||||
opts.docEnter.call(this, e);
|
||||
return false;
|
||||
}
|
||||
|
||||
function docOver(e) {
|
||||
clearTimeout(doc_leave_timer);
|
||||
e.preventDefault();
|
||||
opts.docOver.call(this, e);
|
||||
return false;
|
||||
}
|
||||
|
||||
function docLeave(e) {
|
||||
doc_leave_timer = setTimeout((function(_this) {
|
||||
return function() {
|
||||
opts.docLeave.call(_this, e);
|
||||
};
|
||||
})(this), 200);
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
function empty() {}
|
||||
|
||||
try {
|
||||
if (XMLHttpRequest.prototype.sendAsBinary) {
|
||||
return;
|
||||
}
|
||||
XMLHttpRequest.prototype.sendAsBinary = function(datastr) {
|
||||
function byteValue(x) {
|
||||
return x.charCodeAt(0) & 0xff;
|
||||
}
|
||||
var ords = Array.prototype.map.call(datastr, byteValue);
|
||||
var ui8a = new Uint8Array(ords);
|
||||
this.send(ui8a.buffer);
|
||||
};
|
||||
} catch (e) {}
|
||||
|
||||
})(jQuery);
|
||||
29
wp-content/plugins/wp-file-download-light/app/admin/assets/js/jquery.filedrop.min.js
vendored
Normal file
29
wp-content/plugins/wp-file-download-light/app/admin/assets/js/jquery.filedrop.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
12
wp-content/plugins/wp-file-download-light/app/admin/assets/js/jquery.gritter.min.js
vendored
Normal file
12
wp-content/plugins/wp-file-download-light/app/admin/assets/js/jquery.gritter.min.js
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Gritter for jQuery
|
||||
* http://www.boedesign.com/
|
||||
*
|
||||
* Copyright (c) 2012 Jordan Boesch
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*
|
||||
* Date: February 24, 2012
|
||||
* Version: 1.7.4
|
||||
*/
|
||||
|
||||
(function(e){e.gritter={};e.gritter.options={position:"",class_name:"",fade_in_speed:"medium",fade_out_speed:1e3,time:6e3};e.gritter.add=function(e){try{return t.add(e||{})}catch(n){var r="Gritter Error: "+n;typeof console!="undefined"&&console.error?console.error(r,e):alert(r)}};e.gritter.remove=function(e,n){t.removeSpecific(e,n||{})};e.gritter.removeAll=function(e){t.stop(e||{})};var t={position:"",fade_in_speed:"",fade_out_speed:"",time:"",_custom_timer:0,_item_count:0,_is_setup:0,_tpl_close:'<a class="gritter-close" href="#" tabindex="1">Close Notification</a>',_tpl_title:'<span class="gritter-title">[[title]]</span>',_tpl_item:'<div id="gritter-item-[[number]]" class="gritter-item-wrapper [[item_class]]" style="display:none" role="alert"><div class="gritter-item">[[close]][[image]]<div class="[[class_name]]">[[title]]<p>[[text]]</p></div><div style="clear:both"></div></div></div>',_tpl_wrap:'<div id="gritter-notice-wrapper"></div>',add:function(n){if(typeof n=="string"){n={text:n}}if(n.text===null){throw'You must supply "text" parameter.'}if(!this._is_setup){this._runSetup()}var r=n.title,i=n.text,s=n.image||"",o=n.sticky||false,u=n.class_name||e.gritter.options.class_name,a=e.gritter.options.position,f=n.time||"";this._verifyWrapper();this._item_count++;var l=this._item_count,c=this._tpl_item;e(["before_open","after_open","before_close","after_close"]).each(function(r,i){t["_"+i+"_"+l]=e.isFunction(n[i])?n[i]:function(){}});this._custom_timer=0;if(f){this._custom_timer=f}var h=s!=""?'<img src="'+s+'" class="gritter-image" />':"",p=s!=""?"gritter-with-image":"gritter-without-image";if(r){r=this._str_replace("[[title]]",r,this._tpl_title)}else{r=""}c=this._str_replace(["[[title]]","[[text]]","[[close]]","[[image]]","[[number]]","[[class_name]]","[[item_class]]"],[r,i,this._tpl_close,h,this._item_count,p,u],c);if(this["_before_open_"+l]()===false){return false}e("#gritter-notice-wrapper").addClass(a).append(c);var d=e("#gritter-item-"+this._item_count);d.fadeIn(this.fade_in_speed,function(){t["_after_open_"+l](e(this))});if(!o){this._setFadeTimer(d,l)}e(d).bind("mouseenter mouseleave",function(n){if(n.type=="mouseenter"){if(!o){t._restoreItemIfFading(e(this),l)}}else{if(!o){t._setFadeTimer(e(this),l)}}t._hoverState(e(this),n.type)});e(d).find(".gritter-close").click(function(){t.removeSpecific(l,{},null,true);return false});return l},_countRemoveWrapper:function(t,n,r){n.remove();this["_after_close_"+t](n,r);if(e(".gritter-item-wrapper").length==0){e("#gritter-notice-wrapper").remove()}},_fade:function(e,n,r,i){var r=r||{},s=typeof r.fade!="undefined"?r.fade:true,o=r.speed||this.fade_out_speed,u=i;this["_before_close_"+n](e,u);if(i){e.unbind("mouseenter mouseleave")}if(s){e.animate({opacity:0},o,function(){e.animate({height:0},300,function(){t._countRemoveWrapper(n,e,u)})})}else{this._countRemoveWrapper(n,e)}},_hoverState:function(e,t){if(t=="mouseenter"){e.addClass("hover");e.find(".gritter-close").show()}else{e.removeClass("hover");e.find(".gritter-close").hide()}},removeSpecific:function(t,n,r,i){if(!r){var r=e("#gritter-item-"+t)}this._fade(r,t,n||{},i)},_restoreItemIfFading:function(e,t){clearTimeout(this["_int_id_"+t]);e.stop().css({opacity:"",height:""})},_runSetup:function(){for(opt in e.gritter.options){this[opt]=e.gritter.options[opt]}this._is_setup=1},_setFadeTimer:function(e,n){var r=this._custom_timer?this._custom_timer:this.time;this["_int_id_"+n]=setTimeout(function(){t._fade(e,n)},r)},stop:function(t){var n=e.isFunction(t.before_close)?t.before_close:function(){};var r=e.isFunction(t.after_close)?t.after_close:function(){};var i=e("#gritter-notice-wrapper");n(i);i.fadeOut(function(){e(this).remove();r()})},_str_replace:function(e,t,n,r){var i=0,s=0,o="",u="",a=0,f=0,l=[].concat(e),c=[].concat(t),h=n,p=c instanceof Array,d=h instanceof Array;h=[].concat(h);if(r){this.window[r]=0}for(i=0,a=h.length;i<a;i++){if(h[i]===""){continue}for(s=0,f=l.length;s<f;s++){o=h[i]+"";u=p?c[s]!==undefined?c[s]:"":c[0];h[i]=o.split(l[s]).join(u);if(r&&h[i]!==o){this.window[r]+=(o.length-h[i].length)/l[s].length}}}return d?h:h[0]},_verifyWrapper:function(){if(e("#gritter-notice-wrapper").length==0){e("body").append(this._tpl_wrap)}}}})(jQuery)
|
||||
@@ -0,0 +1,124 @@
|
||||
/*!
|
||||
* jQuery imagesLoaded plugin v2.1.1
|
||||
* http://github.com/desandro/imagesloaded
|
||||
*
|
||||
* MIT License. by Paul Irish et al.
|
||||
*/
|
||||
|
||||
(function( window, $, undefined ){
|
||||
//'use strict';
|
||||
|
||||
// blank image data-uri bypasses webkit log warning (thx doug jones)
|
||||
var BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==';
|
||||
|
||||
$(document).ready(function(){
|
||||
$.fn.imagesLoaded = function( callback ) {
|
||||
var $this = this,
|
||||
deferred = $.isFunction($.Deferred) ? $.Deferred() : 0,
|
||||
hasNotify = $.isFunction(deferred.notify),
|
||||
$images = $this.find('img').add( $this.filter('img') ),
|
||||
loaded = [],
|
||||
proper = [],
|
||||
broken = [];
|
||||
|
||||
// Register deferred callbacks
|
||||
if ($.isPlainObject(callback)) {
|
||||
$.each(callback, function (key, value) {
|
||||
if (key === 'callback') {
|
||||
callback = value;
|
||||
} else if (deferred) {
|
||||
deferred[key](value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function doneLoading() {
|
||||
var $proper = $(proper),
|
||||
$broken = $(broken);
|
||||
|
||||
if ( deferred ) {
|
||||
if ( broken.length ) {
|
||||
deferred.reject( $images, $proper, $broken );
|
||||
} else {
|
||||
deferred.resolve( $images );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $.isFunction( callback ) ) {
|
||||
callback.call( $this, $images, $proper, $broken );
|
||||
}
|
||||
}
|
||||
|
||||
function imgLoadedHandler( event ) {
|
||||
imgLoaded( event.target, event.type === 'error' );
|
||||
}
|
||||
|
||||
function imgLoaded( img, isBroken ) {
|
||||
// don't proceed if BLANK image, or image is already loaded
|
||||
if ( img.src === BLANK || $.inArray( img, loaded ) !== -1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// store element in loaded images array
|
||||
loaded.push( img );
|
||||
|
||||
// keep track of broken and properly loaded images
|
||||
if ( isBroken ) {
|
||||
broken.push( img );
|
||||
} else {
|
||||
proper.push( img );
|
||||
}
|
||||
|
||||
// cache image and its state for future calls
|
||||
$.data( img, 'imagesLoaded', { isBroken: isBroken, src: img.src } );
|
||||
|
||||
// trigger deferred progress method if present
|
||||
if ( hasNotify ) {
|
||||
deferred.notifyWith( $(img), [ isBroken, $images, $(proper), $(broken) ] );
|
||||
}
|
||||
|
||||
// call doneLoading and clean listeners if all images are loaded
|
||||
if ( $images.length === loaded.length ) {
|
||||
setTimeout( doneLoading );
|
||||
$images.unbind( '.imagesLoaded', imgLoadedHandler );
|
||||
}
|
||||
}
|
||||
|
||||
// if no images, trigger immediately
|
||||
if ( !$images.length ) {
|
||||
doneLoading();
|
||||
} else {
|
||||
$images.bind( 'load.imagesLoaded error.imagesLoaded', imgLoadedHandler )
|
||||
.each( function( i, el ) {
|
||||
var src = el.src;
|
||||
|
||||
// find out if this image has been already checked for status
|
||||
// if it was, and src has not changed, call imgLoaded on it
|
||||
var cached = $.data( el, 'imagesLoaded' );
|
||||
if ( cached && cached.src === src ) {
|
||||
imgLoaded( el, cached.isBroken );
|
||||
return;
|
||||
}
|
||||
|
||||
// if complete is true and browser supports natural sizes, try
|
||||
// to check for image status manually
|
||||
if ( el.complete && el.naturalWidth !== undefined ) {
|
||||
imgLoaded( el, el.naturalWidth === 0 || el.naturalHeight === 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
// cached images don't fire load sometimes, so we reset src, but only when
|
||||
// dealing with IE, or image is complete (loaded) and failed manual check
|
||||
// webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
|
||||
if ( el.readyState || el.complete ) {
|
||||
el.src = BLANK;
|
||||
el.src = src;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return deferred ? deferred.promise( $this ) : $this;
|
||||
};
|
||||
|
||||
})})( window, jQuery );
|
||||
//});
|
||||
7
wp-content/plugins/wp-file-download-light/app/admin/assets/js/jquery.leanModal.min.js
vendored
Normal file
7
wp-content/plugins/wp-file-download-light/app/admin/assets/js/jquery.leanModal.min.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// leanModal v1.1 by Ray Stone - http://finelysliced.com.au
|
||||
// Dual licensed under the MIT and GPL
|
||||
|
||||
(function($){$.fn.extend({leanModal:function(options){var defaults={top:100,overlay:0.5,closeButton:null};var overlay=$("<div id='lean_overlay'></div>");$("body").append(overlay);options=$.extend(defaults,options);return this.each(function(){var o=options;$(this).click(function(e){var modal_id=$(this).attr("href"); if(typeof o.beforeShow =='function') {o.beforeShow(); } $("#lean_overlay").click(function(){close_modal(modal_id)});$(o.closeButton).click(function(){close_modal(modal_id)});var modal_height=$(modal_id).outerHeight();var modal_width=$(modal_id).outerWidth();
|
||||
$("#lean_overlay").css({"display":"block",opacity:0});$("#lean_overlay").fadeTo(200,o.overlay);$(modal_id).css({"visibility":"visible","display":"block","text-align":"center","position":"fixed","opacity":0,"z-index":100102,"left":50+"%","margin-left":-(modal_width/2)+"px","top":o.top+"px"}); $(modal_id).fadeTo(200,1, function(){
|
||||
if(typeof options.modalShow =='function') {options.modalShow(); }
|
||||
});e.preventDefault()})});function close_modal(modal_id){$("#lean_overlay").fadeOut(200);$(modal_id).css({"display":"none"})}}})})(jQuery);
|
||||
@@ -0,0 +1,485 @@
|
||||
/*!
|
||||
* Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/
|
||||
* Dual-licensed under the BSD or MIT licenses
|
||||
*/
|
||||
;(function($, window, document, undefined)
|
||||
{
|
||||
var hasTouch = 'ontouchstart' in window;
|
||||
|
||||
/**
|
||||
* 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,null) !== null) && 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';
|
||||
|
||||
var defaults = {
|
||||
listNodeName : 'ol',
|
||||
itemNodeName : 'li',
|
||||
rootClass : 'dd',
|
||||
listClass : 'dd-list',
|
||||
itemClass : 'dd-item',
|
||||
dragClass : 'dd-dragel',
|
||||
handleClass : 'dd-handle',
|
||||
collapsedClass : 'dd-collapsed',
|
||||
placeClass : 'dd-placeholder',
|
||||
noDragClass : 'dd-nodrag',
|
||||
emptyClass : 'dd-empty',
|
||||
expandBtnHTML : '<button data-action="expand" type="button">Expand</button>',
|
||||
collapseBtnHTML : '<button data-action="collapse" type="button">Collapse</button>',
|
||||
group : 0,
|
||||
maxDepth : 5,
|
||||
threshold : 20
|
||||
};
|
||||
|
||||
function Plugin(element, options)
|
||||
{
|
||||
this.w = $(window);
|
||||
this.el = $(element);
|
||||
this.options = $.extend({}, defaults, options);
|
||||
this.init();
|
||||
}
|
||||
|
||||
Plugin.prototype = {
|
||||
|
||||
init: function()
|
||||
{
|
||||
var list = this;
|
||||
|
||||
list.reset();
|
||||
|
||||
list.el.data('nestable-group', this.options.group);
|
||||
|
||||
list.placeEl = $('<div class="' + list.options.placeClass + '"/>');
|
||||
|
||||
$.each(this.el.find(list.options.itemNodeName), function(k, el) {
|
||||
list.setParent($(el));
|
||||
});
|
||||
|
||||
list.el.on('click', 'button', function(e) {
|
||||
if (list.dragEl || (!hasTouch && e.button !== 0)) {
|
||||
return;
|
||||
}
|
||||
var target = $(e.currentTarget),
|
||||
action = target.data('action'),
|
||||
item = target.parent(list.options.itemNodeName);
|
||||
if (action === 'collapse') {
|
||||
list.collapseItem(item);
|
||||
}
|
||||
if (action === 'expand') {
|
||||
list.expandItem(item);
|
||||
}
|
||||
});
|
||||
|
||||
var onStartEvent = function(e)
|
||||
{
|
||||
var handle = $(e.target);
|
||||
if (!handle.hasClass(list.options.handleClass)) {
|
||||
if (handle.closest('.' + list.options.noDragClass).length) {
|
||||
return;
|
||||
}
|
||||
handle = handle.closest('.' + list.options.handleClass);
|
||||
}
|
||||
if (!handle.length || list.dragEl || (!hasTouch && e.button !== 0) || (hasTouch && e.touches.length !== 1)) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
list.dragStart(hasTouch ? e.touches[0] : e);
|
||||
};
|
||||
|
||||
var onMoveEvent = function(e)
|
||||
{
|
||||
if (list.dragEl) {
|
||||
e.preventDefault();
|
||||
list.dragMove(hasTouch ? e.touches[0] : e);
|
||||
}
|
||||
};
|
||||
|
||||
var onEndEvent = function(e)
|
||||
{
|
||||
if (list.dragEl) {
|
||||
e.preventDefault();
|
||||
list.dragStop(hasTouch ? e.touches[0] : e);
|
||||
}
|
||||
};
|
||||
|
||||
if (hasTouch) {
|
||||
list.el[0].addEventListener(eStart, onStartEvent, false);
|
||||
window.addEventListener(eMove, onMoveEvent, false);
|
||||
window.addEventListener(eEnd, onEndEvent, false);
|
||||
window.addEventListener(eCancel, onEndEvent, false);
|
||||
} else {
|
||||
list.el.on(eStart, onStartEvent);
|
||||
list.w.on(eMove, onMoveEvent);
|
||||
list.w.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.el.find(list.options.listNodeName).first(), depth);
|
||||
return data;
|
||||
},
|
||||
|
||||
serialise: function()
|
||||
{
|
||||
return this.serialize();
|
||||
},
|
||||
|
||||
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;
|
||||
},
|
||||
|
||||
expandItem: function(li)
|
||||
{
|
||||
li.removeClass(this.options.collapsedClass);
|
||||
li.children('[data-action="expand"]').hide();
|
||||
li.children('[data-action="collapse"]').show();
|
||||
li.children(this.options.listNodeName).show();
|
||||
},
|
||||
|
||||
collapseItem: function(li)
|
||||
{
|
||||
var lists = li.children(this.options.listNodeName);
|
||||
if (lists.length) {
|
||||
li.addClass(this.options.collapsedClass);
|
||||
li.children('[data-action="collapse"]').hide();
|
||||
li.children('[data-action="expand"]').show();
|
||||
li.children(this.options.listNodeName).hide();
|
||||
}
|
||||
},
|
||||
|
||||
expandAll: function()
|
||||
{
|
||||
var list = this;
|
||||
list.el.find(list.options.itemNodeName).each(function() {
|
||||
list.expandItem($(this));
|
||||
});
|
||||
},
|
||||
|
||||
collapseAll: function()
|
||||
{
|
||||
var list = this;
|
||||
list.el.find(list.options.itemNodeName).each(function() {
|
||||
list.collapseItem($(this));
|
||||
});
|
||||
},
|
||||
|
||||
setParent: function(li)
|
||||
{
|
||||
if (li.children(this.options.listNodeName).length) {
|
||||
li.prepend($(this.options.expandBtnHTML));
|
||||
li.prepend($(this.options.collapseBtnHTML));
|
||||
}
|
||||
li.children('[data-action="expand"]').hide();
|
||||
},
|
||||
|
||||
unsetParent: function(li)
|
||||
{
|
||||
li.removeClass(this.options.collapsedClass);
|
||||
li.children('[data-action]').remove();
|
||||
li.children(this.options.listNodeName).remove();
|
||||
},
|
||||
|
||||
dragStart: function(e)
|
||||
{
|
||||
var mouse = this.mouse,
|
||||
target = $(e.target),
|
||||
dragItem = target.closest(this.options.itemNodeName);
|
||||
|
||||
this.placeEl.css('height', dragItem.height());
|
||||
|
||||
mouse.offsetX = e.offsetX !== undefined ? e.offsetX : e.pageX - target.offset().left;
|
||||
mouse.offsetY = e.offsetY !== undefined ? e.offsetY : e.pageY - target.offset().top;
|
||||
mouse.startX = mouse.lastX = e.pageX;
|
||||
mouse.startY = mouse.lastY = e.pageY;
|
||||
|
||||
this.dragRootEl = this.el;
|
||||
|
||||
this.dragEl = $(document.createElement(this.options.listNodeName)).addClass(this.options.listClass + ' ' + this.options.dragClass);
|
||||
this.dragEl.css('width', dragItem.width());
|
||||
|
||||
// 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' : e.pageX - mouse.offsetX,
|
||||
'top' : e.pageY - mouse.offsetY
|
||||
});
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
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();
|
||||
this.el.trigger('change',el);
|
||||
if (this.hasNewRoot) {
|
||||
this.dragRootEl.trigger('change',el);
|
||||
}
|
||||
this.reset();
|
||||
},
|
||||
|
||||
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.parent(opt.itemNodeName);
|
||||
}
|
||||
if (this.pointEl.hasClass(opt.emptyClass)) {
|
||||
isEmpty = true;
|
||||
}
|
||||
else if (!this.pointEl.length || !this.pointEl.hasClass(opt.itemClass)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// find parent list of item under cursor
|
||||
var pointElRoot = this.pointEl.closest('.' + opt.rootClass),
|
||||
isNewRoot = this.dragRootEl.data('nestable-id') !== pointElRoot.data('nestable-id');
|
||||
|
||||
/**
|
||||
* move vertical
|
||||
*/
|
||||
if (!mouse.dirAx || isNewRoot || isEmpty) {
|
||||
// check if groups match if dragging over new root
|
||||
if (isNewRoot && opt.group !== pointElRoot.data('nestable-group')) {
|
||||
return;
|
||||
}
|
||||
// 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) {
|
||||
list = $(document.createElement(opt.listNodeName)).addClass(opt.listClass);
|
||||
list.append(this.placeEl);
|
||||
this.pointEl.replaceWith(list);
|
||||
}
|
||||
else if (before) {
|
||||
this.pointEl.before(this.placeEl);
|
||||
}
|
||||
else {
|
||||
this.pointEl.after(this.placeEl);
|
||||
}
|
||||
if (!parent.children().length) {
|
||||
this.unsetParent(parent.parent());
|
||||
}
|
||||
if (!this.dragRootEl.find(opt.itemNodeName).length) {
|
||||
this.dragRootEl.append('<div class="' + opt.emptyClass + '"/>');
|
||||
}
|
||||
// parent root list has changed
|
||||
if (isNewRoot) {
|
||||
this.dragRootEl = pointElRoot;
|
||||
this.hasNewRoot = this.el[0] !== this.dragRootEl[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$.fn.nestable = function(params)
|
||||
{
|
||||
var lists = this,
|
||||
retval = this;
|
||||
|
||||
lists.each(function()
|
||||
{
|
||||
var plugin = $(this).data("nestable");
|
||||
|
||||
if (!plugin) {
|
||||
$(this).data("nestable", new Plugin(this, params));
|
||||
$(this).data("nestable-id", new Date().getTime());
|
||||
} else {
|
||||
if (typeof params === 'string' && typeof plugin[params] === 'function') {
|
||||
retval = plugin[params]();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return retval || lists;
|
||||
};
|
||||
|
||||
})(window.jQuery || window.Zepto, window, document);
|
||||
@@ -0,0 +1,238 @@
|
||||
/*!
|
||||
* resTable
|
||||
* jQuery responsive Tables Plugin
|
||||
* author: Damien Barrère
|
||||
* company : Joomunited
|
||||
* version : 1.0.0
|
||||
* licence : MIT license
|
||||
*/
|
||||
|
||||
|
||||
;(function ( $, window, document, undefined ) {
|
||||
// Create the defaults once
|
||||
var pluginName = "restable",
|
||||
defaults = {
|
||||
type : 'default',
|
||||
priority : {}, //{0:1,1:2,2:'persistent'} col0 with priority 0, col with priority 2 and col 2 always shown
|
||||
selectCol : true,
|
||||
hideColsDefault : []
|
||||
};
|
||||
|
||||
var instancesCount = 0;
|
||||
|
||||
// The actual plugin constructor
|
||||
function Plugin( element, options ) {
|
||||
this.element = element;
|
||||
|
||||
// jQuery has an extend method that merges the
|
||||
this.options = $.extend( {}, defaults, options) ;
|
||||
|
||||
this._defaults = defaults;
|
||||
this._name = pluginName;
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
Plugin.prototype = {
|
||||
|
||||
init: function() {
|
||||
$(this.element).wrap('<div class="restableOverflow restable'+this.options.type.capitalize()+'">');
|
||||
this.wrapper = $(this.element).parent();
|
||||
this.enable();
|
||||
},
|
||||
|
||||
yourOtherFunction: function() {
|
||||
$(this).css(arguments[0],arguments[1]);
|
||||
},
|
||||
|
||||
enable : function(){
|
||||
switch (this.options.type){
|
||||
case 'hideCols':
|
||||
this._enableHideCols();
|
||||
break;
|
||||
default:
|
||||
this._enableDefault();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Enable the default type
|
||||
* The table is wrapped and a scrollbar is shown
|
||||
*/
|
||||
_enableDefault : function(){
|
||||
var checkO = function(element,wrapper){
|
||||
if(checkOverflow(element,wrapper)){
|
||||
$(wrapper).addClass('restableOverflowShow');
|
||||
}else{
|
||||
$(wrapper).removeClass('restableOverflowShow');
|
||||
}
|
||||
};
|
||||
var that = this;
|
||||
$( window ).resize(function() {
|
||||
checkO(that.element,that.wrapper);
|
||||
});
|
||||
checkO(this.element,this.wrapper);
|
||||
},
|
||||
|
||||
/**
|
||||
* Enable the show/hide cols type
|
||||
* Columns will be shown depending on their priority
|
||||
*/
|
||||
_enableHideCols : function(){
|
||||
var priorities = [];
|
||||
$.each(this.options.priority,function(index,value){
|
||||
if(typeof(priorities[value])==='undefined'){
|
||||
priorities[value]=[];
|
||||
}
|
||||
priorities[value].push(index);
|
||||
});
|
||||
if(typeof(priorities[0])==='undefined'){
|
||||
priorities[0]=[];
|
||||
}
|
||||
that = this;
|
||||
$.each($(this.element).find('tr,th').first().find('td,th'),function(index){
|
||||
if(typeof(that.options.priority[index])==='undefined'){
|
||||
priorities[0].push(index);
|
||||
}
|
||||
});
|
||||
|
||||
//init columns selection box
|
||||
if(this.options.selectCol===true){
|
||||
colHtml = '<div class="restableMenu restableMenuClosed" id="restableMenu'+instancesCount+'"><a class="restableMenuButton" href="#"><i class="material-icons">filter_list</i></a><ul>';
|
||||
cols = $(this.element).find('tr:first-child th');
|
||||
if(cols.length===0){
|
||||
cols = $(this.element).find('tr:first-child td');
|
||||
}
|
||||
|
||||
cols.each(function(index){
|
||||
var checked = 'checked="checked"';
|
||||
var $this = $(this);
|
||||
if ($.inArray(index, that.options.hideColsDefault)) {
|
||||
if (!$this.find('a').hasClass('currentOrderingCol')) {
|
||||
checked = '';
|
||||
}
|
||||
}
|
||||
colHtml += '<li>';
|
||||
colHtml += '<input type="checkbox" name="restable-toggle-cols" id="restable-toggle-col-'+index+'-'+instancesCount+'" data-col="'+index+'" '+checked+'>';
|
||||
colHtml += $(this).text() || "#";
|
||||
colHtml += '</li>';
|
||||
});
|
||||
colHtml += '</ul></div>';
|
||||
this.wrapper.prepend(colHtml);
|
||||
}
|
||||
|
||||
|
||||
//check overflow and hide cols
|
||||
var checkO = function(element,wrapper){
|
||||
$(element).find('th,td').css('display','');
|
||||
$(wrapper).find('.restableMenu ul input').prop('checked',true);
|
||||
if(checkOverflow(element,wrapper)){
|
||||
var doBreak = false;
|
||||
for(ip in priorities){
|
||||
if(ip==='persistent'){
|
||||
//we never hide persistent cols
|
||||
break;
|
||||
}
|
||||
$.each(priorities[ip],function(index,value){
|
||||
$(element).find('th:nth-child('+(parseInt(value)+1)+'),td:nth-child('+(parseInt(value)+1)+')').css('display','none');
|
||||
$(wrapper).find('.restableMenu ul li:nth-child('+(parseInt(value)+1)+') input').prop('checked',false);
|
||||
if(!checkOverflow(element,wrapper)){
|
||||
doBreak = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if(doBreak===true){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
var that = this;
|
||||
$( window ).resize(function() {
|
||||
checkO(that.element,that.wrapper);
|
||||
});
|
||||
checkO(this.element,this.wrapper);
|
||||
|
||||
//Open the cols selection box
|
||||
$(this.wrapper).find('.restableMenuButton').click(function() {
|
||||
if($(this).parents('.restableMenu').hasClass('restableMenuClosed')){
|
||||
$(this).parents('.restableMenu').removeClass('restableMenuClosed');
|
||||
$('.wpfd-filter-file').css('right','115px');
|
||||
}else{
|
||||
$(this).parents('.restableMenu').addClass('restableMenuClosed');
|
||||
$('.wpfd-filter-file').css('right','55px');
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$(document).click(function(event){
|
||||
if(!$(event.target).parents('.restableMenu').length){
|
||||
$(that.wrapper).find('.restableMenu').addClass('restableMenuClosed');
|
||||
}
|
||||
});
|
||||
//Select a column to see or not
|
||||
$(this.wrapper).find('.restableMenu ul li').click(function(event){
|
||||
if($(event.target).is('input')){
|
||||
$(event.target).prop('checked',!$(event.target).prop('checked'));
|
||||
}
|
||||
var input = $(this).find('input');
|
||||
|
||||
var col = input.data('col')+1;
|
||||
if(input.prop('checked')){
|
||||
$(that.element).find('th:nth-child('+col+'),td:nth-child('+col+')').css('display','none');
|
||||
input.prop('checked',false);
|
||||
}else{
|
||||
$(that.element).find('th:nth-child('+col+'),td:nth-child('+col+')').css('display','table-cell');
|
||||
input.prop('checked',true);
|
||||
}
|
||||
});
|
||||
// hide columns by default
|
||||
$.each(that.options.hideColsDefault, function(idx, value) {
|
||||
|
||||
var target = $(that.element).find('th:nth-child('+(value+1)+')').find('a');
|
||||
if (!target.hasClass('currentOrderingCol')) {
|
||||
var input = $(that.wrapper).find('.restableMenu ul li input[data-col="'+value+'"]');
|
||||
input.prop('checked',false);
|
||||
$(that.element).find('th:nth-child('+(value+1)+'),td:nth-child('+(value+1)+')').css('display','none');
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the table overflow
|
||||
* @returns true if table is overflow, false otherwise
|
||||
*/
|
||||
checkOverflow = function(el,wrapper){
|
||||
if($(el).outerWidth() > $(wrapper).width()){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// A really lightweight plugin wrapper around the constructor,
|
||||
// preventing against multiple instantiations
|
||||
$.fn[pluginName] = function ( method ) {
|
||||
args = arguments
|
||||
|
||||
return this.each(function () {
|
||||
if (!$.data(this, "plugin_" + pluginName)) {
|
||||
$.data(this, "plugin_" + pluginName,
|
||||
new Plugin( this, method ));
|
||||
}else{
|
||||
var plugin = $.data(this, "plugin_" + pluginName);
|
||||
if ( plugin[method] ) {
|
||||
return plugin[method].apply( this, Array.prototype.slice.call(args,1));
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
})( jQuery, window, document );
|
||||
|
||||
String.prototype.capitalize = function() {
|
||||
return this.charAt(0).toUpperCase() + this.slice(1);
|
||||
}
|
||||
@@ -0,0 +1,591 @@
|
||||
/*
|
||||
* jQuery UI Tag-it!
|
||||
*
|
||||
* @version v2.0 (06/2011)
|
||||
*
|
||||
* Copyright 2011, Levy Carneiro Jr.
|
||||
* Released under the MIT license.
|
||||
* http://aehlke.github.com/tag-it/LICENSE
|
||||
*
|
||||
* Homepage:
|
||||
* http://aehlke.github.com/tag-it/
|
||||
*
|
||||
* Authors:
|
||||
* Levy Carneiro Jr.
|
||||
* Martin Rehfeld
|
||||
* Tobias Schmidt
|
||||
* Skylar Challand
|
||||
* Alex Ehlke
|
||||
*
|
||||
* Maintainer:
|
||||
* Alex Ehlke - Twitter: @aehlke
|
||||
*
|
||||
* Dependencies:
|
||||
* jQuery v1.4+
|
||||
* jQuery UI v1.8+
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
$.widget('ui.tagit', {
|
||||
options: {
|
||||
allowDuplicates : false,
|
||||
caseSensitive : true,
|
||||
fieldName : 'tags',
|
||||
placeholderText : null, // Sets `placeholder` attr on input field.
|
||||
readOnly : false, // Disables editing.
|
||||
removeConfirmation: false, // Require confirmation to remove tags.
|
||||
tagLimit : null, // Max number of tags allowed (null for unlimited).
|
||||
|
||||
// Used for autocomplete, unless you override `autocomplete.source`.
|
||||
availableTags : [],
|
||||
|
||||
// Use to override or add any options to the autocomplete widget.
|
||||
//
|
||||
// By default, autocomplete.source will map to availableTags,
|
||||
// unless overridden.
|
||||
autocomplete: {},
|
||||
|
||||
// Shows autocomplete before the user even types anything.
|
||||
showAutocompleteOnFocus: false,
|
||||
|
||||
// When enabled, quotes are unneccesary for inputting multi-word tags.
|
||||
allowSpaces: false,
|
||||
|
||||
// The below options are for using a single field instead of several
|
||||
// for our form values.
|
||||
//
|
||||
// When enabled, will use a single hidden field for the form,
|
||||
// rather than one per tag. It will delimit tags in the field
|
||||
// with singleFieldDelimiter.
|
||||
//
|
||||
// The easiest way to use singleField is to just instantiate tag-it
|
||||
// on an INPUT element, in which case singleField is automatically
|
||||
// set to true, and singleFieldNode is set to that element. This
|
||||
// way, you don't need to fiddle with these options.
|
||||
singleField: false,
|
||||
|
||||
// This is just used when preloading data from the field, and for
|
||||
// populating the field with delimited tags as the user adds them.
|
||||
singleFieldDelimiter: ',',
|
||||
|
||||
// Set this to an input DOM node to use an existing form field.
|
||||
// Any text in it will be erased on init. But it will be
|
||||
// populated with the text of tags as they are created,
|
||||
// delimited by singleFieldDelimiter.
|
||||
//
|
||||
// If this is not set, we create an input node for it,
|
||||
// with the name given in settings.fieldName.
|
||||
singleFieldNode: null,
|
||||
|
||||
// Whether to animate tag removals or not.
|
||||
animate: true,
|
||||
|
||||
// Optionally set a tabindex attribute on the input that gets
|
||||
// created for tag-it.
|
||||
tabIndex: null,
|
||||
|
||||
// Event callbacks.
|
||||
beforeTagAdded : null,
|
||||
afterTagAdded : null,
|
||||
|
||||
beforeTagRemoved : null,
|
||||
afterTagRemoved : null,
|
||||
|
||||
onTagClicked : null,
|
||||
onTagLimitExceeded : null,
|
||||
|
||||
|
||||
// DEPRECATED:
|
||||
//
|
||||
// /!\ These event callbacks are deprecated and WILL BE REMOVED at some
|
||||
// point in the future. They're here for backwards-compatibility.
|
||||
// Use the above before/after event callbacks instead.
|
||||
onTagAdded : null,
|
||||
onTagRemoved: null,
|
||||
// `autocomplete.source` is the replacement for tagSource.
|
||||
tagSource: null
|
||||
// Do not use the above deprecated options.
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
// for handling static scoping inside callbacks
|
||||
var that = this;
|
||||
|
||||
// There are 2 kinds of DOM nodes this widget can be instantiated on:
|
||||
// 1. UL, OL, or some element containing either of these.
|
||||
// 2. INPUT, in which case 'singleField' is overridden to true,
|
||||
// a UL is created and the INPUT is hidden.
|
||||
if (this.element.is('input')) {
|
||||
this.tagList = $('<ul></ul>').insertAfter(this.element);
|
||||
this.options.singleField = true;
|
||||
this.options.singleFieldNode = this.element;
|
||||
this.element.addClass('tagit-hidden-field');
|
||||
} else {
|
||||
this.tagList = this.element.find('ul, ol').andSelf().last();
|
||||
}
|
||||
|
||||
this.tagInput = $('<input type="text" />').addClass('ui-widget-content');
|
||||
|
||||
if (this.options.readOnly) this.tagInput.attr('disabled', 'disabled');
|
||||
|
||||
if (this.options.tabIndex) {
|
||||
this.tagInput.attr('tabindex', this.options.tabIndex);
|
||||
}
|
||||
|
||||
if (this.options.placeholderText) {
|
||||
this.tagInput.attr('placeholder', this.options.placeholderText);
|
||||
}
|
||||
|
||||
if (!this.options.autocomplete.source) {
|
||||
this.options.autocomplete.source = function(search, showChoices) {
|
||||
var filter = search.term.toLowerCase();
|
||||
var choices = $.grep(this.options.availableTags, function(element) {
|
||||
// Only match autocomplete options that begin with the search term.
|
||||
// (Case insensitive.)
|
||||
return (element.toLowerCase().indexOf(filter) === 0);
|
||||
});
|
||||
if (!this.options.allowDuplicates) {
|
||||
choices = this._subtractArray(choices, this.assignedTags());
|
||||
}
|
||||
showChoices(choices);
|
||||
};
|
||||
}
|
||||
|
||||
if (this.options.showAutocompleteOnFocus) {
|
||||
this.tagInput.focus(function(event, ui) {
|
||||
that._showAutocomplete();
|
||||
});
|
||||
|
||||
if (typeof this.options.autocomplete.minLength === 'undefined') {
|
||||
this.options.autocomplete.minLength = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Bind autocomplete.source callback functions to this context.
|
||||
if ($.isFunction(this.options.autocomplete.source)) {
|
||||
this.options.autocomplete.source = $.proxy(this.options.autocomplete.source, this);
|
||||
}
|
||||
|
||||
// DEPRECATED.
|
||||
if ($.isFunction(this.options.tagSource)) {
|
||||
this.options.tagSource = $.proxy(this.options.tagSource, this);
|
||||
}
|
||||
|
||||
this.tagList
|
||||
.addClass('tagit')
|
||||
.addClass('ui-widget ui-widget-content ui-corner-all')
|
||||
// Create the input field.
|
||||
.append($('<li class="tagit-new"></li>').append(this.tagInput))
|
||||
.click(function(e) {
|
||||
var target = $(e.target);
|
||||
if (target.hasClass('tagit-label')) {
|
||||
var tag = target.closest('.tagit-choice');
|
||||
if (!tag.hasClass('removed')) {
|
||||
that._trigger('onTagClicked', e, {tag: tag, tagLabel: that.tagLabel(tag)});
|
||||
}
|
||||
} else {
|
||||
// Sets the focus() to the input field, if the user
|
||||
// clicks anywhere inside the UL. This is needed
|
||||
// because the input field needs to be of a small size.
|
||||
that.tagInput.focus();
|
||||
}
|
||||
});
|
||||
|
||||
// Single field support.
|
||||
var addedExistingFromSingleFieldNode = false;
|
||||
if (this.options.singleField) {
|
||||
if (this.options.singleFieldNode) {
|
||||
// Add existing tags from the input field.
|
||||
var node = $(this.options.singleFieldNode);
|
||||
var tags = node.val().split(this.options.singleFieldDelimiter);
|
||||
node.val('');
|
||||
$.each(tags, function(index, tag) {
|
||||
that.createTag(tag, null, true);
|
||||
addedExistingFromSingleFieldNode = true;
|
||||
});
|
||||
} else {
|
||||
// Create our single field input after our list.
|
||||
this.options.singleFieldNode = $('<input type="hidden" style="display:none;" value="" name="' + this.options.fieldName + '" />');
|
||||
this.tagList.after(this.options.singleFieldNode);
|
||||
}
|
||||
}
|
||||
|
||||
// Add existing tags from the list, if any.
|
||||
if (!addedExistingFromSingleFieldNode) {
|
||||
this.tagList.children('li').each(function() {
|
||||
if (!$(this).hasClass('tagit-new')) {
|
||||
that.createTag($(this).text(), $(this).attr('class'), true);
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Events.
|
||||
this.tagInput
|
||||
.keydown(function(event) {
|
||||
// Backspace is not detected within a keypress, so it must use keydown.
|
||||
if (event.which == $.ui.keyCode.BACKSPACE && that.tagInput.val() === '') {
|
||||
var tag = that._lastTag();
|
||||
if (!that.options.removeConfirmation || tag.hasClass('remove')) {
|
||||
// When backspace is pressed, the last tag is deleted.
|
||||
that.removeTag(tag);
|
||||
} else if (that.options.removeConfirmation) {
|
||||
tag.addClass('remove ui-state-highlight');
|
||||
}
|
||||
} else if (that.options.removeConfirmation) {
|
||||
that._lastTag().removeClass('remove ui-state-highlight');
|
||||
}
|
||||
|
||||
// Comma/Space/Enter are all valid delimiters for new tags,
|
||||
// except when there is an open quote or if setting allowSpaces = true.
|
||||
// Tab will also create a tag, unless the tag input is empty,
|
||||
// in which case it isn't caught.
|
||||
if (
|
||||
(event.which === $.ui.keyCode.COMMA && event.shiftKey === false) ||
|
||||
event.which === $.ui.keyCode.ENTER ||
|
||||
(
|
||||
event.which == $.ui.keyCode.TAB &&
|
||||
that.tagInput.val() !== ''
|
||||
) ||
|
||||
(
|
||||
event.which == $.ui.keyCode.SPACE &&
|
||||
that.options.allowSpaces !== true &&
|
||||
(
|
||||
$.trim(that.tagInput.val()).replace( /^s*/, '' ).charAt(0) != '"' ||
|
||||
(
|
||||
$.trim(that.tagInput.val()).charAt(0) == '"' &&
|
||||
$.trim(that.tagInput.val()).charAt($.trim(that.tagInput.val()).length - 1) == '"' &&
|
||||
$.trim(that.tagInput.val()).length - 1 !== 0
|
||||
)
|
||||
)
|
||||
)
|
||||
) {
|
||||
// Enter submits the form if there's no text in the input.
|
||||
if (!(event.which === $.ui.keyCode.ENTER && that.tagInput.val() === '')) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
// Autocomplete will create its own tag from a selection and close automatically.
|
||||
if (!(that.options.autocomplete.autoFocus && that.tagInput.data('autocomplete-open'))) {
|
||||
that.tagInput.autocomplete('close');
|
||||
that.createTag(that._cleanedInput());
|
||||
}
|
||||
}
|
||||
}).blur(function(e){
|
||||
// Create a tag when the element loses focus.
|
||||
// If autocomplete is enabled and suggestion was clicked, don't add it.
|
||||
if (!that.tagInput.data('autocomplete-open')) {
|
||||
that.createTag(that._cleanedInput());
|
||||
}
|
||||
});
|
||||
|
||||
// Autocomplete.
|
||||
if (this.options.availableTags || this.options.tagSource || this.options.autocomplete.source) {
|
||||
var autocompleteOptions = {
|
||||
select: function(event, ui) {
|
||||
that.createTag(ui.item.value);
|
||||
// Preventing the tag input to be updated with the chosen value.
|
||||
return false;
|
||||
}
|
||||
};
|
||||
$.extend(autocompleteOptions, this.options.autocomplete);
|
||||
|
||||
// tagSource is deprecated, but takes precedence here since autocomplete.source is set by default,
|
||||
// while tagSource is left null by default.
|
||||
autocompleteOptions.source = this.options.tagSource || autocompleteOptions.source;
|
||||
|
||||
this.tagInput.autocomplete(autocompleteOptions).bind('autocompleteopen.tagit', function(event, ui) {
|
||||
that.tagInput.data('autocomplete-open', true);
|
||||
}).bind('autocompleteclose.tagit', function(event, ui) {
|
||||
that.tagInput.data('autocomplete-open', false);
|
||||
});
|
||||
|
||||
this.tagInput.autocomplete('widget').addClass('tagit-autocomplete');
|
||||
}
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
$.Widget.prototype.destroy.call(this);
|
||||
|
||||
this.element.unbind('.tagit');
|
||||
this.tagList.unbind('.tagit');
|
||||
|
||||
this.tagInput.removeData('autocomplete-open');
|
||||
|
||||
this.tagList.removeClass([
|
||||
'tagit',
|
||||
'ui-widget',
|
||||
'ui-widget-content',
|
||||
'ui-corner-all',
|
||||
'tagit-hidden-field'
|
||||
].join(' '));
|
||||
|
||||
if (this.element.is('input')) {
|
||||
this.element.removeClass('tagit-hidden-field');
|
||||
this.tagList.remove();
|
||||
} else {
|
||||
this.element.children('li').each(function() {
|
||||
if ($(this).hasClass('tagit-new')) {
|
||||
$(this).remove();
|
||||
} else {
|
||||
$(this).removeClass([
|
||||
'tagit-choice',
|
||||
'ui-widget-content',
|
||||
'ui-state-default',
|
||||
'ui-state-highlight',
|
||||
'ui-corner-all',
|
||||
'remove',
|
||||
'tagit-choice-editable',
|
||||
'tagit-choice-read-only'
|
||||
].join(' '));
|
||||
|
||||
$(this).text($(this).children('.tagit-label').text());
|
||||
}
|
||||
});
|
||||
|
||||
if (this.singleFieldNode) {
|
||||
this.singleFieldNode.remove();
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
_cleanedInput: function() {
|
||||
// Returns the contents of the tag input, cleaned and ready to be passed to createTag
|
||||
return $.trim(this.tagInput.val().replace(/^"(.*)"$/, '$1'));
|
||||
},
|
||||
|
||||
_lastTag: function() {
|
||||
return this.tagList.find('.tagit-choice:last:not(.removed)');
|
||||
},
|
||||
|
||||
_tags: function() {
|
||||
return this.tagList.find('.tagit-choice:not(.removed)');
|
||||
},
|
||||
|
||||
assignedTags: function() {
|
||||
// Returns an array of tag string values
|
||||
var that = this;
|
||||
var tags = [];
|
||||
if (this.options.singleField) {
|
||||
tags = $(this.options.singleFieldNode).val().split(this.options.singleFieldDelimiter);
|
||||
if (tags[0] === '') {
|
||||
tags = [];
|
||||
}
|
||||
} else {
|
||||
this._tags().each(function() {
|
||||
tags.push(that.tagLabel(this));
|
||||
});
|
||||
}
|
||||
return tags;
|
||||
},
|
||||
|
||||
_updateSingleTagsField: function(tags) {
|
||||
// Takes a list of tag string values, updates this.options.singleFieldNode.val to the tags delimited by this.options.singleFieldDelimiter
|
||||
$(this.options.singleFieldNode).val(tags.join(this.options.singleFieldDelimiter)).trigger('change');
|
||||
},
|
||||
|
||||
_subtractArray: function(a1, a2) {
|
||||
var result = [];
|
||||
for (var i = 0; i < a1.length; i++) {
|
||||
if ($.inArray(a1[i], a2) == -1) {
|
||||
result.push(a1[i]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
tagLabel: function(tag) {
|
||||
// Returns the tag's string label.
|
||||
if (this.options.singleField) {
|
||||
return $(tag).find('.tagit-label:first').text();
|
||||
} else {
|
||||
return $(tag).find('input:first').val();
|
||||
}
|
||||
},
|
||||
|
||||
_showAutocomplete: function() {
|
||||
this.tagInput.autocomplete('search', '');
|
||||
},
|
||||
|
||||
_findTagByLabel: function(name) {
|
||||
var that = this;
|
||||
var tag = null;
|
||||
this._tags().each(function(i) {
|
||||
if (that._formatStr(name) == that._formatStr(that.tagLabel(this))) {
|
||||
tag = $(this);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return tag;
|
||||
},
|
||||
|
||||
_isNew: function(name) {
|
||||
return !this._findTagByLabel(name);
|
||||
},
|
||||
|
||||
_formatStr: function(str) {
|
||||
if (this.options.caseSensitive) {
|
||||
return str;
|
||||
}
|
||||
return $.trim(str.toLowerCase());
|
||||
},
|
||||
|
||||
_effectExists: function(name) {
|
||||
return Boolean($.effects && ($.effects[name] || ($.effects.effect && $.effects.effect[name])));
|
||||
},
|
||||
|
||||
createTag: function(value, additionalClass, duringInitialization) {
|
||||
var that = this;
|
||||
|
||||
value = $.trim(value);
|
||||
|
||||
if(this.options.preprocessTag) {
|
||||
value = this.options.preprocessTag(value);
|
||||
}
|
||||
|
||||
if (value === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.options.allowDuplicates && !this._isNew(value)) {
|
||||
var existingTag = this._findTagByLabel(value);
|
||||
if (this._trigger('onTagExists', null, {
|
||||
existingTag: existingTag,
|
||||
duringInitialization: duringInitialization
|
||||
}) !== false) {
|
||||
if (this._effectExists('highlight')) {
|
||||
existingTag.effect('highlight');
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.options.tagLimit && this._tags().length >= this.options.tagLimit) {
|
||||
this._trigger('onTagLimitExceeded', null, {duringInitialization: duringInitialization});
|
||||
return false;
|
||||
}
|
||||
|
||||
var label = $(this.options.onTagClicked ? '<a class="tagit-label"></a>' : '<span class="tagit-label"></span>').text(value);
|
||||
|
||||
// Create tag.
|
||||
var tag = $('<li></li>')
|
||||
.addClass('tagit-choice ui-widget-content ui-state-default ui-corner-all')
|
||||
.addClass(additionalClass)
|
||||
.append(label);
|
||||
|
||||
if (this.options.readOnly){
|
||||
tag.addClass('tagit-choice-read-only');
|
||||
} else {
|
||||
tag.addClass('tagit-choice-editable');
|
||||
// Button for removing the tag.
|
||||
var removeTagIcon = $('<span></span>')
|
||||
.addClass('ui-icon ui-icon-close');
|
||||
var removeTag = $('<a><span class="text-icon">\xd7</span></a>') // \xd7 is an X
|
||||
.addClass('tagit-close')
|
||||
.append(removeTagIcon)
|
||||
.click(function(e) {
|
||||
// Removes a tag when the little 'x' is clicked.
|
||||
that.removeTag(tag);
|
||||
});
|
||||
tag.append(removeTag);
|
||||
}
|
||||
|
||||
// Unless options.singleField is set, each tag has a hidden input field inline.
|
||||
if (!this.options.singleField) {
|
||||
var escapedValue = label.html();
|
||||
tag.append('<input type="hidden" value="' + escapedValue + '" name="' + this.options.fieldName + '" class="tagit-hidden-field" />');
|
||||
}
|
||||
|
||||
if (this._trigger('beforeTagAdded', null, {
|
||||
tag: tag,
|
||||
tagLabel: this.tagLabel(tag),
|
||||
duringInitialization: duringInitialization
|
||||
}) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.options.singleField) {
|
||||
var tags = this.assignedTags();
|
||||
tags.push(value);
|
||||
this._updateSingleTagsField(tags);
|
||||
}
|
||||
|
||||
// DEPRECATED.
|
||||
this._trigger('onTagAdded', null, tag);
|
||||
|
||||
this.tagInput.val('');
|
||||
|
||||
// Insert tag.
|
||||
this.tagInput.parent().before(tag);
|
||||
|
||||
this._trigger('afterTagAdded', null, {
|
||||
tag: tag,
|
||||
tagLabel: this.tagLabel(tag),
|
||||
duringInitialization: duringInitialization
|
||||
});
|
||||
|
||||
if (this.options.showAutocompleteOnFocus && !duringInitialization) {
|
||||
setTimeout(function () { that._showAutocomplete(); }, 0);
|
||||
}
|
||||
},
|
||||
|
||||
removeTag: function(tag, animate) {
|
||||
animate = typeof animate === 'undefined' ? this.options.animate : animate;
|
||||
|
||||
tag = $(tag);
|
||||
|
||||
// DEPRECATED.
|
||||
this._trigger('onTagRemoved', null, tag);
|
||||
|
||||
if (this._trigger('beforeTagRemoved', null, {tag: tag, tagLabel: this.tagLabel(tag)}) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.options.singleField) {
|
||||
var tags = this.assignedTags();
|
||||
var removedTagLabel = this.tagLabel(tag);
|
||||
tags = $.grep(tags, function(el){
|
||||
return el != removedTagLabel;
|
||||
});
|
||||
this._updateSingleTagsField(tags);
|
||||
}
|
||||
|
||||
if (animate) {
|
||||
tag.addClass('removed'); // Excludes this tag from _tags.
|
||||
var hide_args = this._effectExists('blind') ? ['blind', {direction: 'horizontal'}, 'fast'] : ['fast'];
|
||||
|
||||
var thisTag = this;
|
||||
hide_args.push(function() {
|
||||
tag.remove();
|
||||
thisTag._trigger('afterTagRemoved', null, {tag: tag, tagLabel: thisTag.tagLabel(tag)});
|
||||
});
|
||||
|
||||
tag.fadeOut('fast').hide.apply(tag, hide_args).dequeue();
|
||||
} else {
|
||||
tag.remove();
|
||||
this._trigger('afterTagRemoved', null, {tag: tag, tagLabel: this.tagLabel(tag)});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
removeTagByLabel: function(tagLabel, animate) {
|
||||
var toRemove = this._findTagByLabel(tagLabel);
|
||||
if (!toRemove) {
|
||||
throw "No such tag exists with the name '" + tagLabel + "'";
|
||||
}
|
||||
this.removeTag(toRemove, animate);
|
||||
},
|
||||
|
||||
removeAll: function() {
|
||||
// Removes all tags.
|
||||
var that = this;
|
||||
this._tags().each(function(index, tag) {
|
||||
that.removeTag(tag, false);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
//From http://stackoverflow.com/questions/985272/jquery-selecting-text-in-an-element-akin-to-highlighting-with-your-mouse
|
||||
;(function($) {
|
||||
$.fn.selectText = function(){
|
||||
var doc = document , element = this[0] , range, selection ;
|
||||
if (doc.body.createTextRange) {
|
||||
range = document.body.createTextRange();
|
||||
range.moveToElementText(element);
|
||||
range.select();
|
||||
} else if (window.getSelection) {
|
||||
selection = window.getSelection();
|
||||
range = document.createRange();
|
||||
range.selectNodeContents(element);
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
}
|
||||
element.focus();
|
||||
};
|
||||
})(jQuery);
|
||||
1
wp-content/plugins/wp-file-download-light/app/admin/assets/js/jquery.textselect.min.js
vendored
Normal file
1
wp-content/plugins/wp-file-download-light/app/admin/assets/js/jquery.textselect.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(d){d.fn.selectText=function(){var b=this[0],a,c;document.body.createTextRange?(a=document.body.createTextRange(),a.moveToElementText(b),a.select()):window.getSelection&&(c=window.getSelection(),a=document.createRange(),a.selectNodeContents(b),c.removeAllRanges(),c.addRange(a));b.focus()}})(jQuery);
|
||||
6
wp-content/plugins/wp-file-download-light/app/admin/assets/js/jquery.ui.touch-punch.min.js
vendored
Normal file
6
wp-content/plugins/wp-file-download-light/app/admin/assets/js/jquery.ui.touch-punch.min.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
* jQuery UI Touch Punch 0.2.2
|
||||
* Copyright 2011, Dave Furfero
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
*/
|
||||
(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return;}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return;}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f);}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return;}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown");};c._touchMove=function(f){if(!a){return;}this._touchMoved=true;d(f,"mousemove");};c._touchEnd=function(f){if(!a){return;}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click");}a=false;};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f);};})(jQuery);
|
||||
@@ -0,0 +1,9 @@
|
||||
function wpfd_frameload() {
|
||||
jQuery("#wpfd_loader").hide();
|
||||
jQuery("#wpfdmodalframe").show();
|
||||
}
|
||||
jQuery(document).ready(function($){
|
||||
$('.wpfdlaunch').leanModal({ top : 20, beforeShow: function(){ $("#wpfdmodal").css("height","90%"); $("#wpfdmodalframe").hide(); $("#wpfdmodalframe").attr('src', $("#wpfdmodalframe").attr('src')); $("#wpfd_loader").show(); } });
|
||||
$('body').append('<div id="wpfdmodal"><img src="images/spinner-2x.gif" width="32" id="wpfd_loader" /><iframe id="wpfdmodalframe" onload="wpfd_frameload()" width="100%" height="100%" marginWidth="0" marginHeight="0" frameBorder="0" scrolling="auto" src="admin.php?page=wpfd&noheader=1&caninsert=1" /><button id="wpfd-close-modal" onclick="jQuery(\'#lean_overlay\',window.parent.document).fadeOut(300);jQuery(\'#wpfdmodal\',window.parent.document).fadeOut(300);" style="position: absolute; right: -23px;">x</button></div>');
|
||||
return false;
|
||||
});
|
||||
7
wp-content/plugins/wp-file-download-light/app/admin/assets/js/modal.min.js
vendored
Normal file
7
wp-content/plugins/wp-file-download-light/app/admin/assets/js/modal.min.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Bootstrap.js by @fat & @mdo
|
||||
* plugins: bootstrap-modal.js
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.txt
|
||||
*/
|
||||
!function(a){var b=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this,c=a.Event("show");this.$element.trigger(c);if(this.isShown||c.isDefaultPrevented())return;this.isShown=!0,this.escape(),this.backdrop(function(){var c=a.support.transition&&b.$element.hasClass("fade");b.$element.parent().length||b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in").attr("aria-hidden",!1),b.enforceFocus(),c?b.$element.one(a.support.transition.end,function(){b.$element.focus().trigger("shown")}):b.$element.focus().trigger("shown")})},hide:function(b){b&&b.preventDefault();var c=this;b=a.Event("hide"),this.$element.trigger(b);if(!this.isShown||b.isDefaultPrevented())return;this.isShown=!1,this.escape(),a(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),a.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal()},enforceFocus:function(){var b=this;a(document).on("focusin.modal",function(a){b.$element[0]!==a.target&&!b.$element.has(a.target).length&&b.$element.focus()})},escape:function(){var a=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(b){b.which==27&&a.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),b.hideModal()},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),b.hideModal()})},hideModal:function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden")})},removeBackdrop:function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},backdrop:function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.$backdrop.click(this.options.backdrop=="static"?a.proxy(this.$element[0].focus,this.$element[0]):a.proxy(this.hide,this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in");if(!b)return;e?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b):b()):b&&b()}};var c=a.fn.modal;a.fn.modal=function(c){return this.each(function(){var d=a(this),e=d.data("modal"),f=a.extend({},a.fn.modal.defaults,d.data(),typeof c=="object"&&c);e||d.data("modal",e=new b(this,f)),typeof c=="string"?e[c]():f.show&&e.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());b.preventDefault(),e.modal(f).one("hide",function(){c.focus()})})}(window.jQuery)
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Wpfd
|
||||
*
|
||||
* We developed this code with our hearts and passion.
|
||||
* We hope you found it useful, easy to understand and to customize.
|
||||
* Otherwise, please feel free to contact us at contact@joomunited.com *
|
||||
* @package WP File Download
|
||||
* @copyright Copyright (C) 2013 JoomUnited (http://www.joomunited.com). All rights reserved.
|
||||
* @copyright Copyright (C) 2013 Damien Barrère (http://www.crac-design.com). All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
$(".slider").slider();
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user