Update
This commit is contained in:
19
public/admin/plugins/tmce/bootstrap/js/bootstrap-iconpicker.min.js
vendored
Normal file
19
public/admin/plugins/tmce/bootstrap/js/bootstrap-iconpicker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
public/admin/plugins/tmce/bootstrap/js/bootstrap.min.js
vendored
Normal file
6
public/admin/plugins/tmce/bootstrap/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
485
public/admin/plugins/tmce/bootstrap/js/colorpicker.js
Normal file
485
public/admin/plugins/tmce/bootstrap/js/colorpicker.js
Normal file
@@ -0,0 +1,485 @@
|
||||
(function(e) {
|
||||
var t = function() {
|
||||
function x(e) {
|
||||
if (e.originalEvent.preventDefault) e.originalEvent.preventDefault();
|
||||
return false;
|
||||
}
|
||||
var t = 65, n = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><label for="hex">#</label><input type="text" maxlength="6" size="6" id="hex" /></div><div class="colorpicker_rgb_r colorpicker_field"><label for="rbg_r">R</label><input type="text" maxlength="3" size="3" id="rgb_r" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><label for="rbg_g">G</label><input type="text" maxlength="3" size="3" id="rgb_g" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><label for="rbg_b">B</label><input type="text" maxlength="3" size="3" id="rgb_b" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><label for="hsb_h">H</label><input type="text" maxlength="3" size="3" id="hsb_h" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><label for="hsb_s">S</label><input type="text" maxlength="3" size="3" id="hsb_s" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><label for="hsb_b">B</label><input type="text" maxlength="3" size="3" id="hsb_b" /><span></span></div><div class="colorpicker_submit"></div></div>', r = {
|
||||
eventName: "click",
|
||||
onShow: function() {},
|
||||
onBeforeShow: function() {},
|
||||
onHide: function() {},
|
||||
onChange: function() {},
|
||||
onSubmit: function() {},
|
||||
color: "ff0000",
|
||||
livePreview: true,
|
||||
flat: false
|
||||
}, i = function(t, n) {
|
||||
var r = HSBToRGB(t);
|
||||
e(n).data("colorpicker").fields.eq(1).val(r.r).end().eq(2).val(r.g).end().eq(3).val(r.b).end();
|
||||
}, s = function(t, n) {
|
||||
e(n).data("colorpicker").fields.eq(4).val(t.h).end().eq(5).val(t.s).end().eq(6).val(t.b).end();
|
||||
}, o = function(t, n) {
|
||||
e(n).data("colorpicker").fields.eq(0).val(HSBToHex(t)).end();
|
||||
}, u = function(t, n) {
|
||||
e(n).data("colorpicker").selector.css("backgroundColor", "#" + HSBToHex({
|
||||
h: t.h,
|
||||
s: 100,
|
||||
b: 100
|
||||
}));
|
||||
e(n).data("colorpicker").selectorIndic.css({
|
||||
left: parseInt(150 * t.s / 100, 10),
|
||||
top: parseInt(150 * (100 - t.b) / 100, 10)
|
||||
});
|
||||
}, a = function(t, n) {
|
||||
e(n).data("colorpicker").hue.css("top", parseInt(150 - 150 * t.h / 360, 10));
|
||||
}, f = function(t, n) {
|
||||
e(n).data("colorpicker").currentColor.css("backgroundColor", "#" + HSBToHex(t));
|
||||
}, l = function(t, n) {
|
||||
e(n).data("colorpicker").newColor.css("backgroundColor", "#" + HSBToHex(t));
|
||||
}, c = function(n) {
|
||||
var r = n.charCode || n.keyCode || -1;
|
||||
if (r > t && r <= 90 || r === 32) {
|
||||
return false;
|
||||
}
|
||||
var i = e(this).parent().parent();
|
||||
if (i.data("colorpicker").livePreview === true) {
|
||||
h.apply(this);
|
||||
}
|
||||
}, h = function(t) {
|
||||
var n = e(this).parent().parent(), r;
|
||||
if (this.parentNode.className.indexOf("_hex") > 0) {
|
||||
n.data("colorpicker").color = r = HexToHSB(fixHex(this.value));
|
||||
} else if (this.parentNode.className.indexOf("_hsb") > 0) {
|
||||
n.data("colorpicker").color = r = fixHSB({
|
||||
h: parseInt(n.data("colorpicker").fields.eq(4).val(), 10),
|
||||
s: parseInt(n.data("colorpicker").fields.eq(5).val(), 10),
|
||||
b: parseInt(n.data("colorpicker").fields.eq(6).val(), 10)
|
||||
});
|
||||
} else {
|
||||
n.data("colorpicker").color = r = RGBToHSB(fixRGB({
|
||||
r: parseInt(n.data("colorpicker").fields.eq(1).val(), 10),
|
||||
g: parseInt(n.data("colorpicker").fields.eq(2).val(), 10),
|
||||
b: parseInt(n.data("colorpicker").fields.eq(3).val(), 10)
|
||||
}));
|
||||
}
|
||||
if (t) {
|
||||
i(r, n.get(0));
|
||||
o(r, n.get(0));
|
||||
s(r, n.get(0));
|
||||
}
|
||||
u(r, n.get(0));
|
||||
a(r, n.get(0));
|
||||
l(r, n.get(0));
|
||||
n.data("colorpicker").onChange.apply(n, [ r, HSBToHex(r), HSBToRGB(r) ]);
|
||||
}, p = function(t) {
|
||||
var n = e(this).parent().parent();
|
||||
n.data("colorpicker").fields.parent().removeClass("colorpicker_focus");
|
||||
}, d = function() {
|
||||
t = this.parentNode.className.indexOf("_hex") > 0 ? 70 : 65;
|
||||
e(this).parent().parent().data("colorpicker").fields.parent().removeClass("colorpicker_focus");
|
||||
e(this).parent().addClass("colorpicker_focus");
|
||||
}, v = function(t) {
|
||||
var n = e(this).parent().find("input").focus();
|
||||
var r = {
|
||||
el: e(this).parent().addClass("colorpicker_slider"),
|
||||
max: this.parentNode.className.indexOf("_hsb_h") > 0 ? 360 : this.parentNode.className.indexOf("_hsb") > 0 ? 100 : 255,
|
||||
y: t.pageY,
|
||||
field: n,
|
||||
val: parseInt(n.val(), 10),
|
||||
preview: e(this).parent().parent().data("colorpicker").livePreview
|
||||
};
|
||||
e(document).on("mouseup", r, g);
|
||||
e(document).on("mousemove", r, m);
|
||||
return x(t);
|
||||
}, m = function(e) {
|
||||
e.data.field.val(Math.max(0, Math.min(e.data.max, parseInt(e.data.val + e.pageY - e.data.y, 10))));
|
||||
if (e.data.preview) {
|
||||
h.apply(e.data.field.get(0), [ true ]);
|
||||
}
|
||||
return false;
|
||||
}, g = function(t) {
|
||||
h.apply(t.data.field.get(0), [ true ]);
|
||||
t.data.el.removeClass("colorpicker_slider").find("input").focus();
|
||||
e(document).off("mouseup", g);
|
||||
e(document).off("mousemove", m);
|
||||
return false;
|
||||
}, b = function(t) {
|
||||
var n = {
|
||||
cal: e(this).parent(),
|
||||
y: e(this).offset().top
|
||||
};
|
||||
n.preview = n.cal.data("colorpicker").livePreview;
|
||||
e(document).on("mouseup", n, E);
|
||||
e(document).on("mousemove", n, w);
|
||||
return x(t);
|
||||
}, w = function(e) {
|
||||
h.apply(e.data.cal.data("colorpicker").fields.eq(4).val(parseInt(360 * (150 - Math.max(0, Math.min(150, e.pageY - e.data.y))) / 150, 10)).get(0), [ e.data.preview ]);
|
||||
return false;
|
||||
}, E = function(t) {
|
||||
i(t.data.cal.data("colorpicker").color, t.data.cal.get(0));
|
||||
o(t.data.cal.data("colorpicker").color, t.data.cal.get(0));
|
||||
e(document).off("mouseup", E);
|
||||
e(document).off("mousemove", w);
|
||||
return false;
|
||||
}, S = function(t) {
|
||||
y = e(this).offset().top;
|
||||
preview = t.data.cal.data("colorpicker").livePreview;
|
||||
h.apply(t.data.cal.data("colorpicker").fields.eq(4).val(parseInt(360 * (150 - Math.max(0, Math.min(150, t.pageY - y))) / 150, 10)).get(0), [ preview ]);
|
||||
};
|
||||
downSelector = function(t) {
|
||||
var n = {
|
||||
cal: e(this).parent(),
|
||||
pos: e(this).offset()
|
||||
};
|
||||
n.preview = n.cal.data("colorpicker").livePreview;
|
||||
e(document).on("mouseup", n, upSelector);
|
||||
e(document).on("mousemove", n, moveSelector);
|
||||
e(".colorpicker_color", n.cal).one("click", n, moveSelector);
|
||||
t.data = n;
|
||||
moveSelector(t);
|
||||
return x(t);
|
||||
}, moveSelector = function(e) {
|
||||
h.apply(e.data.cal.data("colorpicker").fields.eq(6).val(parseInt(100 * (150 - Math.max(0, Math.min(150, e.pageY - e.data.pos.top))) / 150, 10)).end().eq(5).val(parseInt(100 * Math.max(0, Math.min(150, e.pageX - e.data.pos.left)) / 150, 10)).get(0), [ e.data.preview ]);
|
||||
return false;
|
||||
}, upSelector = function(t) {
|
||||
var n = {
|
||||
cal: e(this).parent(),
|
||||
pos: e(this).offset()
|
||||
};
|
||||
i(t.data.cal.data("colorpicker").color, t.data.cal.get(0));
|
||||
o(t.data.cal.data("colorpicker").color, t.data.cal.get(0));
|
||||
e(document).off("mouseup", upSelector);
|
||||
e(document).off("mousemove", moveSelector);
|
||||
return false;
|
||||
}, enterSubmit = function(t) {
|
||||
e(this).addClass("colorpicker_focus");
|
||||
}, leaveSubmit = function(t) {
|
||||
e(this).removeClass("colorpicker_focus");
|
||||
}, clickSubmit = function(t) {
|
||||
var n = e(this).parent();
|
||||
var r = n.data("colorpicker").color;
|
||||
n.data("colorpicker").origColor = r;
|
||||
f(r, n.get(0));
|
||||
n.data("colorpicker").onSubmit(r, HSBToHex(r), HSBToRGB(r), n.data("colorpicker").el, n.data("colorpicker").parent);
|
||||
}, show = function(t) {
|
||||
var n = e("#" + e(this).data("colorpickerId"));
|
||||
n.data("colorpicker").onBeforeShow.apply(this, [ n.get(0) ]);
|
||||
var r = e(this).offset();
|
||||
var i = getViewport();
|
||||
var s = r.top + this.offsetHeight;
|
||||
var o = r.left;
|
||||
if (s + 176 > i.t + i.h) {
|
||||
s -= this.offsetHeight + 176;
|
||||
}
|
||||
if (o + 356 > i.l + i.w) {
|
||||
o -= 356;
|
||||
}
|
||||
n.css({
|
||||
left: o + "px",
|
||||
top: s + "px"
|
||||
});
|
||||
if (n.data("colorpicker").onShow.apply(this, [ n.get(0) ]) != false) {
|
||||
n.show();
|
||||
}
|
||||
e(document).on("mousedown", {
|
||||
cal: n
|
||||
}, hide);
|
||||
return false;
|
||||
}, hide = function(t) {
|
||||
if (!isChildOf(t.data.cal.get(0), t.target, t.data.cal.get(0))) {
|
||||
if (t.data.cal.data("colorpicker").onHide.apply(this, [ t.data.cal.get(0) ]) != false) {
|
||||
t.data.cal.hide();
|
||||
}
|
||||
e(document).off("mousedown", hide);
|
||||
}
|
||||
}, isChildOf = function(e, t, n) {
|
||||
if (e === t) {
|
||||
return true;
|
||||
}
|
||||
if (e.contains) {
|
||||
return e.contains(t);
|
||||
}
|
||||
if (e.compareDocumentPosition) {
|
||||
return !!(e.compareDocumentPosition(t) & 16);
|
||||
}
|
||||
var r = t.parentNode;
|
||||
while (r && r !== n) {
|
||||
if (r === e) {
|
||||
return true;
|
||||
}
|
||||
r = r.parentNode;
|
||||
}
|
||||
return false;
|
||||
}, getViewport = function() {
|
||||
var e = document.compatMode == "CSS1Compat";
|
||||
return {
|
||||
l: window.pageXOffset || (e ? document.documentElement.scrollLeft : document.body.scrollLeft),
|
||||
t: window.pageYOffset || (e ? document.documentElement.scrollTop : document.body.scrollTop),
|
||||
w: window.innerWidth || (e ? document.documentElement.clientWidth : document.body.clientWidth),
|
||||
h: window.innerHeight || (e ? document.documentElement.clientHeight : document.body.clientHeight)
|
||||
};
|
||||
}, fixHSB = function(e) {
|
||||
return {
|
||||
h: Math.min(360, Math.max(0, e.h)),
|
||||
s: Math.min(100, Math.max(0, e.s)),
|
||||
b: Math.min(100, Math.max(0, e.b))
|
||||
};
|
||||
}, fixRGB = function(e) {
|
||||
return {
|
||||
r: Math.min(255, Math.max(0, e.r)),
|
||||
g: Math.min(255, Math.max(0, e.g)),
|
||||
b: Math.min(255, Math.max(0, e.b))
|
||||
};
|
||||
}, fixHex = function(e) {
|
||||
var t = 6 - e.length;
|
||||
if (t > 0) {
|
||||
var n = [];
|
||||
for (var r = 0; r < t; r++) {
|
||||
n.push("0");
|
||||
}
|
||||
n.push(e);
|
||||
e = n.join("");
|
||||
}
|
||||
return e;
|
||||
}, HexToRGB = function(e) {
|
||||
e = parseInt(e.indexOf("#") > -1 ? e.substring(1) : e, 16);
|
||||
return {
|
||||
r: e >> 16,
|
||||
g: (e & 65280) >> 8,
|
||||
b: e & 255
|
||||
};
|
||||
}, HexToHSB = function(e) {
|
||||
return RGBToHSB(HexToRGB(e));
|
||||
}, RGBToHSB = function(e) {
|
||||
var t = {
|
||||
h: 0,
|
||||
s: 0,
|
||||
b: 0
|
||||
};
|
||||
var n = Math.min(e.r, e.g, e.b);
|
||||
var r = Math.max(e.r, e.g, e.b);
|
||||
var i = r - n;
|
||||
t.b = r;
|
||||
t.s = r != 0 ? 255 * i / r : 0;
|
||||
if (t.s != 0) {
|
||||
if (e.r === r) {
|
||||
t.h = (e.g - e.b) / i;
|
||||
} else if (e.g === r) {
|
||||
t.h = 2 + (e.b - e.r) / i;
|
||||
} else {
|
||||
t.h = 4 + (e.r - e.g) / i;
|
||||
}
|
||||
} else {
|
||||
t.h = -1;
|
||||
}
|
||||
t.h *= 60;
|
||||
if (t.h < 0) {
|
||||
t.h += 360;
|
||||
}
|
||||
t.s *= 100 / 255;
|
||||
t.b *= 100 / 255;
|
||||
return t;
|
||||
}, HSBToRGB = function(e) {
|
||||
var t = {};
|
||||
var n = Math.round(e.h);
|
||||
var r = Math.round(e.s * 255 / 100);
|
||||
var i = Math.round(e.b * 255 / 100);
|
||||
if (r == 0) {
|
||||
t.r = t.g = t.b = i;
|
||||
} else {
|
||||
var s = i;
|
||||
var o = (255 - r) * i / 255;
|
||||
var u = (s - o) * (n % 60) / 60;
|
||||
if (n === 360) {
|
||||
n = 0;
|
||||
}
|
||||
if (n < 60) {
|
||||
t.r = s;
|
||||
t.b = o;
|
||||
t.g = o + u;
|
||||
} else if (n < 120) {
|
||||
t.g = s;
|
||||
t.b = o;
|
||||
t.r = s - u;
|
||||
} else if (n < 180) {
|
||||
t.g = s;
|
||||
t.r = o;
|
||||
t.b = o + u;
|
||||
} else if (n < 240) {
|
||||
t.b = s;
|
||||
t.r = o;
|
||||
t.g = s - u;
|
||||
} else if (n < 300) {
|
||||
t.b = s;
|
||||
t.g = o;
|
||||
t.r = o + u;
|
||||
} else if (n < 360) {
|
||||
t.r = s;
|
||||
t.g = o;
|
||||
t.b = s - u;
|
||||
} else {
|
||||
t.r = 0;
|
||||
t.g = 0;
|
||||
t.b = 0;
|
||||
}
|
||||
}
|
||||
return {
|
||||
r: Math.round(t.r),
|
||||
g: Math.round(t.g),
|
||||
b: Math.round(t.b)
|
||||
};
|
||||
}, RGBToHex = function(t) {
|
||||
var n = [ t.r.toString(16), t.g.toString(16), t.b.toString(16) ];
|
||||
e.each(n, function(e, t) {
|
||||
if (t.length === 1) {
|
||||
n[e] = "0" + t;
|
||||
}
|
||||
});
|
||||
return n.join("");
|
||||
}, RGBstringToHex = function(e) {
|
||||
function n(e) {
|
||||
return ("0" + parseInt(e, 10).toString(16)).slice(-2);
|
||||
}
|
||||
if (!e) {
|
||||
return "#FFFFFF";
|
||||
}
|
||||
var t = e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
||||
if (t) {
|
||||
return "#" + n(t[1]) + n(t[2]) + n(t[3]);
|
||||
} else {
|
||||
return e;
|
||||
}
|
||||
}, HSBToHex = function(e) {
|
||||
return RGBToHex(HSBToRGB(e));
|
||||
}, restoreOriginal = function() {
|
||||
var t = e(this).parent();
|
||||
var n = t.data("colorpicker").origColor;
|
||||
t.data("colorpicker").color = n;
|
||||
i(n, t.get(0));
|
||||
o(n, t.get(0));
|
||||
s(n, t.get(0));
|
||||
u(n, t.get(0));
|
||||
a(n, t.get(0));
|
||||
l(n, t.get(0));
|
||||
};
|
||||
return {
|
||||
init: function(t) {
|
||||
t = e.extend({}, r, t || {});
|
||||
if (typeof t.color == "string") {
|
||||
if (t.color.substring(0, 4) == "rgb(") {
|
||||
t.color = HexToHSB(RGBstringToHex(t.color));
|
||||
} else {
|
||||
t.color = HexToHSB(t.color);
|
||||
}
|
||||
} else if (t.color.r !== undefined && t.color.g !== undefined && t.color.b !== undefined) {
|
||||
t.color = RGBToHSB(t.color);
|
||||
} else if (t.color.h !== undefined && t.color.s !== undefined && t.color.b !== undefined) {
|
||||
t.color = fixHSB(t.color);
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
return this.each(function() {
|
||||
if (!e(this).data("colorpickerId")) {
|
||||
var r = e.extend({}, t);
|
||||
r.origColor = t.color;
|
||||
var m, g = 0;
|
||||
m = e("#colorpicker_" + g).length === 0;
|
||||
while (!m) {
|
||||
g = parseInt(Math.random() * 1e4);
|
||||
m = e("#colorpicker_" + g).length === 0;
|
||||
}
|
||||
var y = "colorpicker_" + g;
|
||||
e(this).data("colorpickerId", y);
|
||||
r.parent = e(this);
|
||||
var w = e(n);
|
||||
w.attr("id", y).attr("data-parent", e(this).attr("id"));
|
||||
if (r.flat) {
|
||||
w.appendTo(this).show();
|
||||
} else {
|
||||
w.appendTo(document.body);
|
||||
}
|
||||
r.fields = w.find("input").on("keyup", c).on("change", h).on("blur", p).on("focus", d);
|
||||
w.find("span").on("mousedown", v).end().find(">div.colorpicker_current_color").on("click", restoreOriginal);
|
||||
r.selector = w.find("div.colorpicker_color").on("mousedown", downSelector);
|
||||
r.selectorIndic = r.selector.find("div div");
|
||||
r.el = this;
|
||||
r.hue = w.find("div.colorpicker_hue div");
|
||||
w.find("div.colorpicker_hue").on("mousedown", b);
|
||||
w.find("div.colorpicker_hue").on("mousedown", {
|
||||
cal: w
|
||||
}, S);
|
||||
r.newColor = w.find("div.colorpicker_new_color");
|
||||
r.currentColor = w.find("div.colorpicker_current_color");
|
||||
w.data("colorpicker", r);
|
||||
w.find("div.colorpicker_submit").on("mouseenter", enterSubmit).on("mouseleave", leaveSubmit).on("click", clickSubmit);
|
||||
i(r.color, w.get(0));
|
||||
s(r.color, w.get(0));
|
||||
o(r.color, w.get(0));
|
||||
a(r.color, w.get(0));
|
||||
u(r.color, w.get(0));
|
||||
f(r.color, w.get(0));
|
||||
l(r.color, w.get(0));
|
||||
if (r.flat) {
|
||||
w.css({
|
||||
position: "relative",
|
||||
display: "block"
|
||||
});
|
||||
} else {
|
||||
e(this).on(r.eventName, show);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
showPicker: function() {
|
||||
return this.each(function() {
|
||||
if (e(this).data("colorpickerId")) {
|
||||
show.apply(this);
|
||||
}
|
||||
});
|
||||
},
|
||||
hidePicker: function() {
|
||||
return this.each(function() {
|
||||
if (e(this).data("colorpickerId")) {
|
||||
e("#" + e(this).data("colorpickerId")).hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
setColor: function(t) {
|
||||
if (typeof t == "string") {
|
||||
if (t.substring(0, 4) == "rgb(") {
|
||||
t = HexToHSB(RGBstringToHex(t));
|
||||
} else {
|
||||
t = HexToHSB(t);
|
||||
}
|
||||
} else if (t.r !== undefined && t.g !== undefined && t.b !== undefined) {
|
||||
t = RGBToHSB(t);
|
||||
} else if (t.h !== undefined && t.s !== undefined && t.b !== undefined) {
|
||||
t = fixHSB(t);
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
return this.each(function() {
|
||||
if (e(this).data("colorpickerId")) {
|
||||
var n = e("#" + e(this).data("colorpickerId"));
|
||||
n.data("colorpicker").color = t;
|
||||
n.data("colorpicker").origColor = t;
|
||||
i(t, n.get(0));
|
||||
s(t, n.get(0));
|
||||
o(t, n.get(0));
|
||||
a(t, n.get(0));
|
||||
u(t, n.get(0));
|
||||
f(t, n.get(0));
|
||||
l(t, n.get(0));
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}();
|
||||
e.fn.extend({
|
||||
ColorPicker: t.init,
|
||||
ColorPickerHide: t.hidePicker,
|
||||
ColorPickerShow: t.showPicker,
|
||||
ColorPickerSetColor: t.setColor
|
||||
});
|
||||
})(jQuery);
|
||||
1
public/admin/plugins/tmce/bootstrap/js/colorpicker.min.js
vendored
Normal file
1
public/admin/plugins/tmce/bootstrap/js/colorpicker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
22
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-elusiveicon-2.0.0.min.js
vendored
Normal file
22
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-elusiveicon-2.0.0.min.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*!========================================================================
|
||||
* Bootstrap: iconset-elusiveicon-2.0.0.js by @recktoner
|
||||
* https://victor-valencia.github.com/bootstrap-iconpicker
|
||||
*
|
||||
* Iconset: Elusive icons 2.0.0
|
||||
* http://press.codes/downloads/elusive-icons-webfont/
|
||||
* ========================================================================
|
||||
* Copyright 2013-2015 Victor Valencia Rico.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ======================================================================== */
|
||||
!function($){$.iconset_elusiveicon={iconClass:"",iconClassFix:"el-icon-",icons:["","zoom-out","zoom-in","youtube","wrench-alt","wrench","wordpress","wheelchair","website-alt","website","warning-sign","w3c","volume-up","volume-off","volume-down","vkontakte","vimeo","view-mode","video-chat","video-alt","video","viadeo","user","usd","upload","unlock-alt","unlock","universal-access","twitter","tumblr","trash-alt","trash","torso","tint","time-alt","time","thumbs-up","thumbs-down","th-list","th-large","th","text-width","text-height","tasks","tags","tag","stumbleupon","stop-alt","stop","step-forward","step-backward","star-empty","star-alt","star","stackoverflow","spotify","speaker","soundcloud","smiley-alt","smiley","slideshare","skype","signal","shopping-cart-sign","shopping-cart","share-alt","share","search-alt","search","screenshot","screen-alt","screen","scissors","rss","road","reverse-alt","retweet","return-key","resize-vertical","resize-small","resize-horizontal","resize-full","repeat-alt","repeat","remove-sign","remove-circle","remove","refresh","reddit","record","random","quotes-alt","quotes","question-sign","question","qrcode","puzzle","print","podcast","plus-sign","plus","play-circle","play-alt","play","plane","pinterest","picture","picasa","photo-alt","photo","phone-alt","phone","person","pencil-alt","pencil","pause-alt","pause","path","paper-clip-alt","paper-clip","opensource","ok-sign","ok-circle","ok","off","network","myspace","music","move","minus-sign","minus","mic-alt","mic","map-marker-alt","map-marker","male","magnet","magic","lock-alt","lock","livejournal","list-alt","list","linkedin","link","lines","leaf","lastfm","laptop-alt","laptop","key","italic","iphone-home","instagram","info-sign","indent-right","indent-left","inbox-box","inbox-alt","inbox","idea-alt","idea","hourglass","home-alt","home","heart-empty","heart-alt","heart","hearing-impaired","headphones","hdd","hand-up","hand-right","hand-left","hand-down","guidedog","group-alt","group","graph-alt","graph","googleplus","globe-alt","globe","glasses","glass","github-text","github","gift","gbp","fullscreen","friendfeed-rect","friendfeed","foursquare","forward-alt","forward","fork","fontsize","font","folder-sign","folder-open","folder-close","folder","flickr","flag-alt","flag","fire","filter","film","file-new-alt","file-new","file-edit-alt","file-edit","file-alt","file","female","fast-forward","fast-backward","facetime-video","facebook","eye-open","eye-close","exclamation-sign","eur","error-alt","error","envelope-alt","envelope","eject","edit","dribbble","download-alt","download","digg","deviantart","delicious","dashboard","css","credit-card","compass-alt","compass","comment-alt","comment","cogs","cog-alt","cog","cloud-alt","cloud","circle-arrow-up","circle-arrow-right","circle-arrow-left","circle-arrow-down","child","chevron-up","chevron-right","chevron-left","chevron-down","check-empty","check","certificate","cc","caret-up","caret-right","caret-left","caret-down","car","camera","calendar-sign","calendar","bullhorn","bulb","brush","broom","briefcase","braille","bookmark-empty","bookmark","book","bold","blogger","blind","bell","behance","barcode","ban-circle","backward","asl","arrow-up","arrow-right","arrow-left","arrow-down","align-right","align-left","align-justify","align-center","adult","adjust-alt","adjust","address-book-alt","address-book","asterisk"]}}(jQuery);
|
||||
22
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-fontawesome-4.2.0.min.js
vendored
Normal file
22
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-fontawesome-4.2.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
21
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-glyphicon.min.js
vendored
Normal file
21
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-glyphicon.min.js
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/*!========================================================================
|
||||
* Bootstrap: iconset-glyphicon.js by @recktoner
|
||||
* https://victor-valencia.github.com/bootstrap-iconpicker
|
||||
*
|
||||
* Iconset: Glyphicons
|
||||
* ========================================================================
|
||||
* Copyright 2013-2015 Victor Valencia Rico.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ======================================================================== */
|
||||
!function($){$.iconset_glyphicon={iconClass:"glyphicon",iconClassFix:"glyphicon-",icons:["","adjust","align-center","align-justify","align-left","align-right","arrow-down","arrow-left","arrow-right","arrow-up","asterisk","backward","ban-circle","barcode","bell","bold","book","bookmark","briefcase","bullhorn","calendar","camera","certificate","check","chevron-down","chevron-left","chevron-right","chevron-up","circle-arrow-down","circle-arrow-left","circle-arrow-right","circle-arrow-up","cloud","cloud-download","cloud-upload","cog","collapse-down","collapse-up","comment","compressed","copyright-mark","credit-card","cutlery","dashboard","download","download-alt","earphone","edit","eject","envelope","euro","exclamation-sign","expand","export","eye-close","eye-open","facetime-video","fast-backward","fast-forward","file","film","filter","fire","flag","flash","floppy-disk","floppy-open","floppy-remove","floppy-save","floppy-saved","folder-close","folder-open","font","forward","fullscreen","gbp","gift","glass","globe","hand-down","hand-left","hand-right","hand-up","hd-video","hdd","header","headphones","heart","heart-empty","home","import","inbox","indent-left","indent-right","info-sign","italic","leaf","link","list","list-alt","lock","log-in","log-out","magnet","map-marker","minus","minus-sign","move","music","new-window","off","ok","ok-circle","ok-sign","open","paperclip","pause","pencil","phone","phone-alt","picture","plane","play","play-circle","plus","plus-sign","print","pushpin","qrcode","question-sign","random","record","refresh","registration-mark","remove","remove-circle","remove-sign","repeat","resize-full","resize-horizontal","resize-small","resize-vertical","retweet","road","save","saved","screenshot","sd-video","search","send","share","share-alt","shopping-cart","signal","sort","sort-by-alphabet","sort-by-alphabet-alt","sort-by-attributes","sort-by-attributes-alt","sort-by-order","sort-by-order-alt","sound-5-1","sound-6-1","sound-7-1","sound-dolby","sound-stereo","star","star-empty","stats","step-backward","step-forward","stop","subtitles","tag","tags","tasks","text-height","text-width","th","th-large","th-list","thumbs-down","thumbs-up","time","tint","tower","transfer","trash","tree-conifer","tree-deciduous","unchecked","upload","usd","user","volume-down","volume-off","volume-up","warning-sign","wrench","zoom-in","zoom-out"]}}(jQuery);
|
||||
22
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-ionicon-1.5.2.min.js
vendored
Normal file
22
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-ionicon-1.5.2.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
22
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-mapicon-2.1.0.min.js
vendored
Normal file
22
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-mapicon-2.1.0.min.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*!========================================================================
|
||||
* Bootstrap: iconset-mapicon-2.1.0.js by @recktoner
|
||||
* https://victor-valencia.github.com/bootstrap-iconpicker
|
||||
*
|
||||
* Iconset: Map Icons 2.1.0
|
||||
* https://github.com/scottdejonge/Map-Icons
|
||||
* ========================================================================
|
||||
* Copyright 2013-2015 Victor Valencia Rico.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ======================================================================== */
|
||||
!function($){$.iconset_mapicon={iconClass:"",iconClassFix:"map-icon-",icons:["","art-gallery","campground","bank","hair-care","gym","point-of-interest","post-box","post-office","university","beauty-salon","atm","rv-park","school","library","spa","route","postal-code","stadium","postal-code-prefix","museum","finance","natural-feature","funeral-home","cemetery","park","lodging","female","male","unisex","toilet","bakery","cafe","restaurant","food","liquor-store","bicycle-store","pet-store","hardware-store","book-store","furniture-store","department-store","electronics-store","jewelry-store","clothing-store","convenience-store","store","shopping-mall","movie-rental","grocery-or-supermarket","florist","laundry","abseiling","archery","baseball","bicycling","climbing","golf","hang-gliding","horse-riding","inline-skating","motobike-trail","playground","skateboarding","tennis","trail-walking","viewing","walking","boating","boat-ramp","boat-tour","canoe","diving","fishing","fishing-pier","fish-cleaning","jet-skiing","kayaking","marina","rafting","sailing","scuba-diving","surfing","swimming","waterskiing","whale-watching","wind-surfing","chairlift","cross-country-skiing","ice-fishing","ice-skating","ski-jumping","skiing","sledding","snow-shoeing","snow","snowboarding","snowmobile","train-station","subway-station","bus-station","transit-station","parking","gas-station","car-rental","car-dealer","car-repair","car-wash","airport","taxi-stand","health","dentist","doctor","hospital","pharmacy","physiotherapist","veterinary-care","bar","amusement-park","aquarium","casino","movie-theater","night-club","zoo","bowling-alley","storage","electrician","moving-company","painter","plumber","roofing-contractor","general-contractor","locksmith","insurance-agency","lawyer","real-estate-agency","travel-agency","accounting","courthouse","political","local-government","embassy","city-hall","fire-station","police","place-of-worship","church","mosque","synagogue","hindu-temple","wheelchair","closed-captioning","open-captioning","sign-language","volume-control-telephone","low-vision-access","braille","audio-description","assistive-listening-system","search","location-arrow","zoom-out","zoom-out-alt","zoom-in","zoom-in-alt","crosshairs","compass","expand","fullscreen","map-pin","square-pin","route-pin","sheild","circle","square-rounded","square"]}}(jQuery);
|
||||
22
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-materialdesign-1.1.1.min.js
vendored
Normal file
22
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-materialdesign-1.1.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
22
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-octicon-2.1.2.min.js
vendored
Normal file
22
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-octicon-2.1.2.min.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*!========================================================================
|
||||
* Bootstrap: iconset-octicon-2.1.2.js by @recktoner
|
||||
* https://victor-valencia.github.com/bootstrap-iconpicker
|
||||
*
|
||||
* Iconset: Octicons 2.1.2
|
||||
* https://octicons.github.com/
|
||||
* ========================================================================
|
||||
* Copyright 2013-2015 Victor Valencia Rico.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ======================================================================== */
|
||||
!function($){$.iconset_octicon={iconClass:"octicon",iconClassFix:"octicon-",icons:["","alert","alignment-align","alignment-aligned-to","alignment-unalign","arrow-down","arrow-left","arrow-right","arrow-small-down","arrow-small-left","arrow-small-right","arrow-small-up","arrow-up","beer","book","bookmark","briefcase","broadcast","browser","bug","calendar","check","checklist","chevron-down","chevron-left","chevron-right","chevron-up","circle-slash","circuit-board","clippy","clock","cloud-download","cloud-upload","code","color-mode","comment","comment-discussion","credit-card","dash","dashboard","database","device-camera","device-camera-video","device-desktop","device-mobile","diff","diff-added","diff-ignored","diff-modified","diff-removed","diff-renamed","ellipsis","eye","file-binary","file-code","file-directory","file-media","file-pdf","file-submodule","file-symlink-directory","file-symlink-file","file-text","file-zip","flame","fold","gear","gift","gist","gist-secret","git-branch","git-commit","git-compare","git-merge","git-pull-request","globe","graph","heart","history","home","horizontal-rule","hourglass","hubot","inbox","info","issue-closed","issue-opened","issue-reopened","jersey","jump-down","jump-left","jump-right","jump-up","key","keyboard","law","light-bulb","link","link-external","list-ordered","list-unordered","location","lock","mail","mail-read","mail-reply","mark-github","markdown","megaphone","mention","microscope","milestone","mirror","mortar-board","move-down","move-left","move-right","move-up","mute","no-newline","octoface","organization","package","paintcan","pencil","person","pin","playback-fast-forward","playback-pause","playback-play","playback-rewind","plug","plus","podium","primitive-dot","primitive-square","pulse","puzzle","question","quote","radio-tower","repo","repo-clone","repo-force-push","repo-forked","repo-pull","repo-push","rocket","rss","ruby","screen-full","screen-normal","search","server","settings","sign-in","sign-out","split","squirrel","star","steps","stop","sync","tag","telescope","terminal","three-bars","tools","trashcan","triangle-down","triangle-left","triangle-right","triangle-up","unfold","unmute","versions","x","zap"]}}(jQuery);
|
||||
22
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-typicon-2.0.6.min.js
vendored
Normal file
22
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-typicon-2.0.6.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
22
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-weathericon-1.2.0.min.js
vendored
Normal file
22
public/admin/plugins/tmce/bootstrap/js/iconset/iconset-weathericon-1.2.0.min.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*!========================================================================
|
||||
* Bootstrap: iconset-weathericon-1.2.0.js by @recktoner
|
||||
* https://victor-valencia.github.com/bootstrap-iconpicker
|
||||
*
|
||||
* Iconset: Weather Icons 1.2.0
|
||||
* http://erikflowers.github.io/weather-icons/
|
||||
* ========================================================================
|
||||
* Copyright 2013-2015 Victor Valencia Rico.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ======================================================================== */
|
||||
!function($){$.iconset_weathericon={iconClass:"wi",iconClassFix:"wi-",icons:["","smoke","dust","snow-wind","day-snow-wind","night-snow-wind","night-alt-snow-wind","day-sleet-storm","night-sleet-storm","night-alt-sleet-storm","day-snow-thunderstorm","night-snow-thunderstorm","night-alt-snow-thunderstorm","solar-eclipse","lunar-eclipse","meteor","hot","hurricane","smog","alien","snowflake-cold","stars","night-partly-cloudy","moon-full","moon-waxing-gibbous","moon-waxing-quarter","moon-waxing-crescent","moon-young","moon-new","moon-old","moon-waning-crescent","moon-waning-quarter","moon-waning-gibbous","day-cloudy-gusts","day-cloudy-windy","day-cloudy","day-fog","day-hail","day-lightning","day-rain-mix","day-rain-wind","day-rain","day-showers","day-snow","day-sprinkle","day-sunny-overcast","day-sunny","day-storm-showers","day-thunderstorm","cloudy-gusts","cloudy-windy","cloudy","fog","hail","lightning","rain-mix","rain-wind","rain","showers","snow","sprinkle","storm-showers","thunderstorm","night-alt-cloudy-gusts","night-alt-cloudy-windy","night-alt-hail","night-alt-lightning","night-alt-rain-mix","night-alt-rain-wind","night-alt-rain","night-alt-showers","night-alt-snow","night-alt-sprinkle","night-alt-storm-showers","night-alt-thunderstorm","night-clear","night-cloudy-gusts","night-cloudy-windy","night-cloudy","night-hail","night-lightning","night-rain-mix","night-rain-wind","night-rain","night-showers","night-snow","night-sprinkle","night-storm-showers","night-thunderstorm","celsius","cloud-down","cloud-refresh","cloud-up","cloud","degrees","down-left","down","fahrenheit","horizon-alt","horizon","left","lightning","night-fog","refresh-alt","refresh","right","sprinkles","strong-wind","sunrise","sunset","thermometer-exterior","thermometer-internal","thermometer","tornado","up-right","up","wind-east","wind-north-east","wind-north-west","wind-north","wind-south-east","wind-south-west","wind-south","wind-west","windy"]}}(jQuery);
|
||||
4
public/admin/plugins/tmce/bootstrap/js/jquery-2.1.1.min.js
vendored
Normal file
4
public/admin/plugins/tmce/bootstrap/js/jquery-2.1.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
592
public/admin/plugins/tmce/bootstrap/js/jquery.htmlClean.js
Normal file
592
public/admin/plugins/tmce/bootstrap/js/jquery.htmlClean.js
Normal file
@@ -0,0 +1,592 @@
|
||||
/*
|
||||
HTML Clean for jQuery
|
||||
Anthony Johnston
|
||||
http://www.antix.co.uk
|
||||
|
||||
version 1.4.2
|
||||
$Revision$
|
||||
requires jQuery http://jquery.com
|
||||
Use and distibution http://www.opensource.org/licenses/bsd-license.php
|
||||
2010-04-02 allowedTags/removeTags added (white/black list) thanks to David Wartian (Dwartian)
|
||||
2010-06-30 replaceStyles added for replacement of bold, italic, super and sub styles on a tag
|
||||
2012-04-30 allowedAttributes added, an array of attributed allowed on the elements
|
||||
2013-02-25 now will push non-inline elements up the stack if nested in an inline element
|
||||
2013-02-25 comment element support added, removed by default, see AllowComments in options
|
||||
2013-08-22 removeTagsAndContent added, an array of tag names to do just that
|
||||
2016-03-11 allowBreakAsLastChild added,
|
||||
2016-03-15 jshint recommendations, no functional changes
|
||||
*/
|
||||
(function ($) {
|
||||
$.fn.htmlClean = function (options) {
|
||||
// iterate and html clean each matched element
|
||||
return this.each(function () {
|
||||
if (this.value) {
|
||||
this.value = $.htmlClean(this.value, options);
|
||||
} else {
|
||||
this.innerHTML = $.htmlClean(this.innerHTML, options);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// clean the passed html
|
||||
$.htmlClean = function (html, options) {
|
||||
options = $.extend({}, $.htmlClean.defaults, options);
|
||||
options.allowEmpty = tagAllowEmpty.concat(options.allowEmpty);
|
||||
|
||||
var tagsRE = /(<(\/)?(\w+:)?([\w]+)([^>]*)>)|<!--(.*?--)>/gi;
|
||||
var attrsRE = /([\w\-]+)\s*=\s*(".*?"|'.*?'|[^\s>\/]*)/gi;
|
||||
|
||||
var tagMatch;
|
||||
var root = new Element();
|
||||
var stack = [root];
|
||||
var container = root;
|
||||
|
||||
if (options.bodyOnly) {
|
||||
// check for body tag
|
||||
if ((tagMatch = /<body[^>]*>((\n|.)*)<\/body>/i.exec(html)) !== null) {
|
||||
html = tagMatch[1];
|
||||
}
|
||||
}
|
||||
html = html.concat("<xxx>"); // ensure last element/text is found
|
||||
var lastIndex;
|
||||
|
||||
while ((tagMatch = tagsRE.exec(html)) !== null) {
|
||||
var tag = tagMatch[6] ?
|
||||
new Tag("--", null, tagMatch[6], options) :
|
||||
new Tag(tagMatch[4], tagMatch[2], tagMatch[5], options);
|
||||
|
||||
// add the text
|
||||
var text = html.substring(lastIndex, tagMatch.index);
|
||||
if (text.length > 0) {
|
||||
var child = container.children[container.children.length - 1];
|
||||
if (container.children.length > 0 &&
|
||||
isText(child = container.children[container.children.length - 1])) {
|
||||
// merge text
|
||||
container.children[container.children.length - 1] = child.concat(text);
|
||||
} else {
|
||||
container.children.push(text);
|
||||
}
|
||||
}
|
||||
lastIndex = tagsRE.lastIndex;
|
||||
|
||||
if (tag.isClosing) {
|
||||
// find matching container
|
||||
if (popToTagName(stack, [tag.name])) {
|
||||
stack.pop();
|
||||
container = stack[stack.length - 1];
|
||||
}
|
||||
} else {
|
||||
// create a new element
|
||||
var element = new Element(tag);
|
||||
|
||||
// add attributes
|
||||
var attrMatch;
|
||||
while ((attrMatch = attrsRE.exec(tag.rawAttributes)) !== null) {
|
||||
|
||||
// check style attribute and do replacements
|
||||
if (attrMatch[1].toLowerCase() == "style" &&
|
||||
options.replaceStyles) {
|
||||
|
||||
var renderParent = !tag.isInline;
|
||||
for (var i = 0; i < options.replaceStyles.length; i++) {
|
||||
if (options.replaceStyles[i][0].test(attrMatch[2])) {
|
||||
|
||||
if (!renderParent) {
|
||||
tag.render = false;
|
||||
renderParent = true;
|
||||
}
|
||||
container.children.push(element); // assumes not replaced
|
||||
stack.push(element);
|
||||
container = element; // assumes replacement is a container
|
||||
// create new tag and element
|
||||
tag = new Tag(options.replaceStyles[i][1], "", "", options);
|
||||
element = new Element(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tag.allowedAttributes !== null &&
|
||||
(tag.allowedAttributes.length === 0 ||
|
||||
$.inArray(attrMatch[1], tag.allowedAttributes) > -1)) {
|
||||
element.attributes.push(new Attribute(attrMatch[1], attrMatch[2]));
|
||||
}
|
||||
}
|
||||
// add required empty ones
|
||||
for (var ai = 0; ai < tag.requiredAttributes.length; ai++) {
|
||||
var name = tag.requiredAttributes[ai];
|
||||
if (!element.hasAttribute(name))
|
||||
element.attributes.push(new Attribute(name, ""));
|
||||
}
|
||||
|
||||
// check for replacements
|
||||
for (var repIndex = 0; repIndex < options.replace.length; repIndex++) {
|
||||
for (var tagIndex = 0; tagIndex < options.replace[repIndex][0].length; tagIndex++) {
|
||||
var byName = typeof (options.replace[repIndex][0][tagIndex]) == "string";
|
||||
if ((byName && options.replace[repIndex][0][tagIndex] == tag.name) ||
|
||||
(!byName && options.replace[repIndex][0][tagIndex].test(tagMatch))) {
|
||||
|
||||
// set the name to the replacement
|
||||
tag.rename(options.replace[repIndex][1]);
|
||||
|
||||
repIndex = options.replace.length; // break out of both loops
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check container rules
|
||||
var add = true;
|
||||
if (!container.isRoot) {
|
||||
if (container.tag.isInline && !tag.isInline) {
|
||||
if ((add = popToContainer(stack))) {
|
||||
container = stack[stack.length - 1];
|
||||
}
|
||||
} else if (container.tag.disallowNest &&
|
||||
tag.disallowNest &&
|
||||
!tag.requiredParent) {
|
||||
add = false;
|
||||
} else if (tag.requiredParent) {
|
||||
if ((add = popToTagName(stack, tag.requiredParent))) {
|
||||
container = stack[stack.length - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (add) {
|
||||
container.children.push(element);
|
||||
|
||||
if (tag.toProtect) {
|
||||
// skip to closing tag
|
||||
var tagMatch2;
|
||||
while ((tagMatch2 = tagsRE.exec(html)) !== null) {
|
||||
var tag2 = new Tag(tagMatch2[4], tagMatch2[1], tagMatch2[5], options);
|
||||
if (tag2.isClosing && tag2.name == tag.name) {
|
||||
element.children.push(RegExp.leftContext.substring(lastIndex));
|
||||
lastIndex = tagsRE.lastIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// set as current container element
|
||||
if (!tag.isSelfClosing && !tag.isNonClosing) {
|
||||
stack.push(element);
|
||||
container = element;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// render doc
|
||||
return $.htmlClean.trim(render(root, options).join(""));
|
||||
};
|
||||
|
||||
// defaults
|
||||
$.htmlClean.defaults = {
|
||||
// only clean the body tagbody
|
||||
bodyOnly: true,
|
||||
// only allow tags in this array, (white list), contents still rendered
|
||||
allowedTags: [],
|
||||
// remove tags in this array, (black list), contents still rendered
|
||||
removeTags: ["basefont", "center", "dir", "font", "frame", "frameset", "iframe", "isindex", "menu", "noframes", "s", "strike", "u"],
|
||||
// remove tags and content
|
||||
removeTagsAndContent: [],
|
||||
// array of [attributeName], [optional array of allowed on elements] e.g. [["id"], ["style", ["p", "dl"]]] // allow all elements to have id and allow style on 'p' and 'dl'
|
||||
allowedAttributes: [],
|
||||
// array of attribute names to remove on all elements in addition to those not in tagAttributes e.g ["width", "height"]
|
||||
removeAttrs: [],
|
||||
// array of [className], [optional array of allowed on elements] e.g. [["aClass"], ["anotherClass", ["p", "dl"]]]
|
||||
allowedClasses: [],
|
||||
// format the result
|
||||
format: false,
|
||||
// format indent to start on
|
||||
formatIndent: 0,
|
||||
// tags to replace, and what to replace with, tag name or regex to match the tag and attributes
|
||||
replace: [
|
||||
[["b", "big"], "strong"],
|
||||
[["i"], "em"]
|
||||
],
|
||||
// styles to replace with tags, multiple style matches supported, inline tags are replaced by the first match blocks are retained
|
||||
replaceStyles: [
|
||||
[/font-weight:\s*bold/i, "strong"],
|
||||
[/font-style:\s*italic/i, "em"],
|
||||
[/vertical-align:\s*super/i, "sup"],
|
||||
[/vertical-align:\s*sub/i, "sub"]
|
||||
],
|
||||
allowComments: false,
|
||||
allowEmpty: [],
|
||||
allowBreakAsLastChild: false
|
||||
};
|
||||
|
||||
function applyFormat(element, options, output, indent) {
|
||||
if (element.tag.format && output.length > 0) {
|
||||
output.push("\n");
|
||||
for (var i = 0; i < indent; i++) output.push("\t");
|
||||
}
|
||||
}
|
||||
|
||||
function render(element, options) {
|
||||
var output = [], empty = element.attributes.length === 0, indent = 0;
|
||||
|
||||
if (element.tag.isComment) {
|
||||
if (options.allowComments) {
|
||||
output.push("<!--");
|
||||
output.push(element.tag.rawAttributes);
|
||||
output.push(">");
|
||||
|
||||
if (options.format) applyFormat(element, options, output, indent - 1);
|
||||
}
|
||||
} else {
|
||||
|
||||
// don't render if not in allowedTags or in removeTags
|
||||
var renderChildren
|
||||
= (options.removeTagsAndContent.length === 0 || $.inArray(element.tag.name, options.removeTagsAndContent) == -1);
|
||||
var renderTag
|
||||
= renderChildren && element.tag.render &&
|
||||
(options.allowedTags.length === 0 || $.inArray(element.tag.name, options.allowedTags) > -1) &&
|
||||
(options.removeTags.length === 0 || $.inArray(element.tag.name, options.removeTags) == -1);
|
||||
|
||||
if (!element.isRoot && renderTag) {
|
||||
|
||||
// render opening tag
|
||||
output.push("<");
|
||||
output.push(element.tag.name);
|
||||
$.each(element.attributes, function () {
|
||||
if ($.inArray(this.name, options.removeAttrs) == -1) {
|
||||
var m = RegExp(/^(['"]?)(.*?)['"]?$/).exec(this.value);
|
||||
var value = m[2];
|
||||
var valueQuote = m[1] || "'";
|
||||
|
||||
// check for classes allowed
|
||||
if (this.name == "class" && options.allowedClasses.length > 0) {
|
||||
value =
|
||||
$.grep(value.split(" "), function (c) {
|
||||
return $.grep(options.allowedClasses, function (a) {
|
||||
return a == c ||
|
||||
(a[0] == c && (a.length == 1 || $.inArray(element.tag.name, a[1]) > -1));
|
||||
}).length > 0;
|
||||
})
|
||||
.join(" ");
|
||||
}
|
||||
|
||||
if (value !== null &&
|
||||
(value.length > 0 || $.inArray(this.name, element.tag.requiredAttributes) > -1)) {
|
||||
output.push(" ");
|
||||
output.push(this.name);
|
||||
output.push("=");
|
||||
output.push(valueQuote);
|
||||
output.push(value);
|
||||
output.push(valueQuote);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (element.tag.isSelfClosing) {
|
||||
// self closing
|
||||
if (renderTag) output.push(" />");
|
||||
empty = false;
|
||||
} else if (element.tag.isNonClosing) {
|
||||
empty = false;
|
||||
} else if (renderChildren) {
|
||||
if (!element.isRoot && renderTag) {
|
||||
// close
|
||||
output.push(">");
|
||||
}
|
||||
|
||||
indent = options.formatIndent++;
|
||||
var outputChildren = [];
|
||||
|
||||
// render children
|
||||
if (element.tag.toProtect) {
|
||||
outputChildren = $.htmlClean.trim(element.children.join("")).replace(/<br>/ig, "\n");
|
||||
output.push(outputChildren);
|
||||
empty = outputChildren.length === 0;
|
||||
} else {
|
||||
outputChildren = [];
|
||||
for (var i = 0; i < element.children.length; i++) {
|
||||
var child = element.children[i];
|
||||
var text = $.htmlClean.trim(textClean(isText(child) ? child : child.childrenToString()));
|
||||
if (isInline(child)) {
|
||||
if (i > 0 && text.length > 0 &&
|
||||
(startsWithWhitespace(child) || endsWithWhitespace(element.children[i - 1]))) {
|
||||
outputChildren.push(" ");
|
||||
}
|
||||
}
|
||||
if (isText(child)) {
|
||||
if (text.length > 0) {
|
||||
outputChildren.push(text);
|
||||
}
|
||||
} else {
|
||||
// only allow break as last child if allowBreakAsLastChild option is set
|
||||
if (i !== element.children.length - 1 || child.tag.name !== "br" || (options.allowBreakAsLastChild && child.tag.name === "br")) {
|
||||
if (options.format) applyFormat(child, options, outputChildren, indent);
|
||||
outputChildren = outputChildren.concat(render(child, options));
|
||||
}
|
||||
}
|
||||
}
|
||||
options.formatIndent--;
|
||||
|
||||
if (outputChildren.length > 0) {
|
||||
if (options.format && outputChildren[0] != "\n") applyFormat(element, options, output, indent);
|
||||
output = output.concat(outputChildren);
|
||||
empty = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!element.isRoot && renderTag) {
|
||||
// render the closing tag
|
||||
if (options.format) applyFormat(element, options, output, indent - 1);
|
||||
output.push("</");
|
||||
output.push(element.tag.name);
|
||||
output.push(">");
|
||||
}
|
||||
}
|
||||
|
||||
// check for empty tags
|
||||
if (!element.tag.allowEmpty && empty) { return []; }
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
// find a matching tag, and pop to it, if not do nothing
|
||||
function popToTagName(stack, tagNameArray) {
|
||||
return pop(
|
||||
stack,
|
||||
function (element) {
|
||||
return $.inArray(element.tag.nameOriginal, tagNameArray) > -1;
|
||||
});
|
||||
}
|
||||
|
||||
function popToContainer(stack) {
|
||||
return pop(
|
||||
stack,
|
||||
function (element) {
|
||||
return element.isRoot || !element.tag.isInline;
|
||||
});
|
||||
}
|
||||
|
||||
function pop(stack, test, index) {
|
||||
index = index || 1;
|
||||
var element = stack[stack.length - index];
|
||||
if (test(element)) {
|
||||
return true;
|
||||
} else if (stack.length - index > 0 &&
|
||||
pop(stack, test, index + 1)) {
|
||||
stack.pop();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Element Object
|
||||
function Element(tag) {
|
||||
if (tag) {
|
||||
this.tag = tag;
|
||||
this.isRoot = false;
|
||||
} else {
|
||||
this.tag = new Tag("root");
|
||||
this.isRoot = true;
|
||||
}
|
||||
this.attributes = [];
|
||||
this.children = [];
|
||||
|
||||
this.hasAttribute = function (name) {
|
||||
for (var i = 0; i < this.attributes.length; i++) {
|
||||
if (this.attributes[i].name == name) return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
this.childrenToString = function () {
|
||||
return this.children.join("");
|
||||
};
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
// Attribute Object
|
||||
function Attribute(name, value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
// Tag object
|
||||
function Tag(name, close, rawAttributes, options) {
|
||||
this.name = name.toLowerCase();
|
||||
this.nameOriginal = this.name;
|
||||
this.render = true;
|
||||
|
||||
this.init = function () {
|
||||
if (this.name == "--") {
|
||||
this.isComment = true;
|
||||
this.isSelfClosing = true;
|
||||
this.format = true;
|
||||
} else {
|
||||
this.isComment = false;
|
||||
this.isSelfClosing = $.inArray(this.name, tagSelfClosing) > -1;
|
||||
this.isNonClosing = $.inArray(this.name, tagNonClosing) > -1;
|
||||
this.isClosing = (close !== undefined && close.length > 0);
|
||||
|
||||
this.isInline = $.inArray(this.name, tagInline) > -1;
|
||||
this.disallowNest = $.inArray(this.name, tagDisallowNest) > -1;
|
||||
this.requiredParent = tagRequiredParent[$.inArray(this.name, tagRequiredParent) + 1];
|
||||
this.allowEmpty = options && $.inArray(this.name, options.allowEmpty) > -1;
|
||||
|
||||
this.toProtect = $.inArray(this.name, tagProtect) > -1;
|
||||
|
||||
this.format = $.inArray(this.name, tagFormat) > -1 || !this.isInline;
|
||||
}
|
||||
this.rawAttributes = rawAttributes;
|
||||
this.requiredAttributes = tagAttributesRequired[$.inArray(this.name, tagAttributesRequired) + 1];
|
||||
|
||||
if (options) {
|
||||
if (!options.tagAttributesCache) options.tagAttributesCache = [];
|
||||
if ($.inArray(this.name, options.tagAttributesCache) == -1) {
|
||||
var cacheItem = tagAttributes[$.inArray(this.name, tagAttributes) + 1].slice(0);
|
||||
|
||||
// add extra ones from options
|
||||
for (var i = 0; i < options.allowedAttributes.length; i++) {
|
||||
var attrName = options.allowedAttributes[i][0];
|
||||
if ((
|
||||
options.allowedAttributes[i].length == 1 ||
|
||||
$.inArray(this.name, options.allowedAttributes[i][1]) > -1
|
||||
) && $.inArray(attrName, cacheItem) == -1) {
|
||||
cacheItem.push(attrName);
|
||||
}
|
||||
}
|
||||
|
||||
options.tagAttributesCache.push(this.name);
|
||||
options.tagAttributesCache.push(cacheItem);
|
||||
}
|
||||
|
||||
this.allowedAttributes = options.tagAttributesCache[$.inArray(this.name, options.tagAttributesCache) + 1];
|
||||
}
|
||||
};
|
||||
|
||||
this.init();
|
||||
|
||||
this.rename = function (newName) {
|
||||
this.name = newName;
|
||||
this.init();
|
||||
};
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
function startsWithWhitespace(item) {
|
||||
while (isElement(item) && item.children.length > 0) {
|
||||
item = item.children[0];
|
||||
}
|
||||
if (!isText(item)) return false;
|
||||
var text = textClean(item);
|
||||
return text.length > 0 && $.htmlClean.isWhitespace(text.charAt(0));
|
||||
}
|
||||
function endsWithWhitespace(item) {
|
||||
while (isElement(item) && item.children.length > 0) {
|
||||
item = item.children[item.children.length - 1];
|
||||
}
|
||||
if (!isText(item)) return false;
|
||||
var text = textClean(item);
|
||||
return text.length > 0 && $.htmlClean.isWhitespace(text.charAt(text.length - 1));
|
||||
}
|
||||
function isText(item) { return item.constructor == String; }
|
||||
function isInline(item) { return isText(item) || item.tag.isInline; }
|
||||
function isElement(item) { return item.constructor == Element; }
|
||||
function textClean(text) {
|
||||
return text
|
||||
.replace(/ |\n/g, " ")
|
||||
.replace(/\s\s+/g, " ");
|
||||
}
|
||||
|
||||
// trim off white space, doesn't use regex
|
||||
$.htmlClean.trim = function (text) {
|
||||
return $.htmlClean.trimStart($.htmlClean.trimEnd(text));
|
||||
};
|
||||
$.htmlClean.trimStart = function (text) {
|
||||
return text.substring($.htmlClean.trimStartIndex(text));
|
||||
};
|
||||
$.htmlClean.trimStartIndex = function (text) {
|
||||
for (var start = 0; start < text.length - 1 && $.htmlClean.isWhitespace(text.charAt(start)) ; start++);
|
||||
return start;
|
||||
};
|
||||
$.htmlClean.trimEnd = function (text) {
|
||||
return text.substring(0, $.htmlClean.trimEndIndex(text));
|
||||
};
|
||||
$.htmlClean.trimEndIndex = function (text) {
|
||||
for (var end = text.length - 1; end >= 0 && $.htmlClean.isWhitespace(text.charAt(end)) ; end--);
|
||||
return end + 1;
|
||||
};
|
||||
// checks a char is white space or not
|
||||
$.htmlClean.isWhitespace = function (c) { return $.inArray(c, whitespace) != -1; };
|
||||
|
||||
// tags which are inline
|
||||
var tagInline = [
|
||||
"a", "abbr", "acronym", "address", "b", "big", "br", "button",
|
||||
"caption", "cite", "code", "del", "em", "font",
|
||||
"hr", "i", "input", "img", "ins", "label", "legend", "map", "q",
|
||||
"s", "samp", "select", "option", "param", "small", "span", "strike", "strong", "sub", "sup",
|
||||
"tt", "u", "var"];
|
||||
var tagFormat = ["address", "button", "caption", "code", "input", "label", "legend", "select", "option", "param"];
|
||||
var tagDisallowNest = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "th", "td", "object"];
|
||||
var tagAllowEmpty = ["th", "td"];
|
||||
var tagRequiredParent = [
|
||||
null,
|
||||
"li", ["ul", "ol"],
|
||||
"dt", ["dl"],
|
||||
"dd", ["dl"],
|
||||
"td", ["tr"],
|
||||
"th", ["tr"],
|
||||
"tr", ["table", "thead", "tbody", "tfoot"],
|
||||
"thead", ["table"],
|
||||
"tbody", ["table"],
|
||||
"tfoot", ["table"],
|
||||
"param", ["object"]
|
||||
];
|
||||
var tagProtect = ["script", "style", "pre", "code"];
|
||||
// tags which self close e.g. <br />
|
||||
var tagSelfClosing = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
|
||||
// tags which do not close
|
||||
var tagNonClosing = ["!doctype", "?xml"];
|
||||
// attributes allowed on tags
|
||||
var tagAttributes = [
|
||||
["class"], // default, for all tags not mentioned
|
||||
"?xml", [],
|
||||
"!doctype", [],
|
||||
"a", ["accesskey", "class", "href", "name", "title", "rel", "rev", "type", "tabindex"],
|
||||
"abbr", ["class", "title"],
|
||||
"acronym", ["class", "title"],
|
||||
"blockquote", ["cite", "class"],
|
||||
"button", ["class", "disabled", "name", "type", "value"],
|
||||
"del", ["cite", "class", "datetime"],
|
||||
"form", ["accept", "action", "class", "enctype", "method", "name"],
|
||||
"iframe", ["class", "height", "name", "sandbox", "seamless", "src", "srcdoc", "width"],
|
||||
"input", ["accept", "accesskey", "alt", "checked", "class", "disabled", "ismap", "maxlength", "name", "size", "readonly", "src", "tabindex", "type", "usemap", "value"],
|
||||
"img", ["alt", "class", "height", "src", "width"],
|
||||
"ins", ["cite", "class", "datetime"],
|
||||
"label", ["accesskey", "class", "for"],
|
||||
"legend", ["accesskey", "class"],
|
||||
"link", ["href", "rel", "type"],
|
||||
"meta", ["content", "http-equiv", "name", "scheme", "charset"],
|
||||
"map", ["name"],
|
||||
"optgroup", ["class", "disabled", "label"],
|
||||
"option", ["class", "disabled", "label", "selected", "value"],
|
||||
"q", ["class", "cite"],
|
||||
"script", ["src", "type"],
|
||||
"select", ["class", "disabled", "multiple", "name", "size", "tabindex"],
|
||||
"style", ["type"],
|
||||
"table", ["class", "summary"],
|
||||
"th", ["class", "colspan", "rowspan"],
|
||||
"td", ["class", "colspan", "rowspan"],
|
||||
"textarea", ["accesskey", "class", "cols", "disabled", "name", "readonly", "rows", "tabindex"],
|
||||
"param", ["name", "value"],
|
||||
"embed", ["height", "src", "type", "width"]
|
||||
];
|
||||
var tagAttributesRequired = [[], "img", ["alt"]];
|
||||
// white space chars
|
||||
var whitespace = [" ", " ", "\t", "\n", "\r", "\f"];
|
||||
|
||||
})(jQuery);
|
||||
1
public/admin/plugins/tmce/bootstrap/js/jquery.htmlClean.min.js
vendored
Normal file
1
public/admin/plugins/tmce/bootstrap/js/jquery.htmlClean.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
249
public/admin/plugins/tmce/bootstrap/js/utils.js
Normal file
249
public/admin/plugins/tmce/bootstrap/js/utils.js
Normal file
@@ -0,0 +1,249 @@
|
||||
/*jshint globalstrict: true, unused:false*/
|
||||
/*global jQuery, window, setTimeout, parent, Prism*/
|
||||
'use strict';
|
||||
function makeResponsive()
|
||||
{
|
||||
if (jQuery('body').width() < 768) {
|
||||
jQuery('.container').addClass('container-xs');
|
||||
}
|
||||
}
|
||||
|
||||
/* get custom Bootstrap styles */
|
||||
|
||||
function getBootstrapStyles()
|
||||
{
|
||||
setTimeout(function(){
|
||||
var bodyBackground;
|
||||
var previewBackground;
|
||||
var choiceTitleBorderTop;
|
||||
var choiceTitleBorderTopAfter;
|
||||
|
||||
bodyBackground = previewBackground = jQuery(window.parent.document.body).find('.mce-edit-area iframe').contents().find('.mce-content-body').css('background-color');
|
||||
if(bodyBackground.match(/rgb(255, 255, 255)/)) {
|
||||
jQuery('body').css('background-color', '#fafafa');
|
||||
} else {
|
||||
bodyBackground = shadeRGBColor(bodyBackground, 0.07);
|
||||
choiceTitleBorderTop = shadeRGBColor(bodyBackground, -0.2);
|
||||
choiceTitleBorderTopAfter = shadeRGBColor(bodyBackground, 0.3);
|
||||
jQuery('body').css('background-color', bodyBackground);
|
||||
jQuery('.choice-title, #preview-title, #code-title').css('border-top-color', choiceTitleBorderTop);
|
||||
jQuery('<style>.choice-title:after, #preview-title:after, #code-title:after{border-top-color: '+choiceTitleBorderTopAfter+'}</style>').appendTo('head');
|
||||
jQuery('#preview').css('background-color', previewBackground);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
function shadeRGBColor(color, percent) {
|
||||
var f=color.split(','),t=percent<0?0:255,p=percent<0?percent*-1:percent,R=parseInt(f[0].slice(4)),G=parseInt(f[1]),B=parseInt(f[2]);
|
||||
return 'rgb('+(Math.round((t-R)*p)+R)+','+(Math.round((t-G)*p)+G)+','+(Math.round((t-B)*p)+B)+')';
|
||||
}
|
||||
|
||||
/* btn-toggle */
|
||||
|
||||
function toggleBtn(toggleGroup) {
|
||||
jQuery(toggleGroup).find('.btn').toggleClass('active');
|
||||
jQuery(toggleGroup).find('.btn').toggleClass('btn-success');
|
||||
jQuery(toggleGroup).find('.btn').toggleClass('btn-default');
|
||||
if(jQuery(toggleGroup).find('.active').attr('data-attr') == 'true') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function toggleAllBtns(toggleGroup, trueFalse) {
|
||||
jQuery(toggleGroup).each(function() {
|
||||
if(!trueFalse) { // set all buttons to true
|
||||
jQuery(this).find('button[data-attr="true"]').addClass('active').removeClass('btn-default').addClass('btn-success');
|
||||
jQuery(this).find('button[data-attr="false"]').removeClass('active').removeClass('btn-success').addClass('btn-default');
|
||||
} else { // set all buttons to false
|
||||
jQuery(this).find('button[data-attr="false"]').addClass('active').removeClass('btn-default').addClass('btn-success');
|
||||
jQuery(this).find('button[data-attr="true"]').removeClass('active').removeClass('btn-success').addClass('btn-default');
|
||||
}
|
||||
});
|
||||
jQuery(toggleGroup).find('.btn').toggleClass('active');
|
||||
jQuery(toggleGroup).find('.btn').toggleClass('btn-success');
|
||||
jQuery(toggleGroup).find('.btn').toggleClass('btn-default');
|
||||
if(jQuery(toggleGroup).find('.active').attr('data-attr') == 'true') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* get current edit element code */
|
||||
|
||||
function getCode(selector)
|
||||
{
|
||||
var elementCode;
|
||||
if(jQuery(window.parent.document.body).find('.mce-tinymce-inline')[0]) {
|
||||
elementCode = jQuery(window.parent.document.body).find('.mce-edit-focus').find(selector).clone().wrap('<div>').parent().html();
|
||||
} else {
|
||||
elementCode = jQuery(window.parent.document.body).find('.mce-edit-area iframe').contents().find(selector).clone().wrap('<div>').parent().html();
|
||||
}
|
||||
return elementCode;
|
||||
}
|
||||
|
||||
/* code update */
|
||||
|
||||
function updateCode()
|
||||
{
|
||||
var code = jQuery('#test-wrapper').html(); // get preview content
|
||||
|
||||
/* remove table content only for new tables (with false-text content) */
|
||||
|
||||
if(jQuery('<div>').html(code).find('table.table').length > 0) {
|
||||
if(jQuery('<div>').html(code).find('table.table').attr('data-attr') == 'new-table') {
|
||||
code = jQuery('<div>').html(code).find('th, td').text('').closest('div').html();
|
||||
}
|
||||
}
|
||||
|
||||
var find = new Array(/\s?data-mce-[a-z]+="[^"]+"/g);
|
||||
var replace = new Array('', '', '', '', '');
|
||||
|
||||
for (var i = find.length - 1; i >= 0; i--) {
|
||||
code = code.replace(find[i], replace[i]);
|
||||
}
|
||||
|
||||
/* render code */
|
||||
|
||||
/* remove unwanted classes, attrs, ... */
|
||||
|
||||
var allowedAttrs = new Array(['class']);
|
||||
var allowedEmpty = new Array(['span']);
|
||||
|
||||
if(jQuery('#test-wrapper').hasClass('test-icon-wrapper')) {
|
||||
|
||||
/* keep styles for icons */
|
||||
allowedAttrs.push(['style']);
|
||||
code = jQuery.htmlClean(code, {format:true, allowedAttributes: allowedAttrs, allowEmpty: allowedEmpty});
|
||||
} else if(jQuery('#test-wrapper').hasClass('test-snippet-wrapper')) { // keep all original code for snippets
|
||||
code = code;
|
||||
} else {
|
||||
code = jQuery.htmlClean(code, {format:true, allowedAttributes: allowedAttrs, allowEmpty: allowedEmpty});
|
||||
}
|
||||
var highlighted_code = Prism.highlight(code, Prism.languages.markup);
|
||||
code = jQuery.trim(escapeHtml(code));
|
||||
jQuery('#code-wrapper').fadeOut(200, function() {
|
||||
jQuery(this).html('<pre><code class="language-markup">' + highlighted_code + '</code></pre>');
|
||||
jQuery(this).fadeIn(200);
|
||||
});
|
||||
parent.document.getElementById('bs-code').value = code;
|
||||
}
|
||||
|
||||
/* code escape html */
|
||||
|
||||
function escapeHtml(text)
|
||||
{
|
||||
var map = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
'\'': '''
|
||||
};
|
||||
|
||||
return text.replace(/[&<>"']/g, function (m) { return map[m]; });
|
||||
}
|
||||
|
||||
/* code toggle */
|
||||
|
||||
jQuery('#code-slide-link').on('click', function () {
|
||||
jQuery('#code-wrapper').slideToggle(400, function () {
|
||||
if (jQuery('#code-wrapper').css('display') == 'block') {
|
||||
jQuery('#code-slide-link i').removeClass('glyphicon-arrow-down').addClass('glyphicon-arrow-up');
|
||||
} else {
|
||||
jQuery('#code-slide-link i').removeClass('glyphicon-arrow-up').addClass('glyphicon-arrow-down');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
* HTML5 Sortable jQuery Plugin
|
||||
* http://farhadi.ir/projects/html5sortable
|
||||
*
|
||||
* Copyright 2012, Ali Farhadi
|
||||
* Released under the MIT license.
|
||||
*/
|
||||
(function(jQuery) {
|
||||
var dragging, placeholders = jQuery();
|
||||
jQuery.fn.sortable = function(options) {
|
||||
var method = String(options),
|
||||
items;
|
||||
options = jQuery.extend({
|
||||
connectWith: false,
|
||||
calllback: function () {}
|
||||
}, options);
|
||||
return this.each(function() {
|
||||
if (/^enable|disable|destroyjQuery/.test(method)) {
|
||||
items = jQuery(this).children(jQuery(this).data('items')).attr('draggable', method == 'enable');
|
||||
if (method == 'destroy') {
|
||||
items.add(this).removeData('connectWith items')
|
||||
.off('dragstart.h5s dragend.h5s selectstart.h5s dragover.h5s dragenter.h5s drop.h5s');
|
||||
}
|
||||
return;
|
||||
}
|
||||
var isHandle, index;
|
||||
items = jQuery(this).children(options.items);
|
||||
var placeholder = jQuery('<' + (/^ul|oljQuery/i.test(this.tagName) ? 'li' : 'div') + ' class="sortable-placeholder">');
|
||||
items.find(options.handle).mousedown(function() {
|
||||
isHandle = true;
|
||||
}).mouseup(function() {
|
||||
isHandle = false;
|
||||
});
|
||||
jQuery(this).data('items', options.items);
|
||||
placeholders = placeholders.add(placeholder);
|
||||
if (options.connectWith) {
|
||||
jQuery(options.connectWith).add(this).data('connectWith', options.connectWith);
|
||||
}
|
||||
items.attr('draggable', 'true').on('dragstart.h5s', function(e) {
|
||||
if (options.handle && !isHandle) {
|
||||
return false;
|
||||
}
|
||||
isHandle = false;
|
||||
var dt = e.originalEvent.dataTransfer;
|
||||
dt.effectAllowed = 'move';
|
||||
dt.setData('Text', 'dummy');
|
||||
index = (dragging = jQuery(this)).addClass('sortable-dragging').index();
|
||||
}).on('dragend.h5s', function() {
|
||||
if(jQuery(this).hasClass('sortable-dragging')) {
|
||||
dragging.removeClass('sortable-dragging').show();
|
||||
placeholders.detach();
|
||||
// if (index != dragging.index()) {
|
||||
// items.parent().trigger('sortupdate', {item: dragging});
|
||||
// }
|
||||
options.callback.call(this);
|
||||
}
|
||||
dragging = null;
|
||||
}).not('a[href], img').on('selectstart.h5s', function() {
|
||||
this.dragDrop && this.dragDrop();
|
||||
return false;
|
||||
}).end().add([this, placeholder]).on('dragover.h5s dragenter.h5s drop.h5s', function(e) {
|
||||
if (!items.is(dragging) && options.connectWith !== jQuery(dragging).parent().data('connectWith')) {
|
||||
return true;
|
||||
}
|
||||
if (e.type == 'drop') {
|
||||
e.stopPropagation();
|
||||
placeholders.filter(':visible').after(dragging);
|
||||
return false;
|
||||
}
|
||||
e.preventDefault();
|
||||
e.originalEvent.dataTransfer.dropEffect = 'move';
|
||||
if (items.is(this)) {
|
||||
if (options.forcePlaceholderSize) {
|
||||
placeholder.height(dragging.outerHeight());
|
||||
}
|
||||
dragging.hide();
|
||||
jQuery(this)[placeholder.index() < jQuery(this).index() ? 'after' : 'before'](placeholder);
|
||||
placeholders.not(placeholder).detach();
|
||||
} else if (!placeholders.is(this) && !jQuery(this).children(options.items).length) {
|
||||
placeholders.detach();
|
||||
jQuery(this).append(placeholder);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
||||
|
||||
jQuery.fn.scrollToTop = function(){ if (this.length > 0) jQuery('body, html').animate({scrollTop: jQuery(this).offset().top}, 500); };
|
||||
1
public/admin/plugins/tmce/bootstrap/js/utils.min.js
vendored
Normal file
1
public/admin/plugins/tmce/bootstrap/js/utils.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user