This commit is contained in:
2025-06-08 20:07:38 +09:00
parent 3b2966ebe2
commit a372bb62c7
2479 changed files with 1059113 additions and 1057157 deletions
@@ -1,373 +1,373 @@
/*
* [hi-base64]{@link https://github.com/emn178/hi-base64}
*
* @version 0.2.1
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2017
* @license MIT
*/
/*jslint bitwise: true */
/*Modified by Pagelayer*/
(function () {
'use strict';
var root = typeof window === 'object' ? window : {};
var NODE_JS = false;
if (NODE_JS) {
root = global;
}
var COMMON_JS = !root.HI_BASE64_NO_COMMON_JS && typeof module === 'object' && module.exports;
var AMD = typeof define === 'function' && define.amd;
var BASE64_ENCODE_CHAR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
var BASE64_DECODE_CHAR = {
'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7, 'I': 8,
'J': 9, 'K': 10, 'L': 11, 'M': 12, 'N': 13, 'O': 14, 'P': 15, 'Q': 16,
'R': 17, 'S': 18, 'T': 19, 'U': 20, 'V': 21, 'W': 22, 'X': 23, 'Y': 24,
'Z': 25, 'a': 26, 'b': 27, 'c': 28, 'd': 29, 'e': 30, 'f': 31, 'g': 32,
'h': 33, 'i': 34, 'j': 35, 'k': 36, 'l': 37, 'm': 38, 'n': 39, 'o': 40,
'p': 41, 'q': 42, 'r': 43, 's': 44, 't': 45, 'u': 46, 'v': 47, 'w': 48,
'x': 49, 'y': 50, 'z': 51, '0': 52, '1': 53, '2': 54, '3': 55, '4': 56,
'5': 57, '6': 58, '7': 59, '8': 60, '9': 61, '+': 62, '/': 63, '-': 62,
'_': 63
};
var utf8ToBytes = function (str) {
var bytes = [];
for (var i = 0; i < str.length; i++) {
var c = str.charCodeAt(i);
if (c < 0x80) {
bytes[bytes.length] = c;
} else if (c < 0x800) {
bytes[bytes.length] = 0xc0 | (c >> 6);
bytes[bytes.length] = 0x80 | (c & 0x3f);
} else if (c < 0xd800 || c >= 0xe000) {
bytes[bytes.length] = 0xe0 | (c >> 12);
bytes[bytes.length] = 0x80 | ((c >> 6) & 0x3f);
bytes[bytes.length] = 0x80 | (c & 0x3f);
} else {
c = 0x10000 + (((c & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff));
bytes[bytes.length] = 0xf0 | (c >> 18);
bytes[bytes.length] = 0x80 | ((c >> 12) & 0x3f);
bytes[bytes.length] = 0x80 | ((c >> 6) & 0x3f);
bytes[bytes.length] = 0x80 | (c & 0x3f);
}
}
return bytes;
};
var decodeAsBytes = function (base64Str) {
var v1, v2, v3, v4, bytes = [], index = 0, length = base64Str.length;
if (base64Str.charAt(length - 2) === '=') {
length -= 2;
} else if (base64Str.charAt(length - 1) === '=') {
length -= 1;
}
// 4 char to 3 bytes
for (var i = 0, count = length >> 2 << 2; i < count;) {
v1 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v2 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v3 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v4 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
bytes[index++] = (v1 << 2 | v2 >>> 4) & 255;
bytes[index++] = (v2 << 4 | v3 >>> 2) & 255;
bytes[index++] = (v3 << 6 | v4) & 255;
}
// remain bytes
var remain = length - count;
if (remain === 2) {
v1 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v2 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
bytes[index++] = (v1 << 2 | v2 >>> 4) & 255;
} else if (remain === 3) {
v1 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v2 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v3 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
bytes[index++] = (v1 << 2 | v2 >>> 4) & 255;
bytes[index++] = (v2 << 4 | v3 >>> 2) & 255;
}
return bytes;
};
var encodeFromBytes = function (bytes) {
var v1, v2, v3, base64Str = '', length = bytes.length;
for (var i = 0, count = parseInt(length / 3) * 3; i < count;) {
v1 = bytes[i++];
v2 = bytes[i++];
v3 = bytes[i++];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] +
BASE64_ENCODE_CHAR[(v2 << 2 | v3 >>> 6) & 63] +
BASE64_ENCODE_CHAR[v3 & 63];
}
// remain char
var remain = length - count;
if (remain === 1) {
v1 = bytes[i];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4) & 63] +
'==';
} else if (remain === 2) {
v1 = bytes[i++];
v2 = bytes[i];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] +
BASE64_ENCODE_CHAR[(v2 << 2) & 63] +
'=';
}
return base64Str;
};
var btoa = root.btoa, atob = root.atob, utf8Base64Encode, utf8Base64Decode;
if (NODE_JS) {
} else if (!btoa) {
btoa = function (str) {
var v1, v2, v3, base64Str = '', length = str.length;
for (var i = 0, count = parseInt(length / 3) * 3; i < count;) {
v1 = str.charCodeAt(i++);
v2 = str.charCodeAt(i++);
v3 = str.charCodeAt(i++);
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] +
BASE64_ENCODE_CHAR[(v2 << 2 | v3 >>> 6) & 63] +
BASE64_ENCODE_CHAR[v3 & 63];
}
// remain char
var remain = length - count;
if (remain === 1) {
v1 = str.charCodeAt(i);
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4) & 63] +
'==';
} else if (remain === 2) {
v1 = str.charCodeAt(i++);
v2 = str.charCodeAt(i);
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] +
BASE64_ENCODE_CHAR[(v2 << 2) & 63] +
'=';
}
return base64Str;
};
utf8Base64Encode = function (str) {
var v1, v2, v3, base64Str = '', bytes = utf8ToBytes(str), length = bytes.length;
for (var i = 0, count = parseInt(length / 3) * 3; i < count;) {
v1 = bytes[i++];
v2 = bytes[i++];
v3 = bytes[i++];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] +
BASE64_ENCODE_CHAR[(v2 << 2 | v3 >>> 6) & 63] +
BASE64_ENCODE_CHAR[v3 & 63];
}
// remain char
var remain = length - count;
if (remain === 1) {
v1 = bytes[i];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4) & 63] +
'==';
} else if (remain === 2) {
v1 = bytes[i++];
v2 = bytes[i];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] +
BASE64_ENCODE_CHAR[(v2 << 2) & 63] +
'=';
}
return base64Str;
};
atob = function (base64Str) {
var v1, v2, v3, v4, str = '', length = base64Str.length;
if (base64Str.charAt(length - 2) === '=') {
length -= 2;
} else if (base64Str.charAt(length - 1) === '=') {
length -= 1;
}
// 4 char to 3 bytes
for (var i = 0, count = length >> 2 << 2; i < count;) {
v1 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v2 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v3 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v4 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
str += String.fromCharCode((v1 << 2 | v2 >>> 4) & 255) +
String.fromCharCode((v2 << 4 | v3 >>> 2) & 255) +
String.fromCharCode((v3 << 6 | v4) & 255);
}
// remain bytes
var remain = length - count;
if (remain === 2) {
v1 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v2 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
str += String.fromCharCode((v1 << 2 | v2 >>> 4) & 255);
} else if (remain === 3) {
v1 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v2 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v3 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
str += String.fromCharCode((v1 << 2 | v2 >>> 4) & 255) +
String.fromCharCode((v2 << 4 | v3 >>> 2) & 255);
}
return str;
};
utf8Base64Decode = function (base64Str) {
var str = '', bytes = decodeAsBytes(base64Str), length = bytes.length;
var i = 0, followingChars = 0, b, c;
while (i < length) {
b = bytes[i++];
if (b <= 0x7F) {
str += String.fromCharCode(b);
continue;
} else if (b > 0xBF && b <= 0xDF) {
c = b & 0x1F;
followingChars = 1;
} else if (b <= 0xEF) {
c = b & 0x0F;
followingChars = 2;
} else if (b <= 0xF7) {
c = b & 0x07;
followingChars = 3;
} else {
throw 'not a UTF-8 string';
}
for (var j = 0; j < followingChars; ++j) {
b = bytes[i++];
if (b < 0x80 || b > 0xBF) {
throw 'not a UTF-8 string';
}
c <<= 6;
c += b & 0x3F;
}
if (c >= 0xD800 && c <= 0xDFFF) {
throw 'not a UTF-8 string';
}
if (c > 0x10FFFF) {
throw 'not a UTF-8 string';
}
if (c <= 0xFFFF) {
str += String.fromCharCode(c);
} else {
c -= 0x10000;
str += String.fromCharCode((c >> 10) + 0xD800);
str += String.fromCharCode((c & 0x3FF) + 0xDC00);
}
}
return str;
};
} else {
utf8Base64Encode = function (str) {
var result = '';
for (var i = 0; i < str.length; i++) {
var charcode = str.charCodeAt(i);
if (charcode < 0x80) {
result += String.fromCharCode(charcode);
} else if (charcode < 0x800) {
result += String.fromCharCode(0xc0 | (charcode >> 6)) +
String.fromCharCode(0x80 | (charcode & 0x3f));
} else if (charcode < 0xd800 || charcode >= 0xe000) {
result += String.fromCharCode(0xe0 | (charcode >> 12)) +
String.fromCharCode(0x80 | ((charcode >> 6) & 0x3f)) +
String.fromCharCode(0x80 | (charcode & 0x3f));
} else {
charcode = 0x10000 + (((charcode & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff));
result += String.fromCharCode(0xf0 | (charcode >> 18)) +
String.fromCharCode(0x80 | ((charcode >> 12) & 0x3f)) +
String.fromCharCode(0x80 | ((charcode >> 6) & 0x3f)) +
String.fromCharCode(0x80 | (charcode & 0x3f));
}
}
return btoa(result);
};
utf8Base64Decode = function (base64Str) {
var tmpStr = atob(base64Str.trim('=').replace(/-/g, '+').replace(/_/g, '/'));
if (!/[^\x00-\x7F]/.test(tmpStr)) {
return tmpStr;
}
var str = '', i = 0, length = tmpStr.length, followingChars = 0, b, c;
while (i < length) {
b = tmpStr.charCodeAt(i++);
if (b <= 0x7F) {
str += String.fromCharCode(b);
continue;
} else if (b > 0xBF && b <= 0xDF) {
c = b & 0x1F;
followingChars = 1;
} else if (b <= 0xEF) {
c = b & 0x0F;
followingChars = 2;
} else if (b <= 0xF7) {
c = b & 0x07;
followingChars = 3;
} else {
throw 'not a UTF-8 string';
}
for (var j = 0; j < followingChars; ++j) {
b = tmpStr.charCodeAt(i++);
if (b < 0x80 || b > 0xBF) {
throw 'not a UTF-8 string';
}
c <<= 6;
c += b & 0x3F;
}
if (c >= 0xD800 && c <= 0xDFFF) {
throw 'not a UTF-8 string';
}
if (c > 0x10FFFF) {
throw 'not a UTF-8 string';
}
if (c <= 0xFFFF) {
str += String.fromCharCode(c);
} else {
c -= 0x10000;
str += String.fromCharCode((c >> 10) + 0xD800);
str += String.fromCharCode((c & 0x3FF) + 0xDC00);
}
}
return str;
};
}
var encode = function (str, asciiOnly) {
var notString = typeof(str) != 'string';
if (notString && str.constructor === root.ArrayBuffer) {
str = new Uint8Array(str);
}
if (notString) {
return encodeFromBytes(str);
} else {
if (!asciiOnly && /[^\x00-\x7F]/.test(str)) {
return utf8Base64Encode(str);
} else {
return btoa(str);
}
}
};
var decode = function (base64Str, asciiOnly) {
return asciiOnly ? atob(base64Str) : utf8Base64Decode(base64Str);
};
var exports = {
encode: encode,
decode: decode,
atob: atob,
btoa: btoa
};
decode.bytes = decodeAsBytes;
decode.string = decode;
root.pagelayer_Base64 = exports;
})();
/*
* [hi-base64]{@link https://github.com/emn178/hi-base64}
*
* @version 0.2.1
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2017
* @license MIT
*/
/*jslint bitwise: true */
/*Modified by Pagelayer*/
(function () {
'use strict';
var root = typeof window === 'object' ? window : {};
var NODE_JS = false;
if (NODE_JS) {
root = global;
}
var COMMON_JS = !root.HI_BASE64_NO_COMMON_JS && typeof module === 'object' && module.exports;
var AMD = typeof define === 'function' && define.amd;
var BASE64_ENCODE_CHAR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
var BASE64_DECODE_CHAR = {
'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7, 'I': 8,
'J': 9, 'K': 10, 'L': 11, 'M': 12, 'N': 13, 'O': 14, 'P': 15, 'Q': 16,
'R': 17, 'S': 18, 'T': 19, 'U': 20, 'V': 21, 'W': 22, 'X': 23, 'Y': 24,
'Z': 25, 'a': 26, 'b': 27, 'c': 28, 'd': 29, 'e': 30, 'f': 31, 'g': 32,
'h': 33, 'i': 34, 'j': 35, 'k': 36, 'l': 37, 'm': 38, 'n': 39, 'o': 40,
'p': 41, 'q': 42, 'r': 43, 's': 44, 't': 45, 'u': 46, 'v': 47, 'w': 48,
'x': 49, 'y': 50, 'z': 51, '0': 52, '1': 53, '2': 54, '3': 55, '4': 56,
'5': 57, '6': 58, '7': 59, '8': 60, '9': 61, '+': 62, '/': 63, '-': 62,
'_': 63
};
var utf8ToBytes = function (str) {
var bytes = [];
for (var i = 0; i < str.length; i++) {
var c = str.charCodeAt(i);
if (c < 0x80) {
bytes[bytes.length] = c;
} else if (c < 0x800) {
bytes[bytes.length] = 0xc0 | (c >> 6);
bytes[bytes.length] = 0x80 | (c & 0x3f);
} else if (c < 0xd800 || c >= 0xe000) {
bytes[bytes.length] = 0xe0 | (c >> 12);
bytes[bytes.length] = 0x80 | ((c >> 6) & 0x3f);
bytes[bytes.length] = 0x80 | (c & 0x3f);
} else {
c = 0x10000 + (((c & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff));
bytes[bytes.length] = 0xf0 | (c >> 18);
bytes[bytes.length] = 0x80 | ((c >> 12) & 0x3f);
bytes[bytes.length] = 0x80 | ((c >> 6) & 0x3f);
bytes[bytes.length] = 0x80 | (c & 0x3f);
}
}
return bytes;
};
var decodeAsBytes = function (base64Str) {
var v1, v2, v3, v4, bytes = [], index = 0, length = base64Str.length;
if (base64Str.charAt(length - 2) === '=') {
length -= 2;
} else if (base64Str.charAt(length - 1) === '=') {
length -= 1;
}
// 4 char to 3 bytes
for (var i = 0, count = length >> 2 << 2; i < count;) {
v1 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v2 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v3 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v4 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
bytes[index++] = (v1 << 2 | v2 >>> 4) & 255;
bytes[index++] = (v2 << 4 | v3 >>> 2) & 255;
bytes[index++] = (v3 << 6 | v4) & 255;
}
// remain bytes
var remain = length - count;
if (remain === 2) {
v1 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v2 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
bytes[index++] = (v1 << 2 | v2 >>> 4) & 255;
} else if (remain === 3) {
v1 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v2 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v3 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
bytes[index++] = (v1 << 2 | v2 >>> 4) & 255;
bytes[index++] = (v2 << 4 | v3 >>> 2) & 255;
}
return bytes;
};
var encodeFromBytes = function (bytes) {
var v1, v2, v3, base64Str = '', length = bytes.length;
for (var i = 0, count = parseInt(length / 3) * 3; i < count;) {
v1 = bytes[i++];
v2 = bytes[i++];
v3 = bytes[i++];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] +
BASE64_ENCODE_CHAR[(v2 << 2 | v3 >>> 6) & 63] +
BASE64_ENCODE_CHAR[v3 & 63];
}
// remain char
var remain = length - count;
if (remain === 1) {
v1 = bytes[i];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4) & 63] +
'==';
} else if (remain === 2) {
v1 = bytes[i++];
v2 = bytes[i];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] +
BASE64_ENCODE_CHAR[(v2 << 2) & 63] +
'=';
}
return base64Str;
};
var btoa = root.btoa, atob = root.atob, utf8Base64Encode, utf8Base64Decode;
if (NODE_JS) {
} else if (!btoa) {
btoa = function (str) {
var v1, v2, v3, base64Str = '', length = str.length;
for (var i = 0, count = parseInt(length / 3) * 3; i < count;) {
v1 = str.charCodeAt(i++);
v2 = str.charCodeAt(i++);
v3 = str.charCodeAt(i++);
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] +
BASE64_ENCODE_CHAR[(v2 << 2 | v3 >>> 6) & 63] +
BASE64_ENCODE_CHAR[v3 & 63];
}
// remain char
var remain = length - count;
if (remain === 1) {
v1 = str.charCodeAt(i);
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4) & 63] +
'==';
} else if (remain === 2) {
v1 = str.charCodeAt(i++);
v2 = str.charCodeAt(i);
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] +
BASE64_ENCODE_CHAR[(v2 << 2) & 63] +
'=';
}
return base64Str;
};
utf8Base64Encode = function (str) {
var v1, v2, v3, base64Str = '', bytes = utf8ToBytes(str), length = bytes.length;
for (var i = 0, count = parseInt(length / 3) * 3; i < count;) {
v1 = bytes[i++];
v2 = bytes[i++];
v3 = bytes[i++];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] +
BASE64_ENCODE_CHAR[(v2 << 2 | v3 >>> 6) & 63] +
BASE64_ENCODE_CHAR[v3 & 63];
}
// remain char
var remain = length - count;
if (remain === 1) {
v1 = bytes[i];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4) & 63] +
'==';
} else if (remain === 2) {
v1 = bytes[i++];
v2 = bytes[i];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] +
BASE64_ENCODE_CHAR[(v2 << 2) & 63] +
'=';
}
return base64Str;
};
atob = function (base64Str) {
var v1, v2, v3, v4, str = '', length = base64Str.length;
if (base64Str.charAt(length - 2) === '=') {
length -= 2;
} else if (base64Str.charAt(length - 1) === '=') {
length -= 1;
}
// 4 char to 3 bytes
for (var i = 0, count = length >> 2 << 2; i < count;) {
v1 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v2 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v3 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v4 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
str += String.fromCharCode((v1 << 2 | v2 >>> 4) & 255) +
String.fromCharCode((v2 << 4 | v3 >>> 2) & 255) +
String.fromCharCode((v3 << 6 | v4) & 255);
}
// remain bytes
var remain = length - count;
if (remain === 2) {
v1 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v2 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
str += String.fromCharCode((v1 << 2 | v2 >>> 4) & 255);
} else if (remain === 3) {
v1 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v2 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
v3 = BASE64_DECODE_CHAR[base64Str.charAt(i++)];
str += String.fromCharCode((v1 << 2 | v2 >>> 4) & 255) +
String.fromCharCode((v2 << 4 | v3 >>> 2) & 255);
}
return str;
};
utf8Base64Decode = function (base64Str) {
var str = '', bytes = decodeAsBytes(base64Str), length = bytes.length;
var i = 0, followingChars = 0, b, c;
while (i < length) {
b = bytes[i++];
if (b <= 0x7F) {
str += String.fromCharCode(b);
continue;
} else if (b > 0xBF && b <= 0xDF) {
c = b & 0x1F;
followingChars = 1;
} else if (b <= 0xEF) {
c = b & 0x0F;
followingChars = 2;
} else if (b <= 0xF7) {
c = b & 0x07;
followingChars = 3;
} else {
throw 'not a UTF-8 string';
}
for (var j = 0; j < followingChars; ++j) {
b = bytes[i++];
if (b < 0x80 || b > 0xBF) {
throw 'not a UTF-8 string';
}
c <<= 6;
c += b & 0x3F;
}
if (c >= 0xD800 && c <= 0xDFFF) {
throw 'not a UTF-8 string';
}
if (c > 0x10FFFF) {
throw 'not a UTF-8 string';
}
if (c <= 0xFFFF) {
str += String.fromCharCode(c);
} else {
c -= 0x10000;
str += String.fromCharCode((c >> 10) + 0xD800);
str += String.fromCharCode((c & 0x3FF) + 0xDC00);
}
}
return str;
};
} else {
utf8Base64Encode = function (str) {
var result = '';
for (var i = 0; i < str.length; i++) {
var charcode = str.charCodeAt(i);
if (charcode < 0x80) {
result += String.fromCharCode(charcode);
} else if (charcode < 0x800) {
result += String.fromCharCode(0xc0 | (charcode >> 6)) +
String.fromCharCode(0x80 | (charcode & 0x3f));
} else if (charcode < 0xd800 || charcode >= 0xe000) {
result += String.fromCharCode(0xe0 | (charcode >> 12)) +
String.fromCharCode(0x80 | ((charcode >> 6) & 0x3f)) +
String.fromCharCode(0x80 | (charcode & 0x3f));
} else {
charcode = 0x10000 + (((charcode & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff));
result += String.fromCharCode(0xf0 | (charcode >> 18)) +
String.fromCharCode(0x80 | ((charcode >> 12) & 0x3f)) +
String.fromCharCode(0x80 | ((charcode >> 6) & 0x3f)) +
String.fromCharCode(0x80 | (charcode & 0x3f));
}
}
return btoa(result);
};
utf8Base64Decode = function (base64Str) {
var tmpStr = atob(base64Str.trim('=').replace(/-/g, '+').replace(/_/g, '/'));
if (!/[^\x00-\x7F]/.test(tmpStr)) {
return tmpStr;
}
var str = '', i = 0, length = tmpStr.length, followingChars = 0, b, c;
while (i < length) {
b = tmpStr.charCodeAt(i++);
if (b <= 0x7F) {
str += String.fromCharCode(b);
continue;
} else if (b > 0xBF && b <= 0xDF) {
c = b & 0x1F;
followingChars = 1;
} else if (b <= 0xEF) {
c = b & 0x0F;
followingChars = 2;
} else if (b <= 0xF7) {
c = b & 0x07;
followingChars = 3;
} else {
throw 'not a UTF-8 string';
}
for (var j = 0; j < followingChars; ++j) {
b = tmpStr.charCodeAt(i++);
if (b < 0x80 || b > 0xBF) {
throw 'not a UTF-8 string';
}
c <<= 6;
c += b & 0x3F;
}
if (c >= 0xD800 && c <= 0xDFFF) {
throw 'not a UTF-8 string';
}
if (c > 0x10FFFF) {
throw 'not a UTF-8 string';
}
if (c <= 0xFFFF) {
str += String.fromCharCode(c);
} else {
c -= 0x10000;
str += String.fromCharCode((c >> 10) + 0xD800);
str += String.fromCharCode((c & 0x3FF) + 0xDC00);
}
}
return str;
};
}
var encode = function (str, asciiOnly) {
var notString = typeof(str) != 'string';
if (notString && str.constructor === root.ArrayBuffer) {
str = new Uint8Array(str);
}
if (notString) {
return encodeFromBytes(str);
} else {
if (!asciiOnly && /[^\x00-\x7F]/.test(str)) {
return utf8Base64Encode(str);
} else {
return btoa(str);
}
}
};
var decode = function (base64Str, asciiOnly) {
return asciiOnly ? atob(base64Str) : utf8Base64Decode(base64Str);
};
var exports = {
encode: encode,
decode: decode,
atob: atob,
btoa: btoa
};
decode.bytes = decodeAsBytes;
decode.string = decode;
root.pagelayer_Base64 = exports;
})();
+10 -10
View File
@@ -1,11 +1,11 @@
/*
* [hi-base64]{@link https://github.com/emn178/hi-base64}
*
* @version 0.2.1
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2017
* @license MIT
*/
/*jslint bitwise: true */
/*Modified by Pagelayer*/
/*
* [hi-base64]{@link https://github.com/emn178/hi-base64}
*
* @version 0.2.1
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2017
* @license MIT
*/
/*jslint bitwise: true */
/*Modified by Pagelayer*/
!function(){"use strict";var r="object"==typeof window?window:{};!r.HI_BASE64_NO_COMMON_JS&&"object"==typeof module&&module.exports,"function"==typeof define&&define.amd;var t,o,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),n={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,a:26,b:27,c:28,d:29,e:30,f:31,g:32,h:33,i:34,j:35,k:36,l:37,m:38,n:39,o:40,p:41,q:42,r:43,s:44,t:45,u:46,v:47,w:48,x:49,y:50,z:51,0:52,1:53,2:54,3:55,4:56,5:57,6:58,7:59,8:60,9:61,"+":62,"/":63,"-":62,_:63},a=function(r){var t,o,e,a,h=[],f=0,i=r.length;"="===r.charAt(i-2)?i-=2:"="===r.charAt(i-1)&&(i-=1);for(var C=0,c=i>>2<<2;C<c;)t=n[r.charAt(C++)],o=n[r.charAt(C++)],e=n[r.charAt(C++)],a=n[r.charAt(C++)],h[f++]=255&(t<<2|o>>>4),h[f++]=255&(o<<4|e>>>2),h[f++]=255&(e<<6|a);var g=i-c;return 2===g?(t=n[r.charAt(C++)],o=n[r.charAt(C++)],h[f++]=255&(t<<2|o>>>4)):3===g&&(t=n[r.charAt(C++)],o=n[r.charAt(C++)],e=n[r.charAt(C++)],h[f++]=255&(t<<2|o>>>4),h[f++]=255&(o<<4|e>>>2)),h},h=r.btoa,f=r.atob;h?(t=function(r){for(var t="",o=0;o<r.length;o++){var e=r.charCodeAt(o);e<128?t+=String.fromCharCode(e):e<2048?t+=String.fromCharCode(192|e>>6)+String.fromCharCode(128|63&e):e<55296||e>=57344?t+=String.fromCharCode(224|e>>12)+String.fromCharCode(128|e>>6&63)+String.fromCharCode(128|63&e):(e=65536+((1023&e)<<10|1023&r.charCodeAt(++o)),t+=String.fromCharCode(240|e>>18)+String.fromCharCode(128|e>>12&63)+String.fromCharCode(128|e>>6&63)+String.fromCharCode(128|63&e))}return h(t)},o=function(r){var t=f(r.trim("=").replace(/-/g,"+").replace(/_/g,"/"));if(!/[^\x00-\x7F]/.test(t))return t;for(var o,e,n="",a=0,h=t.length,i=0;a<h;)if((o=t.charCodeAt(a++))<=127)n+=String.fromCharCode(o);else{if(o>191&&o<=223)e=31&o,i=1;else if(o<=239)e=15&o,i=2;else{if(!(o<=247))throw"not a UTF-8 string";e=7&o,i=3}for(var C=0;C<i;++C){if((o=t.charCodeAt(a++))<128||o>191)throw"not a UTF-8 string";e<<=6,e+=63&o}if(e>=55296&&e<=57343)throw"not a UTF-8 string";if(e>1114111)throw"not a UTF-8 string";e<=65535?n+=String.fromCharCode(e):(e-=65536,n+=String.fromCharCode(55296+(e>>10)),n+=String.fromCharCode(56320+(1023&e)))}return n}):(h=function(r){for(var t,o,n,a="",h=r.length,f=0,i=3*parseInt(h/3);f<i;)t=r.charCodeAt(f++),o=r.charCodeAt(f++),n=r.charCodeAt(f++),a+=e[t>>>2]+e[63&(t<<4|o>>>4)]+e[63&(o<<2|n>>>6)]+e[63&n];var C=h-i;return 1===C?(t=r.charCodeAt(f),a+=e[t>>>2]+e[t<<4&63]+"=="):2===C&&(t=r.charCodeAt(f++),o=r.charCodeAt(f),a+=e[t>>>2]+e[63&(t<<4|o>>>4)]+e[o<<2&63]+"="),a},t=function(r){for(var t,o,n,a="",h=function(r){for(var t=[],o=0;o<r.length;o++){var e=r.charCodeAt(o);e<128?t[t.length]=e:e<2048?(t[t.length]=192|e>>6,t[t.length]=128|63&e):e<55296||e>=57344?(t[t.length]=224|e>>12,t[t.length]=128|e>>6&63,t[t.length]=128|63&e):(e=65536+((1023&e)<<10|1023&r.charCodeAt(++o)),t[t.length]=240|e>>18,t[t.length]=128|e>>12&63,t[t.length]=128|e>>6&63,t[t.length]=128|63&e)}return t}(r),f=h.length,i=0,C=3*parseInt(f/3);i<C;)t=h[i++],o=h[i++],n=h[i++],a+=e[t>>>2]+e[63&(t<<4|o>>>4)]+e[63&(o<<2|n>>>6)]+e[63&n];var c=f-C;return 1===c?(t=h[i],a+=e[t>>>2]+e[t<<4&63]+"=="):2===c&&(t=h[i++],o=h[i],a+=e[t>>>2]+e[63&(t<<4|o>>>4)]+e[o<<2&63]+"="),a},f=function(r){var t,o,e,a,h="",f=r.length;"="===r.charAt(f-2)?f-=2:"="===r.charAt(f-1)&&(f-=1);for(var i=0,C=f>>2<<2;i<C;)t=n[r.charAt(i++)],o=n[r.charAt(i++)],e=n[r.charAt(i++)],a=n[r.charAt(i++)],h+=String.fromCharCode(255&(t<<2|o>>>4))+String.fromCharCode(255&(o<<4|e>>>2))+String.fromCharCode(255&(e<<6|a));var c=f-C;return 2===c?(t=n[r.charAt(i++)],o=n[r.charAt(i++)],h+=String.fromCharCode(255&(t<<2|o>>>4))):3===c&&(t=n[r.charAt(i++)],o=n[r.charAt(i++)],e=n[r.charAt(i++)],h+=String.fromCharCode(255&(t<<2|o>>>4))+String.fromCharCode(255&(o<<4|e>>>2))),h},o=function(r){for(var t,o,e="",n=a(r),h=n.length,f=0,i=0;f<h;)if((t=n[f++])<=127)e+=String.fromCharCode(t);else{if(t>191&&t<=223)o=31&t,i=1;else if(t<=239)o=15&t,i=2;else{if(!(t<=247))throw"not a UTF-8 string";o=7&t,i=3}for(var C=0;C<i;++C){if((t=n[f++])<128||t>191)throw"not a UTF-8 string";o<<=6,o+=63&t}if(o>=55296&&o<=57343)throw"not a UTF-8 string";if(o>1114111)throw"not a UTF-8 string";o<=65535?e+=String.fromCharCode(o):(o-=65536,e+=String.fromCharCode(55296+(o>>10)),e+=String.fromCharCode(56320+(1023&o)))}return e});var i=function(r,t){return t?f(r):o(r)},C={encode:function(o,n){var a="string"!=typeof o;return a&&o.constructor===r.ArrayBuffer&&(o=new Uint8Array(o)),a?function(r){for(var t,o,n,a="",h=r.length,f=0,i=3*parseInt(h/3);f<i;)t=r[f++],o=r[f++],n=r[f++],a+=e[t>>>2]+e[63&(t<<4|o>>>4)]+e[63&(o<<2|n>>>6)]+e[63&n];var C=h-i;return 1===C?(t=r[f],a+=e[t>>>2]+e[t<<4&63]+"=="):2===C&&(t=r[f++],o=r[f],a+=e[t>>>2]+e[63&(t<<4|o>>>4)]+e[o<<2&63]+"="),a}(o):!n&&/[^\x00-\x7F]/.test(o)?t(o):h(o)},decode:i,atob:f,btoa:h};i.bytes=a,i.string=i,r.pagelayer_Base64=C}();
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '0d1f000656bdb8897914');
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '0d1f000656bdb8897914');
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
@@ -1,170 +1,170 @@
<?php
//////////////////////////////////////////////////////////////
//===========================================================
// givejs.php
//===========================================================
// PAGELAYER
// Inspired by the DESIRE to be the BEST OF ALL
// ----------------------------------------------------------
// Started by: Pulkit Gupta
// Date: 23rd Jan 2017
// Time: 23:00 hrs
// Site: http://pagelayer.com/wordpress (PAGELAYER)
// ----------------------------------------------------------
// Please Read the Terms of use at http://pagelayer.com/tos
// ----------------------------------------------------------
//===========================================================
// (c)Pagelayer Team
//===========================================================
//////////////////////////////////////////////////////////////
if(!empty($_REQUEST['test'])){
echo 1;
die();
}
// Read the file
$data = '';
$data_premium = '';
$self_path = dirname(__FILE__);
$files = array(
// Admin JS
'pagelayer-editor.js',
'widgets.js',
'premium.js',
'properties.js',
'base-64.min.js',
'slimscroll.js',
'vanilla-picker.min.js',
'tlite.min.js',
'pagelayer-pen.js',
// Enduser JS
'imagesloaded.min.js',
'nivo-lightbox.min.js',
'owl.carousel.min.js',
'pagelayer-frontend.js',
'premium-frontend.js',
'wow.min.js',
'jquery-numerator.js',
'simpleParallax.min.js',
'chart.min.js',
'shuffle.min.js'
);
// What files to give
$give = @$_REQUEST['give'];
// Premium
$premium = @$_REQUEST['premium'];
if(!empty($give)){
$give = explode(',', $give);
// Check all files are in the supported list
foreach($give as $file){
if(in_array($file, $files)){
$final[md5($file)] = $file;
}
}
}
if(!empty($premium)){
$premium = explode(',', trim($premium, ','));
// Check all files are in the supported list
foreach($premium as $file){
if(in_array($file, $files)){
$final_premium[md5($file)] = $file;
}
}
}
// Give all
if(empty($final)){
$final = $files;
}
foreach($final as $k => $v){
//echo $k.'<br>';
$data .= file_get_contents($self_path.'/'.$v)."\n\n";
}
if(!empty($final_premium)){
foreach($final_premium as $k => $v){
//echo $k.'<br>';
$data_premium .= file_get_contents($self_path.'/'.$v)."\n\n";
}
}
// We are zipping if possible
if(function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')){
ob_start('ob_gzhandler');
}
// Type javascript
header("Content-type: text/javascript; charset: UTF-8");
// Set a zero Mtime
$filetime = filemtime($self_path.'/pagelayer-editor.js');
// Are we to also serve Shortcodes ?
if(!empty($pagelayer->shortcodes)){
$data .= 'pagelayer_shortcodes = '.json_encode($pagelayer->shortcodes).';'."\n\n";
$data .= 'pagelayer_styles = '.json_encode($pagelayer->styles).';'."\n\n";
$data .= 'pagelayer_groups = '.json_encode($pagelayer->groups).';'."\n\n";
}
// Add the langs as well
preg_match_all('/pagelayer_l\([\'"](\w*)[\'"]\)/is', $data, $matches);
if(!empty($matches[1]) && function_exists('__pl')){
foreach($matches[1] as $lk => $lv){
$export_langs[$lv] = __pl($lv);
}
}
// Also add the fonts
if(!empty($pagelayer->fonts)){
$export_langs['pl_fonts_list'] = $pagelayer->fonts;
}
// And lang string ?
if(!empty($export_langs)){
$data .= 'pagelayer_lang = '.json_encode($export_langs).';'."\n\n";
}
// Cache Control
header("Cache-Control: must-revalidate");
// Checking if the client is validating his cache and if it is current.
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $filetime)) {
// Client's cache IS current, so we just respond '304 Not Modified'.
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $filetime).' GMT', true, 304);
return;
}else{
// Image not cached or cache outdated, we respond '200 OK' and output the image.
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $filetime).' GMT', true, 200);
}
echo $data;
echo $data_premium;
// Write if we are front-end only then
$dev = dirname(dirname(__FILE__)).'/dev.php';
if(!empty($_REQUEST['write']) && file_exists($dev)){
include_once($dev);
write_js();
}
<?php
//////////////////////////////////////////////////////////////
//===========================================================
// givejs.php
//===========================================================
// PAGELAYER
// Inspired by the DESIRE to be the BEST OF ALL
// ----------------------------------------------------------
// Started by: Pulkit Gupta
// Date: 23rd Jan 2017
// Time: 23:00 hrs
// Site: http://pagelayer.com/wordpress (PAGELAYER)
// ----------------------------------------------------------
// Please Read the Terms of use at http://pagelayer.com/tos
// ----------------------------------------------------------
//===========================================================
// (c)Pagelayer Team
//===========================================================
//////////////////////////////////////////////////////////////
if(!empty($_REQUEST['test'])){
echo 1;
die();
}
// Read the file
$data = '';
$data_premium = '';
$self_path = dirname(__FILE__);
$files = array(
// Admin JS
'pagelayer-editor.js',
'widgets.js',
'premium.js',
'properties.js',
'base-64.min.js',
'slimscroll.js',
'vanilla-picker.min.js',
'tlite.min.js',
'pagelayer-pen.js',
// Enduser JS
'imagesloaded.min.js',
'nivo-lightbox.min.js',
'owl.carousel.min.js',
'pagelayer-frontend.js',
'premium-frontend.js',
'wow.min.js',
'jquery-numerator.js',
'simpleParallax.min.js',
'chart.min.js',
'shuffle.min.js'
);
// What files to give
$give = @$_REQUEST['give'];
// Premium
$premium = @$_REQUEST['premium'];
if(!empty($give)){
$give = explode(',', $give);
// Check all files are in the supported list
foreach($give as $file){
if(in_array($file, $files)){
$final[md5($file)] = $file;
}
}
}
if(!empty($premium)){
$premium = explode(',', trim($premium, ','));
// Check all files are in the supported list
foreach($premium as $file){
if(in_array($file, $files)){
$final_premium[md5($file)] = $file;
}
}
}
// Give all
if(empty($final)){
$final = $files;
}
foreach($final as $k => $v){
//echo $k.'<br>';
$data .= file_get_contents($self_path.'/'.$v)."\n\n";
}
if(!empty($final_premium)){
foreach($final_premium as $k => $v){
//echo $k.'<br>';
$data_premium .= file_get_contents($self_path.'/'.$v)."\n\n";
}
}
// We are zipping if possible
if(function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')){
ob_start('ob_gzhandler');
}
// Type javascript
header("Content-type: text/javascript; charset: UTF-8");
// Set a zero Mtime
$filetime = filemtime($self_path.'/pagelayer-editor.js');
// Are we to also serve Shortcodes ?
if(!empty($pagelayer->shortcodes)){
$data .= 'pagelayer_shortcodes = '.json_encode($pagelayer->shortcodes).';'."\n\n";
$data .= 'pagelayer_styles = '.json_encode($pagelayer->styles).';'."\n\n";
$data .= 'pagelayer_groups = '.json_encode($pagelayer->groups).';'."\n\n";
}
// Add the langs as well
preg_match_all('/pagelayer_l\([\'"](\w*)[\'"]\)/is', $data, $matches);
if(!empty($matches[1]) && function_exists('__pl')){
foreach($matches[1] as $lk => $lv){
$export_langs[$lv] = __pl($lv);
}
}
// Also add the fonts
if(!empty($pagelayer->fonts)){
$export_langs['pl_fonts_list'] = $pagelayer->fonts;
}
// And lang string ?
if(!empty($export_langs)){
$data .= 'pagelayer_lang = '.json_encode($export_langs).';'."\n\n";
}
// Cache Control
header("Cache-Control: must-revalidate");
// Checking if the client is validating his cache and if it is current.
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $filetime)) {
// Client's cache IS current, so we just respond '304 Not Modified'.
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $filetime).' GMT', true, 304);
return;
}else{
// Image not cached or cache outdated, we respond '200 OK' and output the image.
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $filetime).' GMT', true, 200);
}
echo $data;
echo $data_premium;
// Write if we are front-end only then
$dev = dirname(dirname(__FILE__)).'/dev.php';
if(!empty($_REQUEST['write']) && file_exists($dev)){
include_once($dev);
write_js();
}
File diff suppressed because one or more lines are too long
+136 -136
View File
@@ -1,137 +1,137 @@
/*
* jQuery Numerator Plugin 0.2.1
* https://github.com/garethdn/jquery-numerator
*
* Copyright 2015, Gareth Nolan
* http://ie.linkedin.com/in/garethnolan/
* Based on jQuery Boilerplate by Zeno Rocha with the help of Addy Osmani
* http://jqueryboilerplate.com
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
;(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// AMD is used - Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof exports === 'object') {
factory(require('jquery'));
} else {
// Neither AMD nor CommonJS used. Use global variables.
if (typeof jQuery === 'undefined') {
throw 'jquery-numerator requires jQuery to be loaded first';
}
factory(jQuery);
}
}(function ($) {
var pluginName = "numerator",
defaults = {
easing: 'swing',
duration: 500,
delimiter: undefined,
rounding: 0,
toValue: undefined,
fromValue: undefined,
queue: false,
onStart: function(){},
onStep: function(){},
onProgress: function(){},
onComplete: function(){}
};
function Plugin ( element, options ) {
this.element = element;
this.settings = $.extend( {}, defaults, options );
this._defaults = defaults;
this._name = pluginName;
this.init();
}
Plugin.prototype = {
init: function () {
this.parseElement();
this.setValue();
},
parseElement: function () {
var elText = $.trim($(this.element).text());
this.settings.fromValue = this.settings.fromValue || this.format(elText);
},
setValue: function() {
var self = this;
$({value: self.settings.fromValue}).animate({value: self.settings.toValue}, {
duration: parseInt(self.settings.duration, 10),
easing: self.settings.easing,
start: self.settings.onStart,
step: function(now, fx) {
$(self.element).text(self.format(now));
// accepts two params - (now, fx)
self.settings.onStep(now, fx);
},
// accepts three params - (animation object, progress ratio, time remaining(ms))
progress: self.settings.onProgress,
complete: self.settings.onComplete
});
},
format: function(value){
var self = this;
if ( parseInt(this.settings.rounding ) < 1) {
value = parseInt(value, 10);
} else {
value = parseFloat(value).toFixed( parseInt(this.settings.rounding) );
}
if (self.settings.delimiter) {
return this.delimit(value)
} else {
return value;
}
},
// TODO: Add comments to this function
delimit: function(value){
var self = this;
value = value.toString();
if (self.settings.rounding && parseInt(self.settings.rounding, 10) > 0) {
var decimals = value.substring( (value.length - (self.settings.rounding + 1)), value.length ),
wholeValue = value.substring( 0, (value.length - (self.settings.rounding + 1)));
return self.addDelimiter(wholeValue) + decimals;
} else {
return self.addDelimiter(value);
}
},
addDelimiter: function(value){
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, this.settings.delimiter);
}
};
$.fn[ pluginName ] = function ( options ) {
return this.each(function() {
if ( $.data( this, "plugin_" + pluginName ) ) {
$.data(this, 'plugin_' + pluginName, null);
}
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
});
};
/*
* jQuery Numerator Plugin 0.2.1
* https://github.com/garethdn/jquery-numerator
*
* Copyright 2015, Gareth Nolan
* http://ie.linkedin.com/in/garethnolan/
* Based on jQuery Boilerplate by Zeno Rocha with the help of Addy Osmani
* http://jqueryboilerplate.com
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
;(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// AMD is used - Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof exports === 'object') {
factory(require('jquery'));
} else {
// Neither AMD nor CommonJS used. Use global variables.
if (typeof jQuery === 'undefined') {
throw 'jquery-numerator requires jQuery to be loaded first';
}
factory(jQuery);
}
}(function ($) {
var pluginName = "numerator",
defaults = {
easing: 'swing',
duration: 500,
delimiter: undefined,
rounding: 0,
toValue: undefined,
fromValue: undefined,
queue: false,
onStart: function(){},
onStep: function(){},
onProgress: function(){},
onComplete: function(){}
};
function Plugin ( element, options ) {
this.element = element;
this.settings = $.extend( {}, defaults, options );
this._defaults = defaults;
this._name = pluginName;
this.init();
}
Plugin.prototype = {
init: function () {
this.parseElement();
this.setValue();
},
parseElement: function () {
var elText = $.trim($(this.element).text());
this.settings.fromValue = this.settings.fromValue || this.format(elText);
},
setValue: function() {
var self = this;
$({value: self.settings.fromValue}).animate({value: self.settings.toValue}, {
duration: parseInt(self.settings.duration, 10),
easing: self.settings.easing,
start: self.settings.onStart,
step: function(now, fx) {
$(self.element).text(self.format(now));
// accepts two params - (now, fx)
self.settings.onStep(now, fx);
},
// accepts three params - (animation object, progress ratio, time remaining(ms))
progress: self.settings.onProgress,
complete: self.settings.onComplete
});
},
format: function(value){
var self = this;
if ( parseInt(this.settings.rounding ) < 1) {
value = parseInt(value, 10);
} else {
value = parseFloat(value).toFixed( parseInt(this.settings.rounding) );
}
if (self.settings.delimiter) {
return this.delimit(value)
} else {
return value;
}
},
// TODO: Add comments to this function
delimit: function(value){
var self = this;
value = value.toString();
if (self.settings.rounding && parseInt(self.settings.rounding, 10) > 0) {
var decimals = value.substring( (value.length - (self.settings.rounding + 1)), value.length ),
wholeValue = value.substring( 0, (value.length - (self.settings.rounding + 1)));
return self.addDelimiter(wholeValue) + decimals;
} else {
return self.addDelimiter(value);
}
},
addDelimiter: function(value){
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, this.settings.delimiter);
}
};
$.fn[ pluginName ] = function ( options ) {
return this.each(function() {
if ( $.data( this, "plugin_" + pluginName ) ) {
$.data(this, 'plugin_' + pluginName, null);
}
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
});
};
}));
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,79 +1,79 @@
// Lets start
jQuery(document).ready(function(){
var pl_admin_tabs = function(sel){
jQuery('.nav-tab-wrapper a').click(function(){
var tEle = jQuery(this);
var sel = tEle.attr('tab-class') || 'pagelayer-tab-panel';
// Limit effect to the container element.
var context = tEle.closest('.nav-tab-wrapper').parent().parent();
context.find('.nav-tab-wrapper a').removeClass('nav-tab-active');
tEle.addClass('nav-tab-active');
context.find('.'+sel).hide();
context.find(tEle.attr('href')).show();
location.hash = tEle.attr('href')+'_tab';
return false;
});
// Make setting nav-tab-active optional.
jQuery('.nav-tab-wrapper.pagelayer-wrapper').each(function(){
var jEle = jQuery(this);
var hash = location.hash.slice(1, -4);
if(hash){
var active_tab_ele = jEle.find('[href="#'+hash+'"]');
if (active_tab_ele.length > 0){
active_tab_ele.click();
return;
}
}
var first = jEle.find('a').first();
first.click();
});
}
var pl_admin_accordion = function(){
jQuery('.pagelayer-acc-wrapper .pagelayer-acc-tab').click(function(){
var tEle = jQuery(this);
if(tEle.hasClass('nav-tab-active')){
tEle.toggleClass('nav-tab-active').next('.pagelayer-acc-panel').toggle();
}else{
// Limit effect to the container element.
var context = tEle.closest('.pagelayer-acc-wrapper ');
context.find('.pagelayer-acc-tab').removeClass('nav-tab-active');
context.find('.pagelayer-acc-panel').hide();
tEle.addClass('nav-tab-active');
tEle.next('.pagelayer-acc-panel').show();
}
});
// Make setting nav-tab-active optional.
jQuery('.pagelayer-acc-wrapper').each(function(){
var jEle = jQuery(this);
var active_acc_ele = jEle.find('nav-tab-active');
if (active_acc_ele.length > 0){
active_acc_ele.click();
}else{
jEle.find('.pagelayer-acc-tab').first().click();
}
});
}
pl_admin_tabs();
pl_admin_accordion();
// Lets start
jQuery(document).ready(function(){
var pl_admin_tabs = function(sel){
jQuery('.nav-tab-wrapper a').click(function(){
var tEle = jQuery(this);
var sel = tEle.attr('tab-class') || 'pagelayer-tab-panel';
// Limit effect to the container element.
var context = tEle.closest('.nav-tab-wrapper').parent().parent();
context.find('.nav-tab-wrapper a').removeClass('nav-tab-active');
tEle.addClass('nav-tab-active');
context.find('.'+sel).hide();
context.find(tEle.attr('href')).show();
location.hash = tEle.attr('href')+'_tab';
return false;
});
// Make setting nav-tab-active optional.
jQuery('.nav-tab-wrapper.pagelayer-wrapper').each(function(){
var jEle = jQuery(this);
var hash = location.hash.slice(1, -4);
if(hash){
var active_tab_ele = jEle.find('[href="#'+hash+'"]');
if (active_tab_ele.length > 0){
active_tab_ele.click();
return;
}
}
var first = jEle.find('a').first();
first.click();
});
}
var pl_admin_accordion = function(){
jQuery('.pagelayer-acc-wrapper .pagelayer-acc-tab').click(function(){
var tEle = jQuery(this);
if(tEle.hasClass('nav-tab-active')){
tEle.toggleClass('nav-tab-active').next('.pagelayer-acc-panel').toggle();
}else{
// Limit effect to the container element.
var context = tEle.closest('.pagelayer-acc-wrapper ');
context.find('.pagelayer-acc-tab').removeClass('nav-tab-active');
context.find('.pagelayer-acc-panel').hide();
tEle.addClass('nav-tab-active');
tEle.next('.pagelayer-acc-panel').show();
}
});
// Make setting nav-tab-active optional.
jQuery('.pagelayer-acc-wrapper').each(function(){
var jEle = jQuery(this);
var active_acc_ele = jEle.find('nav-tab-active');
if (active_acc_ele.length > 0){
active_acc_ele.click();
}else{
jEle.find('.pagelayer-acc-tab').first().click();
}
});
}
pl_admin_tabs();
pl_admin_accordion();
});
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,16 +1,16 @@
/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* Version: 1.3.8
*
*/
(function(e){e.fn.extend({slimScroll:function(f){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},f);this.each(function(){function v(d){if(r){d=d||window.event;
var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);e(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&n(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function n(d,g,e){k=!1;var f=b.outerHeight()-c.outerHeight();g&&(g=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),g=Math.min(Math.max(g,0),f),g=0<d?Math.ceil(g):Math.floor(g),c.css({top:g+"px"}));l=parseInt(c.css("top"))/(b.outerHeight()-c.outerHeight());g=
l*(b[0].scrollHeight-b.outerHeight());e&&(g=d,d=g/b[0].scrollHeight*b.outerHeight(),d=Math.min(Math.max(d,0),f),c.css({top:d+"px"}));b.scrollTop(g);b.trigger("slimscrolling",~~g);w();p()}function x(){u=Math.max(b.outerHeight()/b[0].scrollHeight*b.outerHeight(),30);c.css({height:u+"px"});var a=u==b.outerHeight()?"none":"block";c.css({display:a})}function w(){x();clearTimeout(B);l==~~l?(k=a.allowPageScroll,C!=l&&b.trigger("slimscroll",0==~~l?"top":"bottom")):k=!1;C=l;u>=b.outerHeight()?k=!0:(c.stop(!0,
!0).fadeIn("fast"),a.railVisible&&m.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(B=setTimeout(function(){a.disableFadeOut&&r||y||z||(c.fadeOut("slow"),m.fadeOut("slow"))},1E3))}var r,y,z,B,A,u,l,C,k=!1,b=e(this);if(b.parent().hasClass(a.wrapperClass)){var q=b.scrollTop(),c=b.siblings("."+a.barClass),m=b.siblings("."+a.railClass);x();if(e.isPlainObject(f)){if("height"in f&&"auto"==f.height){b.parent().css("height","auto");b.css("height","auto");var h=b.parent().parent().height();b.parent().css("height",
h);b.css("height",h)}else"height"in f&&(h=f.height,b.parent().css("height",h),b.css("height",h));if("scrollTo"in f)q=parseInt(a.scrollTo);else if("scrollBy"in f)q+=parseInt(a.scrollBy);else if("destroy"in f){c.remove();m.remove();b.unwrap();return}n(q,!1,!0)}}else if(!(e.isPlainObject(f)&&"destroy"in f)){a.height="auto"==a.height?b.parent().height():a.height;q=e("<div></div>").addClass(a.wrapperClass).css({position:"relative",overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",
width:a.width,height:a.height});var m=e("<div></div>").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=e("<div></div>").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,
WebkitBorderRadius:a.borderRadius,zIndex:99}),h="right"==a.position?{right:a.distance}:{left:a.distance};m.css(h);c.css(h);b.wrap(q);b.parent().append(c);b.parent().append(m);a.railDraggable&&c.bind("mousedown",function(a){var b=c.parent();z=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);n(0,c.position().top,!1)});b.bind("mouseup.slimscroll",function(a){z=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",
function(a){a.stopPropagation();a.preventDefault();return!1});m.hover(function(){w()},function(){p()});c.hover(function(){y=!0},function(){y=!1});b.hover(function(){r=!0;w();p()},function(){r=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(A=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&&(n((A-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),A=b.originalEvent.touches[0].pageY)});
x();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),n(0,!0)):"top"!==a.start&&(n(e(a.start).position().top,null,!0),a.alwaysVisible||c.hide());window.addEventListener?(this.addEventListener("DOMMouseScroll",v,!1),this.addEventListener("mousewheel",v,!1)):document.attachEvent("onmousewheel",v)}});return this}});e.fn.extend({slimscroll:e.fn.slimScroll})})(jQuery);
/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* Version: 1.3.8
*
*/
(function(e){e.fn.extend({slimScroll:function(f){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},f);this.each(function(){function v(d){if(r){d=d||window.event;
var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);e(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&n(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function n(d,g,e){k=!1;var f=b.outerHeight()-c.outerHeight();g&&(g=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),g=Math.min(Math.max(g,0),f),g=0<d?Math.ceil(g):Math.floor(g),c.css({top:g+"px"}));l=parseInt(c.css("top"))/(b.outerHeight()-c.outerHeight());g=
l*(b[0].scrollHeight-b.outerHeight());e&&(g=d,d=g/b[0].scrollHeight*b.outerHeight(),d=Math.min(Math.max(d,0),f),c.css({top:d+"px"}));b.scrollTop(g);b.trigger("slimscrolling",~~g);w();p()}function x(){u=Math.max(b.outerHeight()/b[0].scrollHeight*b.outerHeight(),30);c.css({height:u+"px"});var a=u==b.outerHeight()?"none":"block";c.css({display:a})}function w(){x();clearTimeout(B);l==~~l?(k=a.allowPageScroll,C!=l&&b.trigger("slimscroll",0==~~l?"top":"bottom")):k=!1;C=l;u>=b.outerHeight()?k=!0:(c.stop(!0,
!0).fadeIn("fast"),a.railVisible&&m.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(B=setTimeout(function(){a.disableFadeOut&&r||y||z||(c.fadeOut("slow"),m.fadeOut("slow"))},1E3))}var r,y,z,B,A,u,l,C,k=!1,b=e(this);if(b.parent().hasClass(a.wrapperClass)){var q=b.scrollTop(),c=b.siblings("."+a.barClass),m=b.siblings("."+a.railClass);x();if(e.isPlainObject(f)){if("height"in f&&"auto"==f.height){b.parent().css("height","auto");b.css("height","auto");var h=b.parent().parent().height();b.parent().css("height",
h);b.css("height",h)}else"height"in f&&(h=f.height,b.parent().css("height",h),b.css("height",h));if("scrollTo"in f)q=parseInt(a.scrollTo);else if("scrollBy"in f)q+=parseInt(a.scrollBy);else if("destroy"in f){c.remove();m.remove();b.unwrap();return}n(q,!1,!0)}}else if(!(e.isPlainObject(f)&&"destroy"in f)){a.height="auto"==a.height?b.parent().height():a.height;q=e("<div></div>").addClass(a.wrapperClass).css({position:"relative",overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",
width:a.width,height:a.height});var m=e("<div></div>").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=e("<div></div>").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,
WebkitBorderRadius:a.borderRadius,zIndex:99}),h="right"==a.position?{right:a.distance}:{left:a.distance};m.css(h);c.css(h);b.wrap(q);b.parent().append(c);b.parent().append(m);a.railDraggable&&c.bind("mousedown",function(a){var b=c.parent();z=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);n(0,c.position().top,!1)});b.bind("mouseup.slimscroll",function(a){z=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",
function(a){a.stopPropagation();a.preventDefault();return!1});m.hover(function(){w()},function(){p()});c.hover(function(){y=!0},function(){y=!1});b.hover(function(){r=!0;w();p()},function(){r=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(A=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&&(n((A-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),A=b.originalEvent.touches[0].pageY)});
x();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),n(0,!0)):"top"!==a.start&&(n(e(a.start).position().top,null,!0),a.alwaysVisible||c.hide());window.addEventListener?(this.addEventListener("DOMMouseScroll",v,!1),this.addEventListener("mousewheel",v,!1)):document.attachEvent("onmousewheel",v)}});return this}});e.fn.extend({slimscroll:e.fn.slimScroll})})(jQuery);
+148 -148
View File
@@ -1,148 +1,148 @@
function pagelayer_tlite(getTooltipOpts) {
document.addEventListener('mouseover', function (e) {
var el = e.target;
var opts = getTooltipOpts(el);
if (!opts) {
el = el.parentElement;
opts = el && getTooltipOpts(el);
}
opts && pagelayer_tlite.show(el, opts, true);
});
}
pagelayer_tlite.show = function (el, opts, isAuto) {
var fallbackAttrib = 'data-tlite';
opts = opts || {};
(el.tooltip || Tooltip(el, opts)).show();
function Tooltip(el, opts) {
var tooltipEl;
var showTimer;
var text;
el.addEventListener('mousedown', autoHide);
el.addEventListener('mouseleave', autoHide);
function show() {
text = el.title || el.getAttribute(fallbackAttrib) || text;
el.title = '';
el.setAttribute(fallbackAttrib, '');
text && !showTimer && (showTimer = setTimeout(fadeIn, isAuto ? 150 : 1))
}
function autoHide() {
pagelayer_tlite.hide(el, true);
}
function hide(isAutoHiding) {
if (isAuto === isAutoHiding) {
showTimer = clearTimeout(showTimer);
var parent = tooltipEl && tooltipEl.parentNode;
parent && parent.removeChild(tooltipEl);
tooltipEl = undefined;
}
}
function fadeIn() {
if (!tooltipEl) {
tooltipEl = createTooltip(el, text, opts);
}
}
return el.tooltip = {
show: show,
hide: hide
};
}
function createTooltip(el, text, opts) {
var tooltipEl = document.createElement('span');
var grav = opts.grav || el.getAttribute('data-tlite') || 'n';
tooltipEl.innerHTML = text;
el.appendChild(tooltipEl);
var vertGrav = grav[0] || '';
var horzGrav = grav[1] || '';
var windowInnerWidth = window.parent.innerWidth - 15;
var windowInnerHeight = window.parent.innerHeight;
function positionTooltip() {
tooltipEl.className = 'pagelayer-tlite ' + 'pagelayer-tlite-' + vertGrav + horzGrav;
var arrowSize = 10;
var top = el.offsetTop;
var left = el.offsetLeft;
if (tooltipEl.offsetParent === el) {
top = left = 0;
}
var width = el.offsetWidth;
var height = el.offsetHeight;
var tooltipHeight = tooltipEl.offsetHeight;
var tooltipWidth = tooltipEl.offsetWidth;
var centerEl = left + (width / 2);
tooltipEl.style.top = (
vertGrav === 's' ? (top - tooltipHeight - arrowSize) :
vertGrav === 'n' ? (top + height + arrowSize) :
(top + (height / 2) - (tooltipHeight / 2))
) + 'px';
tooltipEl.style.left = (
horzGrav === 'w' ? left :
horzGrav === 'e' ? left + width - tooltipWidth :
vertGrav === 'w' ? (left + width + arrowSize) :
vertGrav === 'e' ? (left - tooltipWidth - arrowSize) :
(centerEl - tooltipWidth / 2)
) + 'px';
}
positionTooltip();
var rect = tooltipEl.getBoundingClientRect();
if (vertGrav === 's' && rect.top < 0) {
vertGrav = 'n';
positionTooltip();
} else if (vertGrav === 'n' && rect.bottom > windowInnerHeight) {
vertGrav = 's';
positionTooltip();
} else if (vertGrav === 'e' && rect.left < 0) {
vertGrav = 'w';
positionTooltip();
} else if (vertGrav === 'w' && rect.right > windowInnerWidth) {
vertGrav = 'e';
positionTooltip();
}
positionTooltip();
// Additional handling
if(rect.left < 0) {
horzGrav = 'w';
positionTooltip();
} else if (rect.right > windowInnerWidth) {
horzGrav = 'e';
positionTooltip();
}
tooltipEl.className += ' pagelayer-tlite-visible';
return tooltipEl;
}
};
pagelayer_tlite.hide = function (el, isAuto) {
el.tooltip && el.tooltip.hide(isAuto);
};
if (typeof module !== 'undefined' && module.exports) {
module.exports = tlite;
}
function pagelayer_tlite(getTooltipOpts) {
document.addEventListener('mouseover', function (e) {
var el = e.target;
var opts = getTooltipOpts(el);
if (!opts) {
el = el.parentElement;
opts = el && getTooltipOpts(el);
}
opts && pagelayer_tlite.show(el, opts, true);
});
}
pagelayer_tlite.show = function (el, opts, isAuto) {
var fallbackAttrib = 'data-tlite';
opts = opts || {};
(el.tooltip || Tooltip(el, opts)).show();
function Tooltip(el, opts) {
var tooltipEl;
var showTimer;
var text;
el.addEventListener('mousedown', autoHide);
el.addEventListener('mouseleave', autoHide);
function show() {
text = el.title || el.getAttribute(fallbackAttrib) || text;
el.title = '';
el.setAttribute(fallbackAttrib, '');
text && !showTimer && (showTimer = setTimeout(fadeIn, isAuto ? 150 : 1))
}
function autoHide() {
pagelayer_tlite.hide(el, true);
}
function hide(isAutoHiding) {
if (isAuto === isAutoHiding) {
showTimer = clearTimeout(showTimer);
var parent = tooltipEl && tooltipEl.parentNode;
parent && parent.removeChild(tooltipEl);
tooltipEl = undefined;
}
}
function fadeIn() {
if (!tooltipEl) {
tooltipEl = createTooltip(el, text, opts);
}
}
return el.tooltip = {
show: show,
hide: hide
};
}
function createTooltip(el, text, opts) {
var tooltipEl = document.createElement('span');
var grav = opts.grav || el.getAttribute('data-tlite') || 'n';
tooltipEl.innerHTML = text;
el.appendChild(tooltipEl);
var vertGrav = grav[0] || '';
var horzGrav = grav[1] || '';
var windowInnerWidth = window.parent.innerWidth - 15;
var windowInnerHeight = window.parent.innerHeight;
function positionTooltip() {
tooltipEl.className = 'pagelayer-tlite ' + 'pagelayer-tlite-' + vertGrav + horzGrav;
var arrowSize = 10;
var top = el.offsetTop;
var left = el.offsetLeft;
if (tooltipEl.offsetParent === el) {
top = left = 0;
}
var width = el.offsetWidth;
var height = el.offsetHeight;
var tooltipHeight = tooltipEl.offsetHeight;
var tooltipWidth = tooltipEl.offsetWidth;
var centerEl = left + (width / 2);
tooltipEl.style.top = (
vertGrav === 's' ? (top - tooltipHeight - arrowSize) :
vertGrav === 'n' ? (top + height + arrowSize) :
(top + (height / 2) - (tooltipHeight / 2))
) + 'px';
tooltipEl.style.left = (
horzGrav === 'w' ? left :
horzGrav === 'e' ? left + width - tooltipWidth :
vertGrav === 'w' ? (left + width + arrowSize) :
vertGrav === 'e' ? (left - tooltipWidth - arrowSize) :
(centerEl - tooltipWidth / 2)
) + 'px';
}
positionTooltip();
var rect = tooltipEl.getBoundingClientRect();
if (vertGrav === 's' && rect.top < 0) {
vertGrav = 'n';
positionTooltip();
} else if (vertGrav === 'n' && rect.bottom > windowInnerHeight) {
vertGrav = 's';
positionTooltip();
} else if (vertGrav === 'e' && rect.left < 0) {
vertGrav = 'w';
positionTooltip();
} else if (vertGrav === 'w' && rect.right > windowInnerWidth) {
vertGrav = 'e';
positionTooltip();
}
positionTooltip();
// Additional handling
if(rect.left < 0) {
horzGrav = 'w';
positionTooltip();
} else if (rect.right > windowInnerWidth) {
horzGrav = 'e';
positionTooltip();
}
tooltipEl.className += ' pagelayer-tlite-visible';
return tooltipEl;
}
};
pagelayer_tlite.hide = function (el, isAuto) {
el.tooltip && el.tooltip.hide(isAuto);
};
if (typeof module !== 'undefined' && module.exports) {
module.exports = tlite;
}
@@ -1,428 +1,428 @@
(function ($) {
'use strict';
// jshint camelcase:true
function hex(x) {
return ('0' + parseInt(x).toString(16)).slice(-2);
}
function colorToHex(rgb) {
if (rgb.search('rgb') === -1) {
return rgb.replace('#', '');
} else if (rgb === 'rgba(0, 0, 0, 0)') {
return 'transparent';
} else {
rgb = rgb.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+))?\)$/);
return hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
}
}
function colorTagHandler(element, trumbowyg) {
var tags = [];
if (!element.style) {
return tags;
}
// background color
if (element.style.backgroundColor !== '') {
var backColor = colorToHex(element.style.backgroundColor);
if (trumbowyg.o.plugins.colors.colorList.indexOf(backColor) >= 0) {
tags.push('backColor' + backColor);
} else {
tags.push('backColorFree');
}
}
// text color
var foreColor;
if (element.style.color !== '') {
foreColor = colorToHex(element.style.color);
} else if (element.hasAttribute('color')) {
foreColor = colorToHex(element.getAttribute('color'));
}
if (foreColor) {
if (trumbowyg.o.plugins.colors.colorList.indexOf(foreColor) >= 0) {
tags.push('foreColor' + foreColor);
} else {
tags.push('foreColorFree');
}
}
return tags;
}
var defaultOptions = {
colorList: ['ffffff', '000000', 'eeece1', '1f497d', '4f81bd', 'c0504d', '9bbb59', '8064a2', '4bacc6', 'f79646', 'ffff00', 'f2f2f2', '7f7f7f', 'ddd9c3', 'c6d9f0', 'dbe5f1', 'f2dcdb', 'ebf1dd', 'e5e0ec', 'dbeef3', 'fdeada', 'fff2ca', 'd8d8d8', '595959', 'c4bd97', '8db3e2', 'b8cce4', 'e5b9b7', 'd7e3bc', 'ccc1d9', 'b7dde8', 'fbd5b5', 'ffe694', 'bfbfbf', '3f3f3f', '938953', '548dd4', '95b3d7', 'd99694', 'c3d69b', 'b2a2c7', 'b7dde8', 'fac08f', 'f2c314', 'a5a5a5', '262626', '494429', '17365d', '366092', '953734', '76923c', '5f497a', '92cddc', 'e36c09', 'c09100', '7f7f7f', '0c0c0c', '1d1b10', '0f243e', '244061', '632423', '4f6128', '3f3151', '31859b', '974806', '7f6000']
};
// Default Options for font-size
var fontSizedefaultOptions = {
sizeList: ['x-small', 'small', 'medium', 'large', 'x-large'],
allowCustomSize: true
};
// Default Options for line height
var lineHeightOptions = {
sizeList: ['0.9', '1', '1.5', '2.0', '2.5','3.0', '3.5', '4.0', '4.5', '5.0'],
allowCustomSize: true
};
// If WP media is a button
function openwpmediaDef(trumbowyg) {
return {
fn: function() {
// WP media button logic
var func_media = window['pagelayer_select_frame'];
if(typeof func_media == 'function'){
// Load the frame
var frame = pagelayer_select_frame('image');
// On select update the stuff
frame.on({'select': function(){
var state = frame.state();
var url = '', alt = '', id = '';
// External URL
if('props' in state){
url = state.props.attributes.url;
alt = state.props.attributes.alt;
// Internal from gallery
}else{
var attachment = frame.state().get('selection').first().toJSON();
//console.log(attachment);
// Set the new and URL
url = attachment.url;
alt = attachment.alt;
id = attachment.id;
}
trumbowyg.execCmd('insertImage', url, false, true);
var $img = $('img[src="' + url + '"]:not([alt])', trumbowyg.$box);
$img.attr('alt', alt);
$img.attr('pl-media-id', id);
trumbowyg.syncCode;
trumbowyg.$c.trigger('tbwchange');
return true;
}
});
frame.open();
}
},
ico: 'insert-image'
}
}
$.extend(true, $.trumbowyg, {
// Add some translations
langs: {
en: {
wpmedia: 'Insert Image',
foreColor: 'Text color',
backColor: 'Background color',
fontsize: 'Font size',
fontsizes: {
'x-small': 'Extra small',
'small': 'Small',
'medium': 'Regular',
'large': 'Large',
'x-large': 'Extra large',
'custom': 'Custom'
},
fontCustomSize: {
title: 'Custom Font Size',
label: 'Font Size',
value: '48px'
},
lineheight: 'Line Height',
lineCustomHeight: {
title: 'Custom Line Height',
label: 'Line Height',
value: '7.0'
},
lineheights: {
'normal': 'Normal',
'custom': 'Custom',
}
},
},
// Add our plugin to Trumbowyg registred plugins
plugins: {
wpmedia: {
init: function(trumbowyg) {
var t = $(this);
// Fill current Trumbowyg instance with WP media default options
trumbowyg.o.plugins.wpmedia = $.extend(true, {},
defaultOptions,
trumbowyg.o.plugins.wpmedia || {}
);
// If WP media is a
trumbowyg.addBtnDef('wpmedia', openwpmediaDef(trumbowyg));
},
},
color: {
init: function (trumbowyg) {
trumbowyg.o.plugins.colors = trumbowyg.o.plugins.colors || defaultOptions;
var foreColorBtnDef = {
dropdown: buildDropdown('foreColor', trumbowyg)
},
backColorBtnDef = {
dropdown: buildDropdown('backColor', trumbowyg)
};
trumbowyg.addBtnDef('foreColor', foreColorBtnDef);
trumbowyg.addBtnDef('backColor', backColorBtnDef);
},
tagHandler: colorTagHandler
},
pasteImage: {
init: function (trumbowyg) {
trumbowyg.pasteHandlers.push(function (pasteEvent) {
var pagelayer_ajax_func = {};
// This function for ajax success call back
pagelayer_ajax_func['success'] = function(obj){
//alert(obj);
if(obj['success']){
trumbowyg.execCmd('insertImage', obj['data']['url'], false, true);
}else{
alert(obj['data']['message']);
}
}
// This function for ajax before send call back
pagelayer_ajax_func['beforeSend'] = function(xhr){
trumbowyg.showOverlay();
}
// This function for ajax complete call back
pagelayer_ajax_func['complete'] = function(xhr){
trumbowyg.hideOverlay();
}
pagelayer_editable_paste_handler(pasteEvent, pagelayer_ajax_func);
});
}
},
fontsize: {
init: function (trumbowyg) {
trumbowyg.o.plugins.fontsize = $.extend({},
fontSizedefaultOptions,
trumbowyg.o.plugins.fontsize || {}
);
trumbowyg.addBtnDef('fontsize', {
dropdown: fontSizeBuildDropdown(trumbowyg)
});
}
},
lineheight: {
init: function (trumbowyg) {
trumbowyg.o.plugins.lineheight = $.extend({},
lineHeightOptions,
trumbowyg.o.plugins.lineheight || {}
);
trumbowyg.addBtnDef('lineheight', {
dropdown: lineHeightDropdown(trumbowyg)
});
}
}
}
});
function buildDropdown(fn, trumbowyg) {
var dropdown = [];
$.each(trumbowyg.o.plugins.colors.colorList, function (i, color) {
var btn = fn + color,
btnDef = {
fn: fn,
forceCss: true,
param: '#' + color,
style: 'background-color: #' + color + ';'
};
trumbowyg.addBtnDef(btn, btnDef);
dropdown.push(btn);
});
var removeColorButtonName = fn + 'Remove',
removeColorBtnDef = {
fn: 'removeFormat',
param: fn,
style: 'background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAG0lEQVQIW2NkQAAfEJMRmwBYhoGBYQtMBYoAADziAp0jtJTgAAAAAElFTkSuQmCC);'
};
trumbowyg.addBtnDef(removeColorButtonName, removeColorBtnDef);
dropdown.push(removeColorButtonName);
// add free color btn
var freeColorButtonName = fn + 'Free',
freeColorBtnDef = {
fn: function () {
trumbowyg.openModalInsert(trumbowyg.lang[fn],
{
color: {
label: fn,
forceCss: true,
type: 'color',
value: '#FFFFFF'
}
},
// callback
function (values) {
trumbowyg.execCmd(fn, values.color);
return true;
}
);
},
text: '#',
// style adjust for displaying the text
style: 'text-indent: 0;line-height: 20px;padding: 0 5px;'
};
trumbowyg.addBtnDef(freeColorButtonName, freeColorBtnDef);
dropdown.push(freeColorButtonName);
return dropdown;
}
// Functions for font-size widget
function setFontSize(trumbowyg, size) {
trumbowyg.$ed.focus();
trumbowyg.saveRange();
var text = trumbowyg.range.startContainer.parentElement;
var selectedText = trumbowyg.getRangeText();
if ($(text).html() === selectedText) {
$(text).css('font-size', size);
} else {
trumbowyg.range.deleteContents();
var html = '<span style="font-size: ' + size + ';">' + selectedText + '</span>';
var node = $(html)[0];
trumbowyg.range.insertNode(node);
}
}
function fontSizeBuildDropdown(trumbowyg) {
var dropdown = [];
$.each(trumbowyg.o.plugins.fontsize.sizeList, function (index, size) {
trumbowyg.addBtnDef('fontsize_' + size, {
text: '<span style="font-size: ' + size + ';">' + (trumbowyg.lang.fontsizes[size] || size) + '</span>',
hasIcon: false,
fn: function () {
setFontSize(trumbowyg, size);
trumbowyg.syncCode();
trumbowyg.$c.trigger('tbwchange');
}
});
dropdown.push('fontsize_' + size);
});
if (trumbowyg.o.plugins.fontsize.allowCustomSize) {
var customSizeButtonName = 'fontsize_custom';
var customSizeBtnDef = {
fn: function () {
trumbowyg.openModalInsert(trumbowyg.lang.fontCustomSize.title,
{
size: {
label: trumbowyg.lang.fontCustomSize.label,
value: trumbowyg.lang.fontCustomSize.value
}
},
function (form) {
setFontSize(trumbowyg, form.size);
return true;
}
);
},
text: '<span style="font-size: medium;">' + trumbowyg.lang.fontsizes.custom + '</span>',
hasIcon: false
};
trumbowyg.addBtnDef(customSizeButtonName, customSizeBtnDef);
dropdown.push(customSizeButtonName);
}
return dropdown;
}
// Build the dropdown for line-height
function lineHeightDropdown(trumbowyg) {
var dropdown = [];
$.each(trumbowyg.o.plugins.lineheight.sizeList, function(index, size) {
trumbowyg.addBtnDef('lineheight_' + size, {
text: trumbowyg.lang.lineheights[size] || size,
hasIcon: false,
fn: function(){
setLineHight(trumbowyg, size);
}
});
dropdown.push('lineheight_' + size);
});
if (trumbowyg.o.plugins.lineheight.allowCustomSize) {
var customSizeButtonName = 'lineheight_custom';
var customSizeBtnDef = {
fn: function () {
trumbowyg.openModalInsert(trumbowyg.lang.lineCustomHeight.title,
{
size: {
label: trumbowyg.lang.lineCustomHeight.label,
value: trumbowyg.lang.lineCustomHeight.value
}
},
function (form) {
setLineHight(trumbowyg, form.size);
return true;
}
);
},
text: '<span style="font-size: medium;">' + trumbowyg.lang.lineheights.custom + '</span>',
hasIcon: false
};
trumbowyg.addBtnDef(customSizeButtonName, customSizeBtnDef);
dropdown.push(customSizeButtonName);
}
return dropdown;
}
// Set line-height
function setLineHight(trumbowyg, size) {
trumbowyg.$ed.focus();
trumbowyg.saveRange();
var parent = trumbowyg.range.startContainer.parentElement;
var text = trumbowyg.getRangeText();
if ($(parent).html() === text) {
$(parent).css('line-height', size);
} else {
trumbowyg.range.deleteContents();
var html = '<span style="line-height: ' + size + ';">' + text + '</span>';
var node = $(html)[0];
trumbowyg.range.insertNode(node);
}
trumbowyg.syncCode();
trumbowyg.$c.trigger('tbwchange');
}
})(jQuery);
(function ($) {
'use strict';
// jshint camelcase:true
function hex(x) {
return ('0' + parseInt(x).toString(16)).slice(-2);
}
function colorToHex(rgb) {
if (rgb.search('rgb') === -1) {
return rgb.replace('#', '');
} else if (rgb === 'rgba(0, 0, 0, 0)') {
return 'transparent';
} else {
rgb = rgb.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+))?\)$/);
return hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
}
}
function colorTagHandler(element, trumbowyg) {
var tags = [];
if (!element.style) {
return tags;
}
// background color
if (element.style.backgroundColor !== '') {
var backColor = colorToHex(element.style.backgroundColor);
if (trumbowyg.o.plugins.colors.colorList.indexOf(backColor) >= 0) {
tags.push('backColor' + backColor);
} else {
tags.push('backColorFree');
}
}
// text color
var foreColor;
if (element.style.color !== '') {
foreColor = colorToHex(element.style.color);
} else if (element.hasAttribute('color')) {
foreColor = colorToHex(element.getAttribute('color'));
}
if (foreColor) {
if (trumbowyg.o.plugins.colors.colorList.indexOf(foreColor) >= 0) {
tags.push('foreColor' + foreColor);
} else {
tags.push('foreColorFree');
}
}
return tags;
}
var defaultOptions = {
colorList: ['ffffff', '000000', 'eeece1', '1f497d', '4f81bd', 'c0504d', '9bbb59', '8064a2', '4bacc6', 'f79646', 'ffff00', 'f2f2f2', '7f7f7f', 'ddd9c3', 'c6d9f0', 'dbe5f1', 'f2dcdb', 'ebf1dd', 'e5e0ec', 'dbeef3', 'fdeada', 'fff2ca', 'd8d8d8', '595959', 'c4bd97', '8db3e2', 'b8cce4', 'e5b9b7', 'd7e3bc', 'ccc1d9', 'b7dde8', 'fbd5b5', 'ffe694', 'bfbfbf', '3f3f3f', '938953', '548dd4', '95b3d7', 'd99694', 'c3d69b', 'b2a2c7', 'b7dde8', 'fac08f', 'f2c314', 'a5a5a5', '262626', '494429', '17365d', '366092', '953734', '76923c', '5f497a', '92cddc', 'e36c09', 'c09100', '7f7f7f', '0c0c0c', '1d1b10', '0f243e', '244061', '632423', '4f6128', '3f3151', '31859b', '974806', '7f6000']
};
// Default Options for font-size
var fontSizedefaultOptions = {
sizeList: ['x-small', 'small', 'medium', 'large', 'x-large'],
allowCustomSize: true
};
// Default Options for line height
var lineHeightOptions = {
sizeList: ['0.9', '1', '1.5', '2.0', '2.5','3.0', '3.5', '4.0', '4.5', '5.0'],
allowCustomSize: true
};
// If WP media is a button
function openwpmediaDef(trumbowyg) {
return {
fn: function() {
// WP media button logic
var func_media = window['pagelayer_select_frame'];
if(typeof func_media == 'function'){
// Load the frame
var frame = pagelayer_select_frame('image');
// On select update the stuff
frame.on({'select': function(){
var state = frame.state();
var url = '', alt = '', id = '';
// External URL
if('props' in state){
url = state.props.attributes.url;
alt = state.props.attributes.alt;
// Internal from gallery
}else{
var attachment = frame.state().get('selection').first().toJSON();
//console.log(attachment);
// Set the new and URL
url = attachment.url;
alt = attachment.alt;
id = attachment.id;
}
trumbowyg.execCmd('insertImage', url, false, true);
var $img = $('img[src="' + url + '"]:not([alt])', trumbowyg.$box);
$img.attr('alt', alt);
$img.attr('pl-media-id', id);
trumbowyg.syncCode;
trumbowyg.$c.trigger('tbwchange');
return true;
}
});
frame.open();
}
},
ico: 'insert-image'
}
}
$.extend(true, $.trumbowyg, {
// Add some translations
langs: {
en: {
wpmedia: 'Insert Image',
foreColor: 'Text color',
backColor: 'Background color',
fontsize: 'Font size',
fontsizes: {
'x-small': 'Extra small',
'small': 'Small',
'medium': 'Regular',
'large': 'Large',
'x-large': 'Extra large',
'custom': 'Custom'
},
fontCustomSize: {
title: 'Custom Font Size',
label: 'Font Size',
value: '48px'
},
lineheight: 'Line Height',
lineCustomHeight: {
title: 'Custom Line Height',
label: 'Line Height',
value: '7.0'
},
lineheights: {
'normal': 'Normal',
'custom': 'Custom',
}
},
},
// Add our plugin to Trumbowyg registred plugins
plugins: {
wpmedia: {
init: function(trumbowyg) {
var t = $(this);
// Fill current Trumbowyg instance with WP media default options
trumbowyg.o.plugins.wpmedia = $.extend(true, {},
defaultOptions,
trumbowyg.o.plugins.wpmedia || {}
);
// If WP media is a
trumbowyg.addBtnDef('wpmedia', openwpmediaDef(trumbowyg));
},
},
color: {
init: function (trumbowyg) {
trumbowyg.o.plugins.colors = trumbowyg.o.plugins.colors || defaultOptions;
var foreColorBtnDef = {
dropdown: buildDropdown('foreColor', trumbowyg)
},
backColorBtnDef = {
dropdown: buildDropdown('backColor', trumbowyg)
};
trumbowyg.addBtnDef('foreColor', foreColorBtnDef);
trumbowyg.addBtnDef('backColor', backColorBtnDef);
},
tagHandler: colorTagHandler
},
pasteImage: {
init: function (trumbowyg) {
trumbowyg.pasteHandlers.push(function (pasteEvent) {
var pagelayer_ajax_func = {};
// This function for ajax success call back
pagelayer_ajax_func['success'] = function(obj){
//alert(obj);
if(obj['success']){
trumbowyg.execCmd('insertImage', obj['data']['url'], false, true);
}else{
alert(obj['data']['message']);
}
}
// This function for ajax before send call back
pagelayer_ajax_func['beforeSend'] = function(xhr){
trumbowyg.showOverlay();
}
// This function for ajax complete call back
pagelayer_ajax_func['complete'] = function(xhr){
trumbowyg.hideOverlay();
}
pagelayer_editable_paste_handler(pasteEvent, pagelayer_ajax_func);
});
}
},
fontsize: {
init: function (trumbowyg) {
trumbowyg.o.plugins.fontsize = $.extend({},
fontSizedefaultOptions,
trumbowyg.o.plugins.fontsize || {}
);
trumbowyg.addBtnDef('fontsize', {
dropdown: fontSizeBuildDropdown(trumbowyg)
});
}
},
lineheight: {
init: function (trumbowyg) {
trumbowyg.o.plugins.lineheight = $.extend({},
lineHeightOptions,
trumbowyg.o.plugins.lineheight || {}
);
trumbowyg.addBtnDef('lineheight', {
dropdown: lineHeightDropdown(trumbowyg)
});
}
}
}
});
function buildDropdown(fn, trumbowyg) {
var dropdown = [];
$.each(trumbowyg.o.plugins.colors.colorList, function (i, color) {
var btn = fn + color,
btnDef = {
fn: fn,
forceCss: true,
param: '#' + color,
style: 'background-color: #' + color + ';'
};
trumbowyg.addBtnDef(btn, btnDef);
dropdown.push(btn);
});
var removeColorButtonName = fn + 'Remove',
removeColorBtnDef = {
fn: 'removeFormat',
param: fn,
style: 'background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAG0lEQVQIW2NkQAAfEJMRmwBYhoGBYQtMBYoAADziAp0jtJTgAAAAAElFTkSuQmCC);'
};
trumbowyg.addBtnDef(removeColorButtonName, removeColorBtnDef);
dropdown.push(removeColorButtonName);
// add free color btn
var freeColorButtonName = fn + 'Free',
freeColorBtnDef = {
fn: function () {
trumbowyg.openModalInsert(trumbowyg.lang[fn],
{
color: {
label: fn,
forceCss: true,
type: 'color',
value: '#FFFFFF'
}
},
// callback
function (values) {
trumbowyg.execCmd(fn, values.color);
return true;
}
);
},
text: '#',
// style adjust for displaying the text
style: 'text-indent: 0;line-height: 20px;padding: 0 5px;'
};
trumbowyg.addBtnDef(freeColorButtonName, freeColorBtnDef);
dropdown.push(freeColorButtonName);
return dropdown;
}
// Functions for font-size widget
function setFontSize(trumbowyg, size) {
trumbowyg.$ed.focus();
trumbowyg.saveRange();
var text = trumbowyg.range.startContainer.parentElement;
var selectedText = trumbowyg.getRangeText();
if ($(text).html() === selectedText) {
$(text).css('font-size', size);
} else {
trumbowyg.range.deleteContents();
var html = '<span style="font-size: ' + size + ';">' + selectedText + '</span>';
var node = $(html)[0];
trumbowyg.range.insertNode(node);
}
}
function fontSizeBuildDropdown(trumbowyg) {
var dropdown = [];
$.each(trumbowyg.o.plugins.fontsize.sizeList, function (index, size) {
trumbowyg.addBtnDef('fontsize_' + size, {
text: '<span style="font-size: ' + size + ';">' + (trumbowyg.lang.fontsizes[size] || size) + '</span>',
hasIcon: false,
fn: function () {
setFontSize(trumbowyg, size);
trumbowyg.syncCode();
trumbowyg.$c.trigger('tbwchange');
}
});
dropdown.push('fontsize_' + size);
});
if (trumbowyg.o.plugins.fontsize.allowCustomSize) {
var customSizeButtonName = 'fontsize_custom';
var customSizeBtnDef = {
fn: function () {
trumbowyg.openModalInsert(trumbowyg.lang.fontCustomSize.title,
{
size: {
label: trumbowyg.lang.fontCustomSize.label,
value: trumbowyg.lang.fontCustomSize.value
}
},
function (form) {
setFontSize(trumbowyg, form.size);
return true;
}
);
},
text: '<span style="font-size: medium;">' + trumbowyg.lang.fontsizes.custom + '</span>',
hasIcon: false
};
trumbowyg.addBtnDef(customSizeButtonName, customSizeBtnDef);
dropdown.push(customSizeButtonName);
}
return dropdown;
}
// Build the dropdown for line-height
function lineHeightDropdown(trumbowyg) {
var dropdown = [];
$.each(trumbowyg.o.plugins.lineheight.sizeList, function(index, size) {
trumbowyg.addBtnDef('lineheight_' + size, {
text: trumbowyg.lang.lineheights[size] || size,
hasIcon: false,
fn: function(){
setLineHight(trumbowyg, size);
}
});
dropdown.push('lineheight_' + size);
});
if (trumbowyg.o.plugins.lineheight.allowCustomSize) {
var customSizeButtonName = 'lineheight_custom';
var customSizeBtnDef = {
fn: function () {
trumbowyg.openModalInsert(trumbowyg.lang.lineCustomHeight.title,
{
size: {
label: trumbowyg.lang.lineCustomHeight.label,
value: trumbowyg.lang.lineCustomHeight.value
}
},
function (form) {
setLineHight(trumbowyg, form.size);
return true;
}
);
},
text: '<span style="font-size: medium;">' + trumbowyg.lang.lineheights.custom + '</span>',
hasIcon: false
};
trumbowyg.addBtnDef(customSizeButtonName, customSizeBtnDef);
dropdown.push(customSizeButtonName);
}
return dropdown;
}
// Set line-height
function setLineHight(trumbowyg, size) {
trumbowyg.$ed.focus();
trumbowyg.saveRange();
var parent = trumbowyg.range.startContainer.parentElement;
var text = trumbowyg.getRangeText();
if ($(parent).html() === text) {
$(parent).css('line-height', size);
} else {
trumbowyg.range.deleteContents();
var html = '<span style="line-height: ' + size + ';">' + text + '</span>';
var node = $(html)[0];
trumbowyg.range.insertNode(node);
}
trumbowyg.syncCode();
trumbowyg.$c.trigger('tbwchange');
}
})(jQuery);
@@ -1,85 +1,85 @@
(function ($) {
'use strict';
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
fontFamily: 'Font'
},
da: {
fontFamily: 'Skrifttype'
},
fr: {
fontFamily: 'Police'
},
de: {
fontFamily: 'Schriftart'
},
nl: {
fontFamily: 'Lettertype'
},
tr: {
fontFamily: 'Yazı Tipi'
},
zh_tw: {
fontFamily: '字體',
},
pt_br: {
fontFamily: 'Fonte',
}
}
});
// jshint camelcase:true
var defaultOptions = {
fontList: [
{name: 'Arial', family: 'Arial, Helvetica, sans-serif'},
{name: 'Arial Black', family: '\'Arial Black\', Gadget, sans-serif'},
{name: 'Comic Sans', family: '\'Comic Sans MS\', Textile, cursive, sans-serif'},
{name: 'Courier New', family: '\'Courier New\', Courier, monospace'},
{name: 'Georgia', family: 'Georgia, serif'},
{name: 'Impact', family: 'Impact, Charcoal, sans-serif'},
{name: 'Lucida Console', family: '\'Lucida Console\', Monaco, monospace'},
{name: 'Lucida Sans', family: '\'Lucida Sans Uncide\', \'Lucida Grande\', sans-serif'},
{name: 'Palatino', family: '\'Palatino Linotype\', \'Book Antiqua\', Palatino, serif'},
{name: 'Tahoma', family: 'Tahoma, Geneva, sans-serif'},
{name: 'Times New Roman', family: '\'Times New Roman\', Times, serif'},
{name: 'Trebuchet', family: '\'Trebuchet MS\', Helvetica, sans-serif'},
{name: 'Verdana', family: 'Verdana, Geneva, sans-serif'}
]
};
// Add dropdown with web safe fonts
$.extend(true, $.trumbowyg, {
plugins: {
fontfamily: {
init: function (trumbowyg) {
trumbowyg.o.plugins.fontfamily = trumbowyg.o.plugins.fontfamily || defaultOptions;
trumbowyg.addBtnDef('fontfamily', {
dropdown: buildDropdown(trumbowyg),
hasIcon: false,
text: trumbowyg.lang.fontFamily
});
}
}
}
});
function buildDropdown(trumbowyg) {
var dropdown = [];
$.each(trumbowyg.o.plugins.fontfamily.fontList, function (index, font) {
trumbowyg.addBtnDef('fontfamily_' + index, {
title: '<span style="font-family: ' + font.family + ';">' + font.name + '</span>',
hasIcon: false,
fn: function () {
trumbowyg.execCmd('fontName', font.family, true);
}
});
dropdown.push('fontfamily_' + index);
});
return dropdown;
}
})(jQuery);
(function ($) {
'use strict';
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
fontFamily: 'Font'
},
da: {
fontFamily: 'Skrifttype'
},
fr: {
fontFamily: 'Police'
},
de: {
fontFamily: 'Schriftart'
},
nl: {
fontFamily: 'Lettertype'
},
tr: {
fontFamily: 'Yazı Tipi'
},
zh_tw: {
fontFamily: '字體',
},
pt_br: {
fontFamily: 'Fonte',
}
}
});
// jshint camelcase:true
var defaultOptions = {
fontList: [
{name: 'Arial', family: 'Arial, Helvetica, sans-serif'},
{name: 'Arial Black', family: '\'Arial Black\', Gadget, sans-serif'},
{name: 'Comic Sans', family: '\'Comic Sans MS\', Textile, cursive, sans-serif'},
{name: 'Courier New', family: '\'Courier New\', Courier, monospace'},
{name: 'Georgia', family: 'Georgia, serif'},
{name: 'Impact', family: 'Impact, Charcoal, sans-serif'},
{name: 'Lucida Console', family: '\'Lucida Console\', Monaco, monospace'},
{name: 'Lucida Sans', family: '\'Lucida Sans Uncide\', \'Lucida Grande\', sans-serif'},
{name: 'Palatino', family: '\'Palatino Linotype\', \'Book Antiqua\', Palatino, serif'},
{name: 'Tahoma', family: 'Tahoma, Geneva, sans-serif'},
{name: 'Times New Roman', family: '\'Times New Roman\', Times, serif'},
{name: 'Trebuchet', family: '\'Trebuchet MS\', Helvetica, sans-serif'},
{name: 'Verdana', family: 'Verdana, Geneva, sans-serif'}
]
};
// Add dropdown with web safe fonts
$.extend(true, $.trumbowyg, {
plugins: {
fontfamily: {
init: function (trumbowyg) {
trumbowyg.o.plugins.fontfamily = trumbowyg.o.plugins.fontfamily || defaultOptions;
trumbowyg.addBtnDef('fontfamily', {
dropdown: buildDropdown(trumbowyg),
hasIcon: false,
text: trumbowyg.lang.fontFamily
});
}
}
}
});
function buildDropdown(trumbowyg) {
var dropdown = [];
$.each(trumbowyg.o.plugins.fontfamily.fontList, function (index, font) {
trumbowyg.addBtnDef('fontfamily_' + index, {
title: '<span style="font-family: ' + font.family + ';">' + font.name + '</span>',
hasIcon: false,
fn: function () {
trumbowyg.execCmd('fontName', font.family, true);
}
});
dropdown.push('fontfamily_' + index);
});
return dropdown;
}
})(jQuery);
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long