first commit
This commit is contained in:
515
wp-content/plugins/wp-table-manager-light/app/admin/assets/js/bootbox.js
vendored
Normal file
515
wp-content/plugins/wp-table-manager-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 wptmCmd.str
|
||||
}
|
||||
|
||||
return that;
|
||||
|
||||
}(document, window.jQuery));
|
||||
|
||||
// @see https://github.com/makeusabrew/bootbox/issues/71
|
||||
window.bootbox = bootbox;
|
||||
2170
wp-content/plugins/wp-table-manager-light/app/admin/assets/js/bootstrap.js
vendored
Normal file
2170
wp-content/plugins/wp-table-manager-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-table-manager-light/app/admin/assets/js/bootstrap.min.js
vendored
Normal file
7
wp-content/plugins/wp-table-manager-light/app/admin/assets/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
wp-content/plugins/wp-table-manager-light/app/admin/assets/js/dropzone.min.js
vendored
Normal file
1
wp-content/plugins/wp-table-manager-light/app/admin/assets/js/dropzone.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
708
wp-content/plugins/wp-table-manager-light/app/admin/assets/js/iris.min.js
vendored
Normal file
708
wp-content/plugins/wp-table-manager-light/app/admin/assets/js/iris.min.js
vendored
Normal file
@@ -0,0 +1,708 @@
|
||||
/*! Iris Color Picker - v1.0.7 - 2014-11-28
|
||||
* https://github.com/Automattic/Iris
|
||||
* Copyright (c) 2014 Matt Wiebe; Licensed GPLv2 */
|
||||
! function(a, b) {
|
||||
function c() {
|
||||
var b, c, d = "backgroundImage";
|
||||
j ? k = "filter" : (b = a('<div id="iris-gradtest" />'),
|
||||
c = "linear-gradient(top,#fff,#000)", a.each(l, function(a, e) {
|
||||
b.css(d, e + c);
|
||||
var jv = b.css(d); if(typeof jv == 'undefined') {jv = e + c};
|
||||
return jv.match("gradient") ? (k = a, !1) : void 0
|
||||
}), k === !1 && (b.css("background", "-webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#000))"), b.css(d).match("gradient") && (k = "webkit")), b.remove())
|
||||
}
|
||||
|
||||
function d(b, c) {
|
||||
return b = "top" === b ? "top" : "left", c = a.isArray(c) ? c : Array.prototype.slice.call(arguments, 1), "webkit" === k ? f(b, c) : l[k] + "linear-gradient(" + b + ", " + c.join(", ") + ")"
|
||||
}
|
||||
|
||||
function e(b, c) {
|
||||
var d, e, f, h, i, j, k, l, m;
|
||||
b = "top" === b ? "top" : "left", c = a.isArray(c) ? c : Array.prototype.slice.call(arguments, 1), d = "top" === b ? 0 : 1, e = a(this), f = c.length - 1, h = "filter", i = 1 === d ? "left" : "top", j = 1 === d ? "right" : "bottom", k = 1 === d ? "height" : "width", l = '<div class="iris-ie-gradient-shim" style="position:absolute;' + k + ":100%;" + i + ":%start%;" + j + ":%end%;" + h + ':%filter%;" data-color:"%color%"></div>', m = "", "static" === e.css("position") && e.css({
|
||||
position: "relative"
|
||||
}), c = g(c), a.each(c, function(a, b) {
|
||||
var e, g, h;
|
||||
return a === f ? !1 : (e = c[a + 1], b.stop !== e.stop && (g = 100 - parseFloat(e.stop) + "%", b.octoHex = new Color(b.color).toIEOctoHex(), e.octoHex = new Color(e.color).toIEOctoHex(), h = "progid:DXImageTransform.Microsoft.Gradient(GradientType=" + d + ", StartColorStr='" + b.octoHex + "', EndColorStr='" + e.octoHex + "')", m += l.replace("%start%", b.stop).replace("%end%", g).replace("%filter%", h)), void 0)
|
||||
}), e.find(".iris-ie-gradient-shim").remove(), a(m).prependTo(e)
|
||||
}
|
||||
|
||||
function f(b, c) {
|
||||
var d = [];
|
||||
return b = "top" === b ? "0% 0%,0% 100%," : "0% 100%,100% 100%,", c = g(c), a.each(c, function(a, b) {
|
||||
d.push("color-stop(" + parseFloat(b.stop) / 100 + ", " + b.color + ")")
|
||||
}), "-webkit-gradient(linear," + b + d.join(",") + ")"
|
||||
}
|
||||
|
||||
function g(b) {
|
||||
var c = [],
|
||||
d = [],
|
||||
e = [],
|
||||
f = b.length - 1;
|
||||
return a.each(b, function(a, b) {
|
||||
var e = b,
|
||||
f = !1,
|
||||
g = b.match(/1?[0-9]{1,2}%$/);
|
||||
g && (e = b.replace(/\s?1?[0-9]{1,2}%$/, ""), f = g.shift()), c.push(e), d.push(f)
|
||||
}), d[0] === !1 && (d[0] = "0%"), d[f] === !1 && (d[f] = "100%"), d = h(d), a.each(d, function(a) {
|
||||
e[a] = {
|
||||
color: c[a],
|
||||
stop: d[a]
|
||||
}
|
||||
}), e
|
||||
}
|
||||
|
||||
function h(b) {
|
||||
var c, d, e, f, g = 0,
|
||||
i = b.length - 1,
|
||||
j = 0,
|
||||
k = !1;
|
||||
if (b.length <= 2 || a.inArray(!1, b) < 0) return b;
|
||||
for (; j < b.length - 1;) k || b[j] !== !1 ? k && b[j] !== !1 && (i = j, j = b.length) : (g = j - 1, k = !0), j++;
|
||||
for (d = i - g, f = parseInt(b[g].replace("%"), 10), c = (parseFloat(b[i].replace("%")) - f) / d, j = g + 1, e = 1; i > j;) b[j] = f + e * c + "%", e++, j++;
|
||||
return h(b)
|
||||
}
|
||||
var i, j, k, l, m, n, o, p, q;
|
||||
return i = '<div class="iris-picker"><div class="iris-picker-inner"><div class="iris-square"><a class="iris-square-value" href="#"><span class="iris-square-handle ui-slider-handle"></span></a><div class="iris-square-inner iris-square-horiz"></div><div class="iris-square-inner iris-square-vert"></div></div><div class="iris-slider iris-strip"><div class="iris-slider-offset"></div></div></div></div>', m = '.iris-picker{display:block;position:relative}.iris-picker,.iris-picker *{-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input+.iris-picker{margin-top:4px}.iris-error{background-color:#ffafaf}.iris-border{border-radius:3px;border:1px solid #aaa;width:200px;background-color:#fff}.iris-picker-inner{position:absolute;top:0;right:0;left:0;bottom:0}.iris-border .iris-picker-inner{top:10px;right:10px;left:10px;bottom:10px}.iris-picker .iris-square-inner{position:absolute;left:0;right:0;top:0;bottom:0}.iris-picker .iris-square,.iris-picker .iris-slider,.iris-picker .iris-square-inner,.iris-picker .iris-palette{border-radius:3px;box-shadow:inset 0 0 5px rgba(0,0,0,.4);height:100%;width:12.5%;float:left;margin-right:5%}.iris-picker .iris-square{width:76%;margin-right:10%;position:relative}.iris-picker .iris-square-inner{width:auto;margin:0}.iris-ie-9 .iris-square,.iris-ie-9 .iris-slider,.iris-ie-9 .iris-square-inner,.iris-ie-9 .iris-palette{box-shadow:none;border-radius:0}.iris-ie-9 .iris-square,.iris-ie-9 .iris-slider,.iris-ie-9 .iris-palette{outline:1px solid rgba(0,0,0,.1)}.iris-ie-lt9 .iris-square,.iris-ie-lt9 .iris-slider,.iris-ie-lt9 .iris-square-inner,.iris-ie-lt9 .iris-palette{outline:1px solid #aaa}.iris-ie-lt9 .iris-square .ui-slider-handle{outline:1px solid #aaa;background-color:#fff;-ms-filter:"alpha(Opacity=30)"}.iris-ie-lt9 .iris-square .iris-square-handle{background:0;border:3px solid #fff;-ms-filter:"alpha(Opacity=50)"}.iris-picker .iris-strip{margin-right:0;position:relative}.iris-picker .iris-strip .ui-slider-handle{position:absolute;background:0;margin:0;right:-3px;left:-3px;border:4px solid #aaa;border-width:4px 3px;width:auto;height:6px;border-radius:4px;box-shadow:0 1px 2px rgba(0,0,0,.2);opacity:.9;z-index:5;cursor:ns-resize}.iris-strip .ui-slider-handle:before{content:" ";position:absolute;left:-2px;right:-2px;top:-3px;bottom:-3px;border:2px solid #fff;border-radius:3px}.iris-picker .iris-slider-offset{position:absolute;top:11px;left:0;right:0;bottom:-3px;width:auto;height:auto;background:transparent;border:0;border-radius:0}.iris-picker .iris-square-handle{background:transparent;border:5px solid #aaa;border-radius:50%;border-color:rgba(128,128,128,.5);box-shadow:none;width:12px;height:12px;position:absolute;left:-10px;top:-10px;cursor:move;opacity:1;z-index:10}.iris-picker .ui-state-focus .iris-square-handle{opacity:.8}.iris-picker .iris-square-handle:hover{border-color:#999}.iris-picker .iris-square-value:focus .iris-square-handle{box-shadow:0 0 2px rgba(0,0,0,.75);opacity:.8}.iris-picker .iris-square-handle:hover::after{border-color:#fff}.iris-picker .iris-square-handle::after{position:absolute;bottom:-4px;right:-4px;left:-4px;top:-4px;border:3px solid #f9f9f9;border-color:rgba(255,255,255,.8);border-radius:50%;content:" "}.iris-picker .iris-square-value{width:8px;height:8px;position:absolute}.iris-ie-lt9 .iris-square-value,.iris-mozilla .iris-square-value{width:1px;height:1px}.iris-palette-container{position:absolute;bottom:0;left:0;margin:0;padding:0}.iris-border .iris-palette-container{left:10px;bottom:10px}.iris-picker .iris-palette{margin:0;cursor:pointer}.iris-square-handle,.ui-slider-handle{border:0;outline:0}', o = navigator.userAgent.toLowerCase(), p = "Microsoft Internet Explorer" === navigator.appName, q = p ? parseFloat(o.match(/msie ([0-9]{1,}[\.0-9]{0,})/)[1]) : 0, j = p && 10 > q, k = !1, l = ["-moz-", "-webkit-", "-o-", "-ms-"], j && 7 >= q ? (a.fn.iris = a.noop, a.support.iris = !1, void 0) : (a.support.iris = !0, a.fn.gradient = function() {
|
||||
var b = arguments;
|
||||
return this.each(function() {
|
||||
j ? e.apply(this, b) : a(this).css("backgroundImage", d.apply(this, b))
|
||||
})
|
||||
}, a.fn.raninbowGradient = function(b, c) {
|
||||
var d, e, f, g;
|
||||
for (b = b || "top", d = a.extend({}, {
|
||||
s: 100,
|
||||
l: 50
|
||||
}, c), e = "hsl(%h%," + d.s + "%," + d.l + "%)", f = 0, g = []; 360 >= f;) g.push(e.replace("%h%", f)), f += 30;
|
||||
return this.each(function() {
|
||||
a(this).gradient(b, g)
|
||||
})
|
||||
}, n = {
|
||||
options: {
|
||||
color: !1,
|
||||
mode: "hsl",
|
||||
controls: {
|
||||
horiz: "s",
|
||||
vert: "l",
|
||||
strip: "h"
|
||||
},
|
||||
hide: !0,
|
||||
border: !0,
|
||||
target: !1,
|
||||
width: 200,
|
||||
palettes: !1
|
||||
},
|
||||
_color: "",
|
||||
_palettes: ["#000", "#fff", "#d33", "#d93", "#ee2", "#81d742", "#1e73be", "#8224e3"],
|
||||
_inited: !1,
|
||||
_defaultHSLControls: {
|
||||
horiz: "s",
|
||||
vert: "l",
|
||||
strip: "h"
|
||||
},
|
||||
_defaultHSVControls: {
|
||||
horiz: "h",
|
||||
vert: "v",
|
||||
strip: "s"
|
||||
},
|
||||
_scale: {
|
||||
h: 360,
|
||||
s: 100,
|
||||
l: 100,
|
||||
v: 100
|
||||
},
|
||||
_create: function() {
|
||||
var b = this,
|
||||
d = b.element,
|
||||
e = b.options.color || d.val();
|
||||
k === !1 && c(), d.is("input") ? (b.picker = b.options.target ? a(i).appendTo(b.options.target) : a(i).insertAfter(d), b._addInputListeners(d)) : (d.append(i), b.picker = d.find(".iris-picker")), p ? 9 === q ? b.picker.addClass("iris-ie-9") : 8 >= q && b.picker.addClass("iris-ie-lt9") : o.indexOf("compatible") < 0 && o.indexOf("khtml") < 0 && o.match(/mozilla/) && b.picker.addClass("iris-mozilla"), b.options.palettes && b._addPalettes(), b._color = new Color(e).setHSpace(b.options.mode), b.options.color = b._color.toString(), b.controls = {
|
||||
square: b.picker.find(".iris-square"),
|
||||
squareDrag: b.picker.find(".iris-square-value"),
|
||||
horiz: b.picker.find(".iris-square-horiz"),
|
||||
vert: b.picker.find(".iris-square-vert"),
|
||||
strip: b.picker.find(".iris-strip"),
|
||||
stripSlider: b.picker.find(".iris-strip .iris-slider-offset")
|
||||
}, "hsv" === b.options.mode && b._has("l", b.options.controls) ? b.options.controls = b._defaultHSVControls : "hsl" === b.options.mode && b._has("v", b.options.controls) && (b.options.controls = b._defaultHSLControls), b.hue = b._color.h(), b.options.hide && b.picker.hide(), b.options.border && b.picker.addClass("iris-border"), b._initControls(), b.active = "external", b._dimensions(), b._change()
|
||||
},
|
||||
_has: function(b, c) {
|
||||
var d = !1;
|
||||
return a.each(c, function(a, c) {
|
||||
return b === c ? (d = !0, !1) : void 0
|
||||
}), d
|
||||
},
|
||||
_addPalettes: function() {
|
||||
var b = a('<div class="iris-palette-container" />'),
|
||||
c = a('<a class="iris-palette" tabindex="0" />'),
|
||||
d = a.isArray(this.options.palettes) ? this.options.palettes : this._palettes;
|
||||
this.picker.find(".iris-palette-container").length && (b = this.picker.find(".iris-palette-container").detach().html("")), a.each(d, function(a, d) {
|
||||
c.clone().data("color", d).css("backgroundColor", d).appendTo(b).height(10).width(10)
|
||||
}), this.picker.append(b)
|
||||
},
|
||||
_paint: function() {
|
||||
var a = this;
|
||||
a._paintDimension("top", "strip"), a._paintDimension("top", "vert"), a._paintDimension("left", "horiz")
|
||||
},
|
||||
_paintDimension: function(a, b) {
|
||||
var c, d = this,
|
||||
e = d._color,
|
||||
f = d.options.mode,
|
||||
g = d._getHSpaceColor(),
|
||||
h = d.controls[b],
|
||||
i = d.options.controls;
|
||||
if (b !== d.active && ("square" !== d.active || "strip" === b)) switch (i[b]) {
|
||||
case "h":
|
||||
if ("hsv" === f) {
|
||||
switch (g = e.clone(), b) {
|
||||
case "horiz":
|
||||
g[i.vert](100);
|
||||
break;
|
||||
case "vert":
|
||||
g[i.horiz](100);
|
||||
break;
|
||||
case "strip":
|
||||
g.setHSpace("hsl")
|
||||
}
|
||||
c = g.toHsl()
|
||||
} else c = "strip" === b ? {
|
||||
s: g.s,
|
||||
l: g.l
|
||||
} : {
|
||||
s: 100,
|
||||
l: g.l
|
||||
};
|
||||
h.raninbowGradient(a, c);
|
||||
break;
|
||||
case "s":
|
||||
"hsv" === f ? "vert" === b ? c = [e.clone().a(0).s(0).toCSS("rgba"), e.clone().a(1).s(0).toCSS("rgba")] : "strip" === b ? c = [e.clone().s(100).toCSS("hsl"), e.clone().s(0).toCSS("hsl")] : "horiz" === b && (c = ["#fff", "hsl(" + g.h + ",100%,50%)"]) : c = "vert" === b && "h" === d.options.controls.horiz ? ["hsla(0, 0%, " + g.l + "%, 0)", "hsla(0, 0%, " + g.l + "%, 1)"] : ["hsl(" + g.h + ",0%,50%)", "hsl(" + g.h + ",100%,50%)"], h.gradient(a, c);
|
||||
break;
|
||||
case "l":
|
||||
c = "strip" === b ? ["hsl(" + g.h + ",100%,100%)", "hsl(" + g.h + ", " + g.s + "%,50%)", "hsl(" + g.h + ",100%,0%)"] : ["#fff", "rgba(255,255,255,0) 50%", "rgba(0,0,0,0) 50%", "rgba(0,0,0,1)"], h.gradient(a, c);
|
||||
break;
|
||||
case "v":
|
||||
c = "strip" === b ? [e.clone().v(100).toCSS(), e.clone().v(0).toCSS()] : ["rgba(0,0,0,0)", "#000"], h.gradient(a, c)
|
||||
}
|
||||
},
|
||||
_getHSpaceColor: function() {
|
||||
return "hsv" === this.options.mode ? this._color.toHsv() : this._color.toHsl()
|
||||
},
|
||||
_dimensions: function(b) {
|
||||
var c, d, e, f, g = this,
|
||||
h = g.options,
|
||||
i = g.controls,
|
||||
j = i.square,
|
||||
k = g.picker.find(".iris-strip"),
|
||||
l = "77.5%",
|
||||
m = "12%",
|
||||
n = 20,
|
||||
o = h.border ? h.width - n : h.width,
|
||||
p = a.isArray(h.palettes) ? h.palettes.length : g._palettes.length;
|
||||
return b && (j.css("width", ""), k.css("width", ""), g.picker.css({
|
||||
width: "",
|
||||
height: ""
|
||||
})), l = o * (parseFloat(l) / 100), m = o * (parseFloat(m) / 100), c = h.border ? l + n : l, j.width(l).height(l), k.height(l).width(m), g.picker.css({
|
||||
width: h.width,
|
||||
height: c
|
||||
}), h.palettes ? (d = 2 * l / 100, f = l - (p - 1) * d, e = f / p, g.picker.find(".iris-palette").each(function(b) {
|
||||
var c = 0 === b ? 0 : d;
|
||||
a(this).css({
|
||||
width: e,
|
||||
height: e,
|
||||
marginLeft: c
|
||||
})
|
||||
}), g.picker.css("paddingBottom", e + d), k.height(e + d + l), void 0) : g.picker.css("paddingBottom", "")
|
||||
},
|
||||
_addInputListeners: function(a) {
|
||||
var b = this,
|
||||
c = 100,
|
||||
d = function(c) {
|
||||
var d = new Color(a.val()),
|
||||
e = a.val().replace(/^#/, "");
|
||||
a.removeClass("iris-error"), d.error ? "" !== e && a.addClass("iris-error") : d.toString() !== b._color.toString() && ("keyup" === c.type && e.match(/^[0-9a-fA-F]{3}$/) || b._setOption("color", d.toString()))
|
||||
};
|
||||
a.on("change", d).on("keyup", b._debounce(d, c)), b.options.hide && a.one("focus", function() {
|
||||
b.show()
|
||||
})
|
||||
},
|
||||
_initControls: function() {
|
||||
var b = this,
|
||||
c = b.controls,
|
||||
d = c.square,
|
||||
e = b.options.controls,
|
||||
f = b._scale[e.strip];
|
||||
c.stripSlider.slider({
|
||||
orientation: "vertical",
|
||||
max: f,
|
||||
slide: function(a, c) {
|
||||
b.active = "strip", "h" === e.strip && (c.value = f - c.value), b._color[e.strip](c.value), b._change.apply(b, arguments)
|
||||
}
|
||||
}), c.squareDrag.draggable({
|
||||
containment: c.square.find(".iris-square-inner"),
|
||||
zIndex: 1e3,
|
||||
cursor: "move",
|
||||
drag: function(a, c) {
|
||||
b._squareDrag(a, c)
|
||||
},
|
||||
start: function() {
|
||||
d.addClass("iris-dragging"), a(this).addClass("ui-state-focus")
|
||||
},
|
||||
stop: function() {
|
||||
d.removeClass("iris-dragging"), a(this).removeClass("ui-state-focus")
|
||||
}
|
||||
}).on("mousedown mouseup", function(c) {
|
||||
var d = "ui-state-focus";
|
||||
c.preventDefault(), "mousedown" === c.type ? (b.picker.find("." + d).removeClass(d).blur(), a(this).addClass(d).focus()) : a(this).removeClass(d)
|
||||
}).on("keydown", function(a) {
|
||||
var d = c.square,
|
||||
e = c.squareDrag,
|
||||
f = e.position(),
|
||||
g = b.options.width / 100;
|
||||
switch (a.altKey && (g *= 10), a.keyCode) {
|
||||
case 37:
|
||||
f.left -= g;
|
||||
break;
|
||||
case 38:
|
||||
f.top -= g;
|
||||
break;
|
||||
case 39:
|
||||
f.left += g;
|
||||
break;
|
||||
case 40:
|
||||
f.top += g;
|
||||
break;
|
||||
default:
|
||||
return !0
|
||||
}
|
||||
f.left = Math.max(0, Math.min(f.left, d.width())), f.top = Math.max(0, Math.min(f.top, d.height())), e.css(f), b._squareDrag(a, {
|
||||
position: f
|
||||
}), a.preventDefault()
|
||||
}), d.mousedown(function(c) {
|
||||
var d, e;
|
||||
1 === c.which && a(c.target).is("div") && (d = b.controls.square.offset(), e = {
|
||||
top: c.pageY - d.top,
|
||||
left: c.pageX - d.left
|
||||
}, c.preventDefault(), b._squareDrag(c, {
|
||||
position: e
|
||||
}), c.target = b.controls.squareDrag.get(0), b.controls.squareDrag.css(e).trigger(c))
|
||||
}), b.options.palettes && b._paletteListeners()
|
||||
},
|
||||
_paletteListeners: function() {
|
||||
var b = this;
|
||||
b.picker.find(".iris-palette-container").on("click.palette", ".iris-palette", function() {
|
||||
b._color.fromCSS(a(this).data("color")), b.active = "external", b._change()
|
||||
}).on("keydown.palette", ".iris-palette", function(b) {
|
||||
return 13 !== b.keyCode && 32 !== b.keyCode ? !0 : (b.stopPropagation(), a(this).click(), void 0)
|
||||
})
|
||||
},
|
||||
_squareDrag: function(a, b) {
|
||||
var c = this,
|
||||
d = c.options.controls,
|
||||
e = c._squareDimensions(),
|
||||
f = Math.round((e.h - b.position.top) / e.h * c._scale[d.vert]),
|
||||
g = c._scale[d.horiz] - Math.round((e.w - b.position.left) / e.w * c._scale[d.horiz]);
|
||||
c._color[d.horiz](g)[d.vert](f), c.active = "square", c._change.apply(c, arguments)
|
||||
},
|
||||
_setOption: function(b, c) {
|
||||
var d, e, f, g = this,
|
||||
h = g.options[b],
|
||||
i = !1;
|
||||
switch (g.options[b] = c, b) {
|
||||
case "color":
|
||||
c = "" + c, d = c.replace(/^#/, ""), e = new Color(c).setHSpace(g.options.mode), e.error ? g.options[b] = h : (g._color = e, g.options.color = g.options[b] = g._color.toString(), g.active = "external", g._change());
|
||||
break;
|
||||
case "palettes":
|
||||
i = !0, c ? g._addPalettes() : g.picker.find(".iris-palette-container").remove(), h || g._paletteListeners();
|
||||
break;
|
||||
case "width":
|
||||
i = !0;
|
||||
break;
|
||||
case "border":
|
||||
i = !0, f = c ? "addClass" : "removeClass", g.picker[f]("iris-border");
|
||||
break;
|
||||
case "mode":
|
||||
case "controls":
|
||||
if (h === c) return;
|
||||
return f = g.element, h = g.options, h.hide = !g.picker.is(":visible"), g.destroy(), g.picker.remove(), a(g.element).iris(h)
|
||||
}
|
||||
i && g._dimensions(!0)
|
||||
},
|
||||
_squareDimensions: function(a) {
|
||||
var c, d, e = this.controls.square;
|
||||
return a !== b && e.data("dimensions") ? e.data("dimensions") : (d = this.controls.squareDrag, c = {
|
||||
w: e.width(),
|
||||
h: e.height()
|
||||
}, e.data("dimensions", c), c)
|
||||
},
|
||||
_isNonHueControl: function(a, b) {
|
||||
return "square" === a && "h" === this.options.controls.strip ? !0 : "external" === b || "h" === b && "strip" === a ? !1 : !0
|
||||
},
|
||||
_change: function() {
|
||||
var b = this,
|
||||
c = b.controls,
|
||||
d = b._getHSpaceColor(),
|
||||
e = ["square", "strip"],
|
||||
f = b.options.controls,
|
||||
g = f[b.active] || "external",
|
||||
h = b.hue;
|
||||
"strip" === b.active ? e = [] : "external" !== b.active && e.pop(), a.each(e, function(a, e) {
|
||||
var g, h, i;
|
||||
if (e !== b.active) switch (e) {
|
||||
case "strip":
|
||||
g = "h" === f.strip ? b._scale[f.strip] - d[f.strip] : d[f.strip], c.stripSlider.slider("value", g);
|
||||
break;
|
||||
case "square":
|
||||
h = b._squareDimensions(), i = {
|
||||
left: d[f.horiz] / b._scale[f.horiz] * h.w,
|
||||
top: h.h - d[f.vert] / b._scale[f.vert] * h.h
|
||||
}, b.controls.squareDrag.css(i)
|
||||
}
|
||||
}), d.h !== h && b._isNonHueControl(b.active, g) && b._color.h(h), b.hue = b._color.h(), b.options.color = b._color.toString(), b._inited && b._trigger("change", {
|
||||
type: b.active
|
||||
}, {
|
||||
color: b._color
|
||||
}), b.element.is(":input") && !b._color.error && (b.element.removeClass("iris-error"), b.element.val() !== b._color.toString() && b.element.val(b._color.toString())), b._paint(), b._inited = !0, b.active = !1
|
||||
},
|
||||
_debounce: function(a, b, c) {
|
||||
var d, e;
|
||||
return function() {
|
||||
var f, g, h = this,
|
||||
i = arguments;
|
||||
return f = function() {
|
||||
d = null, c || (e = a.apply(h, i))
|
||||
}, g = c && !d, clearTimeout(d), d = setTimeout(f, b), g && (e = a.apply(h, i)), e
|
||||
}
|
||||
},
|
||||
show: function() {
|
||||
this.picker.show()
|
||||
},
|
||||
hide: function() {
|
||||
this.picker.hide()
|
||||
},
|
||||
toggle: function() {
|
||||
this.picker.toggle()
|
||||
},
|
||||
color: function(a) {
|
||||
return a === !0 ? this._color.clone() : a === b ? this._color.toString() : (this.option("color", a), void 0)
|
||||
}
|
||||
}, a.widget("a8c.iris", n), a('<style id="iris-css">' + m + "</style>").appendTo("head"), void 0)
|
||||
}(jQuery),
|
||||
function(a, b) {
|
||||
var c = function(a, b) {
|
||||
return this instanceof c ? this._init(a, b) : new c(a, b)
|
||||
};
|
||||
c.fn = c.prototype = {
|
||||
_color: 0,
|
||||
_alpha: 1,
|
||||
error: !1,
|
||||
_hsl: {
|
||||
h: 0,
|
||||
s: 0,
|
||||
l: 0
|
||||
},
|
||||
_hsv: {
|
||||
h: 0,
|
||||
s: 0,
|
||||
v: 0
|
||||
},
|
||||
_hSpace: "hsl",
|
||||
_init: function(a) {
|
||||
var c = "noop";
|
||||
switch (typeof a) {
|
||||
case "object":
|
||||
return a.a !== b && this.a(a.a), c = a.r !== b ? "fromRgb" : a.l !== b ? "fromHsl" : a.v !== b ? "fromHsv" : c, this[c](a);
|
||||
case "string":
|
||||
return this.fromCSS(a);
|
||||
case "number":
|
||||
return this.fromInt(parseInt(a, 10))
|
||||
}
|
||||
return this
|
||||
},
|
||||
_error: function() {
|
||||
return this.error = !0, this
|
||||
},
|
||||
clone: function() {
|
||||
for (var a = new c(this.toInt()), b = ["_alpha", "_hSpace", "_hsl", "_hsv", "error"], d = b.length - 1; d >= 0; d--) a[b[d]] = this[b[d]];
|
||||
return a
|
||||
},
|
||||
setHSpace: function(a) {
|
||||
return this._hSpace = "hsv" === a ? a : "hsl", this
|
||||
},
|
||||
noop: function() {
|
||||
return this
|
||||
},
|
||||
fromCSS: function(a) {
|
||||
var b, c = /^(rgb|hs(l|v))a?\(/;
|
||||
if (this.error = !1, a = a.replace(/^\s+/, "").replace(/\s+$/, "").replace(/;$/, ""), a.match(c) && a.match(/\)$/)) {
|
||||
if (b = a.replace(/(\s|%)/g, "").replace(c, "").replace(/,?\);?$/, "").split(","), b.length < 3) return this._error();
|
||||
if (4 === b.length && (this.a(parseFloat(b.pop())), this.error)) return this;
|
||||
for (var d = b.length - 1; d >= 0; d--)
|
||||
if (b[d] = parseInt(b[d], 10), isNaN(b[d])) return this._error();
|
||||
return a.match(/^rgb/) ? this.fromRgb({
|
||||
r: b[0],
|
||||
g: b[1],
|
||||
b: b[2]
|
||||
}) : a.match(/^hsv/) ? this.fromHsv({
|
||||
h: b[0],
|
||||
s: b[1],
|
||||
v: b[2]
|
||||
}) : this.fromHsl({
|
||||
h: b[0],
|
||||
s: b[1],
|
||||
l: b[2]
|
||||
})
|
||||
}
|
||||
return this.fromHex(a)
|
||||
},
|
||||
fromRgb: function(a, c) {
|
||||
return "object" != typeof a || a.r === b || a.g === b || a.b === b ? this._error() : (this.error = !1, this.fromInt(parseInt((a.r << 16) + (a.g << 8) + a.b, 10), c))
|
||||
},
|
||||
fromHex: function(a) {
|
||||
return a = a.replace(/^#/, "").replace(/^0x/, ""), 3 === a.length && (a = a[0] + a[0] + a[1] + a[1] + a[2] + a[2]), this.error = !/^[0-9A-F]{6}$/i.test(a), this.fromInt(parseInt(a, 16))
|
||||
},
|
||||
fromHsl: function(a) {
|
||||
var c, d, e, f, g, h, i, j;
|
||||
return "object" != typeof a || a.h === b || a.s === b || a.l === b ? this._error() : (this._hsl = a, this._hSpace = "hsl", h = a.h / 360, i = a.s / 100, j = a.l / 100, 0 === i ? c = d = e = j : (f = .5 > j ? j * (1 + i) : j + i - j * i, g = 2 * j - f, c = this.hue2rgb(g, f, h + 1 / 3), d = this.hue2rgb(g, f, h), e = this.hue2rgb(g, f, h - 1 / 3)), this.fromRgb({
|
||||
r: 255 * c,
|
||||
g: 255 * d,
|
||||
b: 255 * e
|
||||
}, !0))
|
||||
},
|
||||
fromHsv: function(a) {
|
||||
var c, d, e, f, g, h, i, j, k, l, m;
|
||||
if ("object" != typeof a || a.h === b || a.s === b || a.v === b) return this._error();
|
||||
switch (this._hsv = a, this._hSpace = "hsv", c = a.h / 360, d = a.s / 100, e = a.v / 100, i = Math.floor(6 * c), j = 6 * c - i, k = e * (1 - d), l = e * (1 - j * d), m = e * (1 - (1 - j) * d), i % 6) {
|
||||
case 0:
|
||||
f = e, g = m, h = k;
|
||||
break;
|
||||
case 1:
|
||||
f = l, g = e, h = k;
|
||||
break;
|
||||
case 2:
|
||||
f = k, g = e, h = m;
|
||||
break;
|
||||
case 3:
|
||||
f = k, g = l, h = e;
|
||||
break;
|
||||
case 4:
|
||||
f = m, g = k, h = e;
|
||||
break;
|
||||
case 5:
|
||||
f = e, g = k, h = l
|
||||
}
|
||||
return this.fromRgb({
|
||||
r: 255 * f,
|
||||
g: 255 * g,
|
||||
b: 255 * h
|
||||
}, !0)
|
||||
},
|
||||
fromInt: function(a, c) {
|
||||
return this._color = parseInt(a, 10), isNaN(this._color) && (this._color = 0), this._color > 16777215 ? this._color = 16777215 : this._color < 0 && (this._color = 0), c === b && (this._hsv.h = this._hsv.s = this._hsl.h = this._hsl.s = 0), this
|
||||
},
|
||||
hue2rgb: function(a, b, c) {
|
||||
return 0 > c && (c += 1), c > 1 && (c -= 1), 1 / 6 > c ? a + 6 * (b - a) * c : .5 > c ? b : 2 / 3 > c ? a + 6 * (b - a) * (2 / 3 - c) : a
|
||||
},
|
||||
toString: function() {
|
||||
var a = parseInt(this._color, 10).toString(16);
|
||||
if (this.error) return "";
|
||||
if (a.length < 6)
|
||||
for (var b = 6 - a.length - 1; b >= 0; b--) a = "0" + a;
|
||||
return "#" + a
|
||||
},
|
||||
toCSS: function(a, b) {
|
||||
switch (a = a || "hex", b = parseFloat(b || this._alpha), a) {
|
||||
case "rgb":
|
||||
case "rgba":
|
||||
var c = this.toRgb();
|
||||
return 1 > b ? "rgba( " + c.r + ", " + c.g + ", " + c.b + ", " + b + " )" : "rgb( " + c.r + ", " + c.g + ", " + c.b + " )";
|
||||
case "hsl":
|
||||
case "hsla":
|
||||
var d = this.toHsl();
|
||||
return 1 > b ? "hsla( " + d.h + ", " + d.s + "%, " + d.l + "%, " + b + " )" : "hsl( " + d.h + ", " + d.s + "%, " + d.l + "% )";
|
||||
default:
|
||||
return this.toString()
|
||||
}
|
||||
},
|
||||
toRgb: function() {
|
||||
return {
|
||||
r: 255 & this._color >> 16,
|
||||
g: 255 & this._color >> 8,
|
||||
b: 255 & this._color
|
||||
}
|
||||
},
|
||||
toHsl: function() {
|
||||
var a, b, c = this.toRgb(),
|
||||
d = c.r / 255,
|
||||
e = c.g / 255,
|
||||
f = c.b / 255,
|
||||
g = Math.max(d, e, f),
|
||||
h = Math.min(d, e, f),
|
||||
i = (g + h) / 2;
|
||||
if (g === h) a = b = 0;
|
||||
else {
|
||||
var j = g - h;
|
||||
switch (b = i > .5 ? j / (2 - g - h) : j / (g + h), g) {
|
||||
case d:
|
||||
a = (e - f) / j + (f > e ? 6 : 0);
|
||||
break;
|
||||
case e:
|
||||
a = (f - d) / j + 2;
|
||||
break;
|
||||
case f:
|
||||
a = (d - e) / j + 4
|
||||
}
|
||||
a /= 6
|
||||
}
|
||||
return a = Math.round(360 * a), 0 === a && this._hsl.h !== a && (a = this._hsl.h), b = Math.round(100 * b), 0 === b && this._hsl.s && (b = this._hsl.s), {
|
||||
h: a,
|
||||
s: b,
|
||||
l: Math.round(100 * i)
|
||||
}
|
||||
},
|
||||
toHsv: function() {
|
||||
var a, b, c = this.toRgb(),
|
||||
d = c.r / 255,
|
||||
e = c.g / 255,
|
||||
f = c.b / 255,
|
||||
g = Math.max(d, e, f),
|
||||
h = Math.min(d, e, f),
|
||||
i = g,
|
||||
j = g - h;
|
||||
if (b = 0 === g ? 0 : j / g, g === h) a = b = 0;
|
||||
else {
|
||||
switch (g) {
|
||||
case d:
|
||||
a = (e - f) / j + (f > e ? 6 : 0);
|
||||
break;
|
||||
case e:
|
||||
a = (f - d) / j + 2;
|
||||
break;
|
||||
case f:
|
||||
a = (d - e) / j + 4
|
||||
}
|
||||
a /= 6
|
||||
}
|
||||
return a = Math.round(360 * a), 0 === a && this._hsv.h !== a && (a = this._hsv.h), b = Math.round(100 * b), 0 === b && this._hsv.s && (b = this._hsv.s), {
|
||||
h: a,
|
||||
s: b,
|
||||
v: Math.round(100 * i)
|
||||
}
|
||||
},
|
||||
toInt: function() {
|
||||
return this._color
|
||||
},
|
||||
toIEOctoHex: function() {
|
||||
var a = this.toString(),
|
||||
b = parseInt(255 * this._alpha, 10).toString(16);
|
||||
return 1 === b.length && (b = "0" + b), "#" + b + a.replace(/^#/, "")
|
||||
},
|
||||
toLuminosity: function() {
|
||||
var a = this.toRgb();
|
||||
return .2126 * Math.pow(a.r / 255, 2.2) + .7152 * Math.pow(a.g / 255, 2.2) + .0722 * Math.pow(a.b / 255, 2.2)
|
||||
},
|
||||
getDistanceLuminosityFrom: function(a) {
|
||||
if (!(a instanceof c)) throw "getDistanceLuminosityFrom requires a Color object";
|
||||
var b = this.toLuminosity(),
|
||||
d = a.toLuminosity();
|
||||
return b > d ? (b + .05) / (d + .05) : (d + .05) / (b + .05)
|
||||
},
|
||||
getMaxContrastColor: function() {
|
||||
var a = this.toLuminosity(),
|
||||
b = a >= .5 ? "000000" : "ffffff";
|
||||
return new c(b)
|
||||
},
|
||||
getReadableContrastingColor: function(a, d) {
|
||||
if (!a instanceof c) return this;
|
||||
var e = d === b ? 5 : d,
|
||||
f = a.getDistanceLuminosityFrom(this),
|
||||
g = a.getMaxContrastColor(),
|
||||
h = g.getDistanceLuminosityFrom(a);
|
||||
if (e >= h) return g;
|
||||
if (f >= e) return this;
|
||||
for (var i = 0 === g.toInt() ? -1 : 1; e > f && (this.l(i, !0), f = this.getDistanceLuminosityFrom(a), 0 !== this._color && 16777215 !== this._color););
|
||||
return this
|
||||
},
|
||||
a: function(a) {
|
||||
if (a === b) return this._alpha;
|
||||
var c = parseFloat(a);
|
||||
return isNaN(c) ? this._error() : (this._alpha = c, this)
|
||||
},
|
||||
darken: function(a) {
|
||||
return a = a || 5, this.l(-a, !0)
|
||||
},
|
||||
lighten: function(a) {
|
||||
return a = a || 5, this.l(a, !0)
|
||||
},
|
||||
saturate: function(a) {
|
||||
return a = a || 15, this.s(a, !0)
|
||||
},
|
||||
desaturate: function(a) {
|
||||
return a = a || 15, this.s(-a, !0)
|
||||
},
|
||||
toGrayscale: function() {
|
||||
return this.setHSpace("hsl").s(0)
|
||||
},
|
||||
getComplement: function() {
|
||||
return this.h(180, !0)
|
||||
},
|
||||
getSplitComplement: function(a) {
|
||||
a = a || 1;
|
||||
var b = 180 + 30 * a;
|
||||
return this.h(b, !0)
|
||||
},
|
||||
getAnalog: function(a) {
|
||||
a = a || 1;
|
||||
var b = 30 * a;
|
||||
return this.h(b, !0)
|
||||
},
|
||||
getTetrad: function(a) {
|
||||
a = a || 1;
|
||||
var b = 60 * a;
|
||||
return this.h(b, !0)
|
||||
},
|
||||
getTriad: function(a) {
|
||||
a = a || 1;
|
||||
var b = 120 * a;
|
||||
return this.h(b, !0)
|
||||
},
|
||||
_partial: function(a) {
|
||||
var c = d[a];
|
||||
return function(d, e) {
|
||||
var f = this._spaceFunc("to", c.space);
|
||||
return d === b ? f[a] : (e === !0 && (d = f[a] + d), c.mod && (d %= c.mod), c.range && (d = d < c.range[0] ? c.range[0] : d > c.range[1] ? c.range[1] : d), f[a] = d, this._spaceFunc("from", c.space, f))
|
||||
}
|
||||
},
|
||||
_spaceFunc: function(a, b, c) {
|
||||
var d = b || this._hSpace,
|
||||
e = a + d.charAt(0).toUpperCase() + d.substr(1);
|
||||
return this[e](c)
|
||||
}
|
||||
};
|
||||
var d = {
|
||||
h: {
|
||||
mod: 360
|
||||
},
|
||||
s: {
|
||||
range: [0, 100]
|
||||
},
|
||||
l: {
|
||||
space: "hsl",
|
||||
range: [0, 100]
|
||||
},
|
||||
v: {
|
||||
space: "hsv",
|
||||
range: [0, 100]
|
||||
},
|
||||
r: {
|
||||
space: "rgb",
|
||||
range: [0, 255]
|
||||
},
|
||||
g: {
|
||||
space: "rgb",
|
||||
range: [0, 255]
|
||||
},
|
||||
b: {
|
||||
space: "rgb",
|
||||
range: [0, 255]
|
||||
}
|
||||
};
|
||||
for (var e in d) d.hasOwnProperty(e) && (c.fn[e] = c.fn._partial(e));
|
||||
"object" == typeof exports ? module.exports = c : a.Color = c
|
||||
}(this);
|
||||
@@ -0,0 +1,185 @@
|
||||
// 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(options);
|
||||
//
|
||||
// Author: Damien Barrère
|
||||
// Website: http://www.crac-design.com
|
||||
|
||||
(function( $ ) {
|
||||
|
||||
var 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 methods = {
|
||||
init : function( o ) {
|
||||
if($(this).length==0){
|
||||
return;
|
||||
}
|
||||
$this = $(this);
|
||||
$.extend(options,o);
|
||||
|
||||
if(options.showroot!=''){
|
||||
checkboxes = '';
|
||||
if(options.usecheckboxes===true || options.usecheckboxes==='dirs'){
|
||||
checkboxes = '<input type="checkbox" />';
|
||||
}
|
||||
$this.html('<ul class="jaofiletree"><li class="drive directory collapsed selected">'+checkboxes+'<a href="#" data-file="'+options.root+'" data-type="dir">'+options.showroot+'</a></li></ul>');
|
||||
}
|
||||
openfolder(options.root);
|
||||
},
|
||||
open : function(dir){
|
||||
openfolder(dir);
|
||||
},
|
||||
close : function(dir){
|
||||
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 : options.script,
|
||||
data : {dir : dir,action:'wptm_getFolders'},
|
||||
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(options.usecheckboxes===true || (options.usecheckboxes==='dirs' && datas[ij].type=='dir') || (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(options.expandSpeed,options.expandEasing);
|
||||
|
||||
if(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');
|
||||
}
|
||||
|
||||
setevents();
|
||||
}).done(function(){
|
||||
//Trigger custom event
|
||||
$this.trigger('afteropen');
|
||||
$this.trigger('afterupdate');
|
||||
});
|
||||
}
|
||||
|
||||
closedir = function(dir) {
|
||||
$this.find('a[data-file="'+dir+'"]').next().slideUp(options.collapseSpeed,options.collapseEasing,function(){$(this).remove();});
|
||||
$this.find('a[data-file="'+dir+'"]').parent().removeClass('expanded').addClass('collapsed');
|
||||
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() {
|
||||
options.onclick(this, $(this).attr('data-type'),$(this).attr('data-file'));
|
||||
if(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(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() {
|
||||
if($(this).is(':checked')){
|
||||
$this.find('li input[type="checkbox"]').attr('checked',null);
|
||||
$(this).attr('checked','checked');
|
||||
}
|
||||
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() {methods.open($(this).attr('data-file'));return false;});
|
||||
$this.find('li.directory.expanded a').bind('click', function() {methods.close($(this).attr('data-file'));return false;});
|
||||
}
|
||||
|
||||
$.fn.jaofiletree = function( method ) {
|
||||
// Method calling logic
|
||||
if ( methods[method] ) {
|
||||
return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
|
||||
} else if ( typeof method === 'object' || ! method ) {
|
||||
return methods.init.apply( this, arguments );
|
||||
} else {
|
||||
//error
|
||||
}
|
||||
};
|
||||
})( jQuery );
|
||||
File diff suppressed because it is too large
Load Diff
8
wp-content/plugins/wp-table-manager-light/app/admin/assets/js/jquery.leanModal.min.js
vendored
Normal file
8
wp-content/plugins/wp-table-manager-light/app/admin/assets/js/jquery.leanModal.min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
// leanModal v1.1 by Ray Stone - http://finelysliced.com.au
|
||||
// Dual licensed under the MIT and GPL
|
||||
|
||||
(function($){$.fn.extend({wptm_leanModal:function(options){var defaults={top:100,overlay:0.5,closeButton:null}; if( $("#lean_overlay").length==0) { $("body").append("<div id='lean_overlay'></div>");} ; 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);
|
||||
49
wp-content/plugins/wp-table-manager-light/app/admin/assets/js/jquery.minicolors.min.js
vendored
Normal file
49
wp-content/plugins/wp-table-manager-light/app/admin/assets/js/jquery.minicolors.min.js
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
if(jQuery)(function($){$.minicolors={defaultSettings:{animationSpeed:100,animationEasing:'swing',change:null,changeDelay:0,control:'hue',defaultValue:'',hide:null,hideSpeed:100,inline:false,letterCase:'lowercase',opacity:false,position:'default',show:null,showSpeed:100,swatchPosition:'left',textfield:true,theme:'default'}};$.extend($.fn,{minicolors:function(method,data){switch(method){case'destroy':$(this).each(function(){destroy($(this));});return $(this);case'hide':hide();return $(this);case'opacity':if(data===undefined){return $(this).attr('data-opacity');}else{$(this).each(function(){refresh($(this).attr('data-opacity',data));});return $(this);}
|
||||
case'rgbObject':return rgbObject($(this),method==='rgbaObject');case'rgbString':case'rgbaString':return rgbString($(this),method==='rgbaString')
|
||||
case'settings':if(data===undefined){return $(this).data('minicolors-settings');}else{$(this).each(function(){var settings=$(this).data('minicolors-settings')||{};destroy($(this));$(this).minicolors($.extend(true,settings,data));});return $(this);}
|
||||
case'show':show($(this).eq(0));return $(this);case'value':if(data===undefined){return $(this).val();}else{$(this).each(function(){refresh($(this).val(data));});return $(this);}
|
||||
case'create':default:if(method!=='create')data=method;$(this).each(function(){init($(this),data);});return $(this);}}});function init(input,settings){var minicolors=$('<span class="minicolors" />'),defaultSettings=$.minicolors.defaultSettings;if(input.data('minicolors-initialized'))return;settings=$.extend(true,{},defaultSettings,settings);minicolors.addClass('minicolors-theme-'+settings.theme).addClass('minicolors-swatch-position-'+settings.swatchPosition).toggleClass('minicolors-swatch-left',settings.swatchPosition==='left').toggleClass('minicolors-with-opacity',settings.opacity);if(settings.position!==undefined){$.each(settings.position.split(' '),function(){minicolors.addClass('minicolors-position-'+this);});}
|
||||
input.addClass('minicolors-input').data('minicolors-initialized',true).data('minicolors-settings',settings).prop('size',7).prop('maxlength',7).wrap(minicolors).after('<span class="minicolors-panel minicolors-slider-'+settings.control+'">'+'<span class="minicolors-slider">'+'<span class="minicolors-picker"></span>'+'</span>'+'<span class="minicolors-opacity-slider">'+'<span class="minicolors-picker"></span>'+'</span>'+'<span class="minicolors-grid">'+'<span class="minicolors-grid-inner"></span>'+'<span class="minicolors-picker"><span></span></span>'+'</span>'+'</span>');input.parent().find('.minicolors-panel').on('selectstart',function(){return false;}).end();if(settings.swatchPosition==='left'){input.before('<span class="minicolors-swatch"><span></span></span>');}else{input.after('<span class="minicolors-swatch"><span></span></span>');}
|
||||
if(!settings.textfield)input.addClass('minicolors-hidden');if(settings.inline)input.parent().addClass('minicolors-inline');updateFromInput(input,false,true);}
|
||||
function destroy(input){var minicolors=input.parent();input.removeData('minicolors-initialized').removeData('minicolors-settings').removeProp('size').removeProp('maxlength').removeClass('minicolors-input');minicolors.before(input).remove();}
|
||||
function refresh(input){updateFromInput(input);}
|
||||
function show(input){var minicolors=input.parent(),panel=minicolors.find('.minicolors-panel'),settings=input.data('minicolors-settings');if(!input.data('minicolors-initialized')||input.prop('disabled')||minicolors.hasClass('minicolors-inline')||minicolors.hasClass('minicolors-focus'))return;hide();minicolors.addClass('minicolors-focus');panel.stop(true,true).fadeIn(settings.showSpeed,function(){if(settings.show)settings.show.call(input);});}
|
||||
function hide(){$('.minicolors-input').each(function(){var input=$(this),settings=input.data('minicolors-settings'),minicolors=input.parent();if(settings.inline)return;minicolors.find('.minicolors-panel').fadeOut(settings.hideSpeed,function(){if(minicolors.hasClass('minicolors-focus')){if(settings.hide)settings.hide.call(input);}
|
||||
minicolors.removeClass('minicolors-focus');});});}
|
||||
function move(target,event,animate){var input=target.parents('.minicolors').find('.minicolors-input'),settings=input.data('minicolors-settings'),picker=target.find('[class$=-picker]'),offsetX=target.offset().left,offsetY=target.offset().top,x=Math.round(event.pageX-offsetX),y=Math.round(event.pageY-offsetY),duration=animate?settings.animationSpeed:0,wx,wy,r,phi;if(event.originalEvent.changedTouches){x=event.originalEvent.changedTouches[0].pageX-offsetX;y=event.originalEvent.changedTouches[0].pageY-offsetY;}
|
||||
if(x<0)x=0;if(y<0)y=0;if(x>target.width())x=target.width();if(y>target.height())y=target.height();if(target.parent().is('.minicolors-slider-wheel')&&picker.parent().is('.minicolors-grid')){wx=75-x;wy=75-y;r=Math.sqrt(wx*wx+wy*wy);phi=Math.atan2(wy,wx);if(phi<0)phi+=Math.PI*2;if(r>75){r=75;x=75-(75*Math.cos(phi));y=75-(75*Math.sin(phi));}
|
||||
x=Math.round(x);y=Math.round(y);}
|
||||
if(target.is('.minicolors-grid')){picker.stop(true).animate({top:y+'px',left:x+'px'},duration,settings.animationEasing,function(){updateFromControl(input,target);});}else{picker.stop(true).animate({top:y+'px'},duration,settings.animationEasing,function(){updateFromControl(input,target);});}}
|
||||
function updateFromControl(input,target){function getCoords(picker,container){var left,top;if(!picker.length||!container)return null;left=picker.offset().left;top=picker.offset().top;return{x:left-container.offset().left+(picker.outerWidth()/2),y:top-container.offset().top+(picker.outerHeight()/2)};}
|
||||
var hue,saturation,brightness,rgb,x,y,r,phi,hex=input.val(),opacity=input.attr('data-opacity'),minicolors=input.parent(),settings=input.data('minicolors-settings'),panel=minicolors.find('.minicolors-panel'),swatch=minicolors.find('.minicolors-swatch'),grid=minicolors.find('.minicolors-grid'),slider=minicolors.find('.minicolors-slider'),opacitySlider=minicolors.find('.minicolors-opacity-slider'),gridPicker=grid.find('[class$=-picker]'),sliderPicker=slider.find('[class$=-picker]'),opacityPicker=opacitySlider.find('[class$=-picker]'),gridPos=getCoords(gridPicker,grid),sliderPos=getCoords(sliderPicker,slider),opacityPos=getCoords(opacityPicker,opacitySlider);if(target.is('.minicolors-grid, .minicolors-slider')){switch(settings.control){case'wheel':x=(grid.width()/2)-gridPos.x;y=(grid.height()/2)-gridPos.y;r=Math.sqrt(x*x+y*y);phi=Math.atan2(y,x);if(phi<0)phi+=Math.PI*2;if(r>75){r=75;gridPos.x=69-(75*Math.cos(phi));gridPos.y=69-(75*Math.sin(phi));}
|
||||
saturation=keepWithin(r/0.75,0,100);hue=keepWithin(phi*180/Math.PI,0,360);brightness=keepWithin(100-Math.floor(sliderPos.y*(100/slider.height())),0,100);hex=hsb2hex({h:hue,s:saturation,b:brightness});slider.css('backgroundColor',hsb2hex({h:hue,s:saturation,b:100}));break;case'saturation':hue=keepWithin(parseInt(gridPos.x*(360/grid.width())),0,360);saturation=keepWithin(100-Math.floor(sliderPos.y*(100/slider.height())),0,100);brightness=keepWithin(100-Math.floor(gridPos.y*(100/grid.height())),0,100);hex=hsb2hex({h:hue,s:saturation,b:brightness});slider.css('backgroundColor',hsb2hex({h:hue,s:100,b:brightness}));minicolors.find('.minicolors-grid-inner').css('opacity',saturation/100);break;case'brightness':hue=keepWithin(parseInt(gridPos.x*(360/grid.width())),0,360);saturation=keepWithin(100-Math.floor(gridPos.y*(100/grid.height())),0,100);brightness=keepWithin(100-Math.floor(sliderPos.y*(100/slider.height())),0,100);hex=hsb2hex({h:hue,s:saturation,b:brightness});slider.css('backgroundColor',hsb2hex({h:hue,s:saturation,b:100}));minicolors.find('.minicolors-grid-inner').css('opacity',1-(brightness/100));break;default:hue=keepWithin(360-parseInt(sliderPos.y*(360/slider.height())),0,360);saturation=keepWithin(Math.floor(gridPos.x*(100/grid.width())),0,100);brightness=keepWithin(100-Math.floor(gridPos.y*(100/grid.height())),0,100);hex=hsb2hex({h:hue,s:saturation,b:brightness});grid.css('backgroundColor',hsb2hex({h:hue,s:100,b:100}));break;}
|
||||
input.val(convertCase(hex,settings.letterCase));}
|
||||
if(target.is('.minicolors-opacity-slider')){if(settings.opacity){opacity=parseFloat(1-(opacityPos.y/opacitySlider.height())).toFixed(2);}else{opacity=1;}
|
||||
if(settings.opacity)input.attr('data-opacity',opacity);}
|
||||
swatch.find('SPAN').css({backgroundColor:hex,opacity:opacity});doChange(input,hex,opacity);}
|
||||
function updateFromInput(input,preserveInputValue,firstRun){var hex,hsb,opacity,x,y,r,phi,minicolors=input.parent(),settings=input.data('minicolors-settings'),swatch=minicolors.find('.minicolors-swatch'),grid=minicolors.find('.minicolors-grid'),slider=minicolors.find('.minicolors-slider'),opacitySlider=minicolors.find('.minicolors-opacity-slider'),gridPicker=grid.find('[class$=-picker]'),sliderPicker=slider.find('[class$=-picker]'),opacityPicker=opacitySlider.find('[class$=-picker]');hex=convertCase(parseHex(input.val(),true),settings.letterCase);if(!hex)hex=convertCase(parseHex(settings.defaultValue,true));hsb=hex2hsb(hex);if(!preserveInputValue)input.val(hex);if(settings.opacity){opacity=input.attr('data-opacity')===''?1:keepWithin(parseFloat(input.attr('data-opacity')).toFixed(2),0,1);if(isNaN(opacity))opacity=1;input.attr('data-opacity',opacity);swatch.find('SPAN').css('opacity',opacity);y=keepWithin(opacitySlider.height()-(opacitySlider.height()*opacity),0,opacitySlider.height());opacityPicker.css('top',y+'px');}
|
||||
swatch.find('SPAN').css('backgroundColor',hex);switch(settings.control){case'wheel':r=keepWithin(Math.ceil(hsb.s*0.75),0,grid.height()/2);phi=hsb.h*Math.PI/180;x=keepWithin(75-Math.cos(phi)*r,0,grid.width());y=keepWithin(75-Math.sin(phi)*r,0,grid.height());gridPicker.css({top:y+'px',left:x+'px'});y=150-(hsb.b/(100/grid.height()));if(hex==='')y=0;sliderPicker.css('top',y+'px');slider.css('backgroundColor',hsb2hex({h:hsb.h,s:hsb.s,b:100}));break;case'saturation':x=keepWithin((5*hsb.h)/12,0,150);y=keepWithin(grid.height()-Math.ceil(hsb.b/(100/grid.height())),0,grid.height());gridPicker.css({top:y+'px',left:x+'px'});y=keepWithin(slider.height()-(hsb.s*(slider.height()/100)),0,slider.height());sliderPicker.css('top',y+'px');slider.css('backgroundColor',hsb2hex({h:hsb.h,s:100,b:hsb.b}));minicolors.find('.minicolors-grid-inner').css('opacity',hsb.s/100);break;case'brightness':x=keepWithin((5*hsb.h)/12,0,150);y=keepWithin(grid.height()-Math.ceil(hsb.s/(100/grid.height())),0,grid.height());gridPicker.css({top:y+'px',left:x+'px'});y=keepWithin(slider.height()-(hsb.b*(slider.height()/100)),0,slider.height());sliderPicker.css('top',y+'px');slider.css('backgroundColor',hsb2hex({h:hsb.h,s:hsb.s,b:100}));minicolors.find('.minicolors-grid-inner').css('opacity',1-(hsb.b/100));break;default:x=keepWithin(Math.ceil(hsb.s/(100/grid.width())),0,grid.width());y=keepWithin(grid.height()-Math.ceil(hsb.b/(100/grid.height())),0,grid.height());gridPicker.css({top:y+'px',left:x+'px'});y=keepWithin(slider.height()-(hsb.h/(360/slider.height())),0,slider.height());sliderPicker.css('top',y+'px');grid.css('backgroundColor',hsb2hex({h:hsb.h,s:100,b:100}));break;}
|
||||
if(!firstRun)doChange(input,hex,opacity);}
|
||||
function doChange(input,hex,opacity){var settings=input.data('minicolors-settings');if(hex+opacity!==input.data('minicolors-lastChange')){input.data('minicolors-lastChange',hex+opacity);if(settings.change){if(settings.changeDelay){clearTimeout(input.data('minicolors-changeTimeout'));input.data('minicolors-changeTimeout',setTimeout(function(){settings.change.call(input,hex,opacity);},settings.changeDelay));}else{settings.change.call(input,hex,opacity);}}}}
|
||||
function rgbObject(input){var hex=parseHex($(input).val(),true),rgb=hex2rgb(hex),opacity=$(input).attr('data-opacity');if(!rgb)return null;if(opacity!==undefined)$.extend(rgb,{a:parseFloat(opacity)});return rgb;}
|
||||
function rgbString(input,alpha){var hex=parseHex($(input).val(),true),rgb=hex2rgb(hex),opacity=$(input).attr('data-opacity');if(!rgb)return null;if(opacity===undefined)opacity=1;if(alpha){return'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', '+parseFloat(opacity)+')';}else{return'rgb('+rgb.r+', '+rgb.g+', '+rgb.b+')';}}
|
||||
function convertCase(string,letterCase){return letterCase==='uppercase'?string.toUpperCase():string.toLowerCase();}
|
||||
function parseHex(string,expand){string=string.replace(/[^A-F0-9]/ig,'');if(string.length!==3&&string.length!==6)return'';if(string.length===3&&expand){string=string[0]+string[0]+string[1]+string[1]+string[2]+string[2];}
|
||||
return'#'+string;}
|
||||
function keepWithin(value,min,max){if(value<min)value=min;if(value>max)value=max;return value;}
|
||||
function hsb2rgb(hsb){var rgb={};var h=Math.round(hsb.h);var s=Math.round(hsb.s*255/100);var v=Math.round(hsb.b*255/100);if(s===0){rgb.r=rgb.g=rgb.b=v;}else{var t1=v;var t2=(255-s)*v/255;var t3=(t1-t2)*(h%60)/60;if(h===360)h=0;if(h<60){rgb.r=t1;rgb.b=t2;rgb.g=t2+t3;}
|
||||
else if(h<120){rgb.g=t1;rgb.b=t2;rgb.r=t1-t3;}
|
||||
else if(h<180){rgb.g=t1;rgb.r=t2;rgb.b=t2+t3;}
|
||||
else if(h<240){rgb.b=t1;rgb.r=t2;rgb.g=t1-t3;}
|
||||
else if(h<300){rgb.b=t1;rgb.g=t2;rgb.r=t2+t3;}
|
||||
else if(h<360){rgb.r=t1;rgb.g=t2;rgb.b=t1-t3;}
|
||||
else{rgb.r=0;rgb.g=0;rgb.b=0;}}
|
||||
return{r:Math.round(rgb.r),g:Math.round(rgb.g),b:Math.round(rgb.b)};}
|
||||
function rgb2hex(rgb){var hex=[rgb.r.toString(16),rgb.g.toString(16),rgb.b.toString(16)];$.each(hex,function(nr,val){if(val.length===1)hex[nr]='0'+val;});return'#'+hex.join('');}
|
||||
function hsb2hex(hsb){return rgb2hex(hsb2rgb(hsb));}
|
||||
function hex2hsb(hex){var hsb=rgb2hsb(hex2rgb(hex));if(hsb.s===0)hsb.h=360;return hsb;}
|
||||
function rgb2hsb(rgb){var hsb={h:0,s:0,b:0};var min=Math.min(rgb.r,rgb.g,rgb.b);var max=Math.max(rgb.r,rgb.g,rgb.b);var delta=max-min;hsb.b=max;hsb.s=max!==0?255*delta/max:0;if(hsb.s!==0){if(rgb.r===max){hsb.h=(rgb.g-rgb.b)/delta;}else if(rgb.g===max){hsb.h=2+(rgb.b-rgb.r)/delta;}else{hsb.h=4+(rgb.r-rgb.g)/delta;}}else{hsb.h=-1;}
|
||||
hsb.h*=60;if(hsb.h<0){hsb.h+=360;}
|
||||
hsb.s*=100/255;hsb.b*=100/255;return hsb;}
|
||||
function hex2rgb(hex){hex=parseInt(((hex.indexOf('#')>-1)?hex.substring(1):hex),16);return{r:hex>>16,g:(hex&0x00FF00)>>8,b:(hex&0x0000FF)};}
|
||||
$(document).on('mousedown.minicolors touchstart.minicolors',function(event){if(!$(event.target).parents().add(event.target).hasClass('minicolors')){hide();}}).on('mousedown.minicolors touchstart.minicolors','.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider',function(event){var target=$(this);event.preventDefault();$(document).data('minicolors-target',target);move(target,event,true);}).on('mousemove.minicolors touchmove.minicolors',function(event){var target=$(document).data('minicolors-target');if(target)move(target,event);}).on('mouseup.minicolors touchend.minicolors',function(){$(this).removeData('minicolors-target');}).on('mousedown.minicolors touchstart.minicolors','.minicolors-swatch',function(event){var input=$(this).parent().find('.minicolors-input'),minicolors=input.parent();if(minicolors.hasClass('minicolors-focus')){hide(input);}else{show(input);}}).on('focus.minicolors','.minicolors-input',function(event){var input=$(this);if(!input.data('minicolors-initialized'))return;show(input);}).on('blur.minicolors','.minicolors-input',function(event){var input=$(this),settings=input.data('minicolors-settings');if(!input.data('minicolors-initialized'))return;input.val(parseHex(input.val(),true));if(input.val()==='')input.val(parseHex(settings.defaultValue,true));input.val(convertCase(input.val(),settings.letterCase));}).on('keydown.minicolors','.minicolors-input',function(event){var input=$(this);if(!input.data('minicolors-initialized'))return;switch(event.keyCode){case 9:hide();break;case 27:hide();input.blur();break;}}).on('keyup.minicolors','.minicolors-input',function(event){var input=$(this);if(!input.data('minicolors-initialized'))return;updateFromInput(input,true);}).on('paste.minicolors','.minicolors-input',function(event){var input=$(this);if(!input.data('minicolors-initialized'))return;setTimeout(function(){updateFromInput(input,true);},1);});})(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, '').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,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);
|
||||
2
wp-content/plugins/wp-table-manager-light/app/admin/assets/js/jquery.textselect.min.js
vendored
Normal file
2
wp-content/plugins/wp-table-manager-light/app/admin/assets/js/jquery.textselect.min.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
//From http://stackoverflow.com/questions/985272/jquery-selecting-text-in-an-element-akin-to-highlighting-with-your-mouse
|
||||
(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-table-manager-light/app/admin/assets/js/jquery.ui.touch-punch.min.js
vendored
Normal file
6
wp-content/plugins/wp-table-manager-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,27 @@
|
||||
function wptm_frameload() {
|
||||
jQuery("#wptm_loader").hide();
|
||||
jQuery("#wptmmodalframe").css('visibility',"visible");
|
||||
jQuery("#wptmmodalframe").show();
|
||||
}
|
||||
jQuery(document).ready(function($){
|
||||
$('.wptmlaunch').wptm_leanModal({ top : 20, beforeShow: function(){ $("#wptmmodal").css("height","90%"); $("#wptmmodalframe").css('visibility','hidden'); $("#wptmmodalframe").attr('src', $("#wptmmodalframe").attr('src')); $("#wptm_loader").show(); } });
|
||||
$('body').append('<div id="wptmmodal"><img src="images/spinner-2x.gif" width="32" id="wptm_loader" /> <iframe id="wptmmodalframe" onload="wptm_frameload()" width="100%" height="100%" marginWidth="0" marginHeight="0" frameBorder="0" scrolling="auto" src="admin.php?page=wptm&noheader=1&caninsert=1" /><button id="wptm-close-modal" onclick="jQuery(\'#lean_overlay\',window.parent.document).fadeOut(300);jQuery(\'#wptmmodal\',window.parent.document).fadeOut(300);" style="position: absolute; right: -23px;">x</button></div>');
|
||||
|
||||
$('body').on("click", ".wptmlaunch", function (e) {
|
||||
$("#wptmmodal").css("height", "90%");
|
||||
$("#wptmmodalframe").css('visibility', 'hidden');
|
||||
$("#wptmmodalframe").attr('src', $("#wptmmodalframe").attr('src'));
|
||||
$("#wptm_loader").show();
|
||||
|
||||
var modal_id = $(this).attr("href");
|
||||
//var modal_height=$(modal_id).outerHeight();
|
||||
var modal_width = $(modal_id).outerWidth();
|
||||
$("#lean_overlay").css({"display": "block", opacity: 0});
|
||||
$("#lean_overlay").fadeTo(200, 0.5);
|
||||
$(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": "20px"});
|
||||
$(modal_id).fadeTo(200, 1);
|
||||
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user