Created
May 1, 2014 14:18
-
-
Save adjohu/5c7ab7a009f371682c8b to your computer and use it in GitHub Desktop.
terrible code example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2013 Host Europe Group - All rights reserved. | |
// The 123-reg mobile site | |
if (!Object.keys) { | |
Object.keys = (function () { | |
'use strict'; | |
var hasOwnProperty = Object.prototype.hasOwnProperty, | |
hasDontEnumBug = !({ | |
toString: null | |
}).propertyIsEnumerable('toString'), | |
dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'], | |
dontEnumsLength = dontEnums.length; | |
return function (obj) { | |
if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) { | |
throw new TypeError('Object.keys called on non-object'); | |
} | |
var result = [], | |
prop, i; | |
for (prop in obj) { | |
if (hasOwnProperty.call(obj, prop)) { | |
result.push(prop); | |
} | |
} | |
if (hasDontEnumBug) { | |
for (i = 0; i < dontEnumsLength; i++) { | |
if (hasOwnProperty.call(obj, dontEnums[i])) { | |
result.push(dontEnums[i]); | |
} | |
} | |
} | |
return result; | |
}; | |
}()); | |
} | |
if (!Array.prototype.forEach) { | |
Array.prototype.forEach = function forEach(callback, thisArg) { | |
var T, k; | |
if (this == null) { | |
throw new TypeError("this is null or not defined"); | |
} | |
var O = Object(this); | |
var len = O.length >>> 0; | |
if ({}.toString.call(callback) !== "[object Function]") { | |
throw new TypeError(callback + " is not a function"); | |
} | |
if (thisArg) { | |
T = thisArg; | |
} | |
k = 0; | |
while (k < len) { | |
var kValue; | |
if (Object.prototype.hasOwnProperty.call(O, k)) { | |
kValue = O[k]; | |
callback.call(T, kValue, k, O); | |
} | |
k++; | |
} | |
}; | |
} | |
if (!Array.prototype.indexOf) { | |
Array.prototype.indexOf = function (searchElement) { | |
"use strict"; | |
if (this == null) { | |
throw new TypeError(); | |
} | |
var t = Object(this); | |
var len = t.length >>> 0; | |
if (len === 0) { | |
return -1; | |
} | |
var n = 0; | |
if (arguments.length > 1) { | |
n = Number(arguments[1]); | |
if (n != n) { | |
n = 0; | |
} else if (n != 0 && n != Infinity && n != -Infinity) { | |
n = (n > 0 || -1) * Math.floor(Math.abs(n)); | |
} | |
} | |
if (n >= len) { | |
return -1; | |
} | |
var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); | |
for (; k < len; k++) { | |
if (k in t && t[k] === searchElement) { | |
return k; | |
} | |
} | |
return -1; | |
} | |
} | |
if (!String.prototype.trim) { | |
String.prototype.trim = function () { | |
return this.replace(/^\s+|\s+$/gm, ''); | |
}; | |
} | |
/*! | |
* jQuery JavaScript Library v1.9.1 | |
* http://jquery.com/ | |
* | |
* Includes Sizzle.js | |
* http://sizzlejs.com/ | |
* | |
* Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors | |
* Released under the MIT license | |
* http://jquery.org/license | |
* | |
* Date: 2013-2-4 | |
*/ | |
(function (window, undefined) { | |
var | |
readyList, rootjQuery, core_strundefined = typeof undefined, | |
document = window.document, | |
location = window.location, | |
_jQuery = window.jQuery, | |
_$ = window.$, | |
class2type = {}, | |
core_deletedIds = [], | |
core_version = "1.9.1", | |
core_concat = core_deletedIds.concat, | |
core_push = core_deletedIds.push, | |
core_slice = core_deletedIds.slice, | |
core_indexOf = core_deletedIds.indexOf, | |
core_toString = class2type.toString, | |
core_hasOwn = class2type.hasOwnProperty, | |
core_trim = core_version.trim, | |
jQuery = function (selector, context) { | |
return new jQuery.fn.init(selector, context, rootjQuery); | |
}, | |
core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, | |
core_rnotwhite = /\S+/g, | |
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, | |
rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/, | |
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, | |
rvalidchars = /^[\],:{}\s]*$/, | |
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, | |
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, | |
rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, | |
rmsPrefix = /^-ms-/, | |
rdashAlpha = /-([\da-z])/gi, | |
fcamelCase = function (all, letter) { | |
return letter.toUpperCase(); | |
}, | |
completed = function (event) { | |
if (document.addEventListener || event.type === "load" || document.readyState === "complete") { | |
detach(); | |
jQuery.ready(); | |
} | |
}, | |
detach = function () { | |
if (document.addEventListener) { | |
document.removeEventListener("DOMContentLoaded", completed, false); | |
window.removeEventListener("load", completed, false); | |
} else { | |
document.detachEvent("onreadystatechange", completed); | |
window.detachEvent("onload", completed); | |
} | |
}; | |
jQuery.fn = jQuery.prototype = { | |
jquery: core_version, | |
constructor: jQuery, | |
init: function (selector, context, rootjQuery) { | |
var match, elem; | |
if (!selector) { | |
return this; | |
} | |
if (typeof selector === "string") { | |
if (selector.charAt(0) === "<" && selector.charAt(selector.length - 1) === ">" && selector.length >= 3) { | |
match = [null, selector, null]; | |
} else { | |
match = rquickExpr.exec(selector); | |
} | |
if (match && (match[1] || !context)) { | |
if (match[1]) { | |
context = context instanceof jQuery ? context[0] : context; | |
jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true)); | |
if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) { | |
for (match in context) { | |
if (jQuery.isFunction(this[match])) { | |
this[match](context[match]); | |
} else { | |
this.attr(match, context[match]); | |
} | |
} | |
} | |
return this; | |
} else { | |
elem = document.getElementById(match[2]); | |
if (elem && elem.parentNode) { | |
if (elem.id !== match[2]) { | |
return rootjQuery.find(selector); | |
} | |
this.length = 1; | |
this[0] = elem; | |
} | |
this.context = document; | |
this.selector = selector; | |
return this; | |
} | |
} else if (!context || context.jquery) { | |
return (context || rootjQuery).find(selector); | |
} else { | |
return this.constructor(context).find(selector); | |
} | |
} else if (selector.nodeType) { | |
this.context = this[0] = selector; | |
this.length = 1; | |
return this; | |
} else if (jQuery.isFunction(selector)) { | |
return rootjQuery.ready(selector); | |
} | |
if (selector.selector !== undefined) { | |
this.selector = selector.selector; | |
this.context = selector.context; | |
} | |
return jQuery.makeArray(selector, this); | |
}, | |
selector: "", | |
length: 0, | |
size: function () { | |
return this.length; | |
}, | |
toArray: function () { | |
return core_slice.call(this); | |
}, | |
get: function (num) { | |
return num == null ? this.toArray() : (num < 0 ? this[this.length + num] : this[num]); | |
}, | |
pushStack: function (elems) { | |
var ret = jQuery.merge(this.constructor(), elems); | |
ret.prevObject = this; | |
ret.context = this.context; | |
return ret; | |
}, | |
each: function (callback, args) { | |
return jQuery.each(this, callback, args); | |
}, | |
ready: function (fn) { | |
jQuery.ready.promise().done(fn); | |
return this; | |
}, | |
slice: function () { | |
return this.pushStack(core_slice.apply(this, arguments)); | |
}, | |
first: function () { | |
return this.eq(0); | |
}, | |
last: function () { | |
return this.eq(-1); | |
}, | |
eq: function (i) { | |
var len = this.length, | |
j = +i + (i < 0 ? len : 0); | |
return this.pushStack(j >= 0 && j < len ? [this[j]] : []); | |
}, | |
map: function (callback) { | |
return this.pushStack(jQuery.map(this, function (elem, i) { | |
return callback.call(elem, i, elem); | |
})); | |
}, | |
end: function () { | |
return this.prevObject || this.constructor(null); | |
}, | |
push: core_push, | |
sort: [].sort, | |
splice: [].splice | |
}; | |
jQuery.fn.init.prototype = jQuery.fn; | |
jQuery.extend = jQuery.fn.extend = function () { | |
var src, copyIsArray, copy, name, options, clone, target = arguments[0] || {}, | |
i = 1, | |
length = arguments.length, | |
deep = false; | |
if (typeof target === "boolean") { | |
deep = target; | |
target = arguments[1] || {}; | |
i = 2; | |
} | |
if (typeof target !== "object" && !jQuery.isFunction(target)) { | |
target = {}; | |
} | |
if (length === i) { | |
target = this; | |
--i; | |
} | |
for (; i < length; i++) { | |
if ((options = arguments[i]) != null) { | |
for (name in options) { | |
src = target[name]; | |
copy = options[name]; | |
if (target === copy) { | |
continue; | |
} | |
if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)))) { | |
if (copyIsArray) { | |
copyIsArray = false; | |
clone = src && jQuery.isArray(src) ? src : []; | |
} else { | |
clone = src && jQuery.isPlainObject(src) ? src : {}; | |
} | |
target[name] = jQuery.extend(deep, clone, copy); | |
} else if (copy !== undefined) { | |
target[name] = copy; | |
} | |
} | |
} | |
} | |
return target; | |
}; | |
jQuery.extend({ | |
noConflict: function (deep) { | |
if (window.$ === jQuery) { | |
window.$ = _$; | |
} | |
if (deep && window.jQuery === jQuery) { | |
window.jQuery = _jQuery; | |
} | |
return jQuery; | |
}, | |
isReady: false, | |
readyWait: 1, | |
holdReady: function (hold) { | |
if (hold) { | |
jQuery.readyWait++; | |
} else { | |
jQuery.ready(true); | |
} | |
}, | |
ready: function (wait) { | |
if (wait === true ? --jQuery.readyWait : jQuery.isReady) { | |
return; | |
} | |
if (!document.body) { | |
return setTimeout(jQuery.ready); | |
} | |
jQuery.isReady = true; | |
if (wait !== true && --jQuery.readyWait > 0) { | |
return; | |
} | |
readyList.resolveWith(document, [jQuery]); | |
if (jQuery.fn.trigger) { | |
jQuery(document).trigger("ready").off("ready"); | |
} | |
}, | |
isFunction: function (obj) { | |
return jQuery.type(obj) === "function"; | |
}, | |
isArray: Array.isArray || function (obj) { | |
return jQuery.type(obj) === "array"; | |
}, | |
isWindow: function (obj) { | |
return obj != null && obj == obj.window; | |
}, | |
isNumeric: function (obj) { | |
return !isNaN(parseFloat(obj)) && isFinite(obj); | |
}, | |
type: function (obj) { | |
if (obj == null) { | |
return String(obj); | |
} | |
return typeof obj === "object" || typeof obj === "function" ? class2type[core_toString.call(obj)] || "object" : typeof obj; | |
}, | |
isPlainObject: function (obj) { | |
if (!obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow(obj)) { | |
return false; | |
} | |
try { | |
if (obj.constructor && !core_hasOwn.call(obj, "constructor") && !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) { | |
return false; | |
} | |
} catch (e) { | |
return false; | |
} | |
var key; | |
for (key in obj) {} | |
return key === undefined || core_hasOwn.call(obj, key); | |
}, | |
isEmptyObject: function (obj) { | |
var name; | |
for (name in obj) { | |
return false; | |
} | |
return true; | |
}, | |
error: function (msg) { | |
throw new Error(msg); | |
}, | |
parseHTML: function (data, context, keepScripts) { | |
if (!data || typeof data !== "string") { | |
return null; | |
} | |
if (typeof context === "boolean") { | |
keepScripts = context; | |
context = false; | |
} | |
context = context || document; | |
var parsed = rsingleTag.exec(data), | |
scripts = !keepScripts && []; | |
if (parsed) { | |
return [context.createElement(parsed[1])]; | |
} | |
parsed = jQuery.buildFragment([data], context, scripts); | |
if (scripts) { | |
jQuery(scripts).remove(); | |
} | |
return jQuery.merge([], parsed.childNodes); | |
}, | |
parseJSON: function (data) { | |
if (window.JSON && window.JSON.parse) { | |
return window.JSON.parse(data); | |
} | |
if (data === null) { | |
return data; | |
} | |
if (typeof data === "string") { | |
data = jQuery.trim(data); | |
if (data) { | |
if (rvalidchars.test(data.replace(rvalidescape, "@") | |
.replace(rvalidtokens, "]") | |
.replace(rvalidbraces, ""))) { | |
return (new Function("return " + data))(); | |
} | |
} | |
} | |
jQuery.error("Invalid JSON: " + data); | |
}, | |
parseXML: function (data) { | |
var xml, tmp; | |
if (!data || typeof data !== "string") { | |
return null; | |
} | |
try { | |
if (window.DOMParser) { | |
tmp = new DOMParser(); | |
xml = tmp.parseFromString(data, "text/xml"); | |
} else { | |
xml = new ActiveXObject("Microsoft.XMLDOM"); | |
xml.async = "false"; | |
xml.loadXML(data); | |
} | |
} catch (e) { | |
xml = undefined; | |
} | |
if (!xml || !xml.documentElement || xml.getElementsByTagName("parsererror").length) { | |
jQuery.error("Invalid XML: " + data); | |
} | |
return xml; | |
}, | |
noop: function () {}, | |
globalEval: function (data) { | |
if (data && jQuery.trim(data)) { | |
(window.execScript || function (data) { | |
window["eval"].call(window, data); | |
})(data); | |
} | |
}, | |
camelCase: function (string) { | |
return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase); | |
}, | |
nodeName: function (elem, name) { | |
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); | |
}, | |
each: function (obj, callback, args) { | |
var value, i = 0, | |
length = obj.length, | |
isArray = isArraylike(obj); | |
if (args) { | |
if (isArray) { | |
for (; i < length; i++) { | |
value = callback.apply(obj[i], args); | |
if (value === false) { | |
break; | |
} | |
} | |
} else { | |
for (i in obj) { | |
value = callback.apply(obj[i], args); | |
if (value === false) { | |
break; | |
} | |
} | |
} | |
} else { | |
if (isArray) { | |
for (; i < length; i++) { | |
value = callback.call(obj[i], i, obj[i]); | |
if (value === false) { | |
break; | |
} | |
} | |
} else { | |
for (i in obj) { | |
value = callback.call(obj[i], i, obj[i]); | |
if (value === false) { | |
break; | |
} | |
} | |
} | |
} | |
return obj; | |
}, | |
trim: core_trim && !core_trim.call("\uFEFF\xA0") ? function (text) { | |
return text == null ? "" : core_trim.call(text); | |
} : function (text) { | |
return text == null ? "" : (text + "").replace(rtrim, ""); | |
}, | |
makeArray: function (arr, results) { | |
var ret = results || []; | |
if (arr != null) { | |
if (isArraylike(Object(arr))) { | |
jQuery.merge(ret, typeof arr === "string" ? [arr] : arr); | |
} else { | |
core_push.call(ret, arr); | |
} | |
} | |
return ret; | |
}, | |
inArray: function (elem, arr, i) { | |
var len; | |
if (arr) { | |
if (core_indexOf) { | |
return core_indexOf.call(arr, elem, i); | |
} | |
len = arr.length; | |
i = i ? i < 0 ? Math.max(0, len + i) : i : 0; | |
for (; i < len; i++) { | |
if (i in arr && arr[i] === elem) { | |
return i; | |
} | |
} | |
} | |
return -1; | |
}, | |
merge: function (first, second) { | |
var l = second.length, | |
i = first.length, | |
j = 0; | |
if (typeof l === "number") { | |
for (; j < l; j++) { | |
first[i++] = second[j]; | |
} | |
} else { | |
while (second[j] !== undefined) { | |
first[i++] = second[j++]; | |
} | |
} | |
first.length = i; | |
return first; | |
}, | |
grep: function (elems, callback, inv) { | |
var retVal, ret = [], | |
i = 0, | |
length = elems.length; | |
inv = !!inv; | |
for (; i < length; i++) { | |
retVal = !!callback(elems[i], i); | |
if (inv !== retVal) { | |
ret.push(elems[i]); | |
} | |
} | |
return ret; | |
}, | |
map: function (elems, callback, arg) { | |
var value, i = 0, | |
length = elems.length, | |
isArray = isArraylike(elems), | |
ret = []; | |
if (isArray) { | |
for (; i < length; i++) { | |
value = callback(elems[i], i, arg); | |
if (value != null) { | |
ret[ret.length] = value; | |
} | |
} | |
} else { | |
for (i in elems) { | |
value = callback(elems[i], i, arg); | |
if (value != null) { | |
ret[ret.length] = value; | |
} | |
} | |
} | |
return core_concat.apply([], ret); | |
}, | |
guid: 1, | |
proxy: function (fn, context) { | |
var args, proxy, tmp; | |
if (typeof context === "string") { | |
tmp = fn[context]; | |
context = fn; | |
fn = tmp; | |
} | |
if (!jQuery.isFunction(fn)) { | |
return undefined; | |
} | |
args = core_slice.call(arguments, 2); | |
proxy = function () { | |
return fn.apply(context || this, args.concat(core_slice.call(arguments))); | |
}; | |
proxy.guid = fn.guid = fn.guid || jQuery.guid++; | |
return proxy; | |
}, | |
access: function (elems, fn, key, value, chainable, emptyGet, raw) { | |
var i = 0, | |
length = elems.length, | |
bulk = key == null; | |
if (jQuery.type(key) === "object") { | |
chainable = true; | |
for (i in key) { | |
jQuery.access(elems, fn, i, key[i], true, emptyGet, raw); | |
} | |
} else if (value !== undefined) { | |
chainable = true; | |
if (!jQuery.isFunction(value)) { | |
raw = true; | |
} | |
if (bulk) { | |
if (raw) { | |
fn.call(elems, value); | |
fn = null; | |
} else { | |
bulk = fn; | |
fn = function (elem, key, value) { | |
return bulk.call(jQuery(elem), value); | |
}; | |
} | |
} | |
if (fn) { | |
for (; i < length; i++) { | |
fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key))); | |
} | |
} | |
} | |
return chainable ? elems : bulk ? fn.call(elems) : length ? fn(elems[0], key) : emptyGet; | |
}, | |
now: function () { | |
return (new Date()).getTime(); | |
} | |
}); | |
jQuery.ready.promise = function (obj) { | |
if (!readyList) { | |
readyList = jQuery.Deferred(); | |
if (document.readyState === "complete") { | |
setTimeout(jQuery.ready); | |
} else if (document.addEventListener) { | |
document.addEventListener("DOMContentLoaded", completed, false); | |
window.addEventListener("load", completed, false); | |
} else { | |
document.attachEvent("onreadystatechange", completed); | |
window.attachEvent("onload", completed); | |
var top = false; | |
try { | |
top = window.frameElement == null && document.documentElement; | |
} catch (e) {} | |
if (top && top.doScroll) { | |
(function doScrollCheck() { | |
if (!jQuery.isReady) { | |
try { | |
top.doScroll("left"); | |
} catch (e) { | |
return setTimeout(doScrollCheck, 50); | |
} | |
detach(); | |
jQuery.ready(); | |
} | |
})(); | |
} | |
} | |
} | |
return readyList.promise(obj); | |
}; | |
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function (i, name) { | |
class2type["[object " + name + "]"] = name.toLowerCase(); | |
}); | |
function isArraylike(obj) { | |
var length = obj.length, | |
type = jQuery.type(obj); | |
if (jQuery.isWindow(obj)) { | |
return false; | |
} | |
if (obj.nodeType === 1 && length) { | |
return true; | |
} | |
return type === "array" || type !== "function" && (length === 0 || typeof length === "number" && length > 0 && (length - 1) in obj); | |
} | |
rootjQuery = jQuery(document); | |
var optionsCache = {}; | |
function createOptions(options) { | |
var object = optionsCache[options] = {}; | |
jQuery.each(options.match(core_rnotwhite) || [], function (_, flag) { | |
object[flag] = true; | |
}); | |
return object; | |
} | |
jQuery.Callbacks = function (options) { | |
options = typeof options === "string" ? (optionsCache[options] || createOptions(options)) : jQuery.extend({}, options); | |
var | |
firing, memory, fired, firingLength, firingIndex, firingStart, list = [], | |
stack = !options.once && [], | |
fire = function (data) { | |
memory = options.memory && data; | |
fired = true; | |
firingIndex = firingStart || 0; | |
firingStart = 0; | |
firingLength = list.length; | |
firing = true; | |
for (; list && firingIndex < firingLength; firingIndex++) { | |
if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) { | |
memory = false; | |
break; | |
} | |
} | |
firing = false; | |
if (list) { | |
if (stack) { | |
if (stack.length) { | |
fire(stack.shift()); | |
} | |
} else if (memory) { | |
list = []; | |
} else { | |
self.disable(); | |
} | |
} | |
}, | |
self = { | |
add: function () { | |
if (list) { | |
var start = list.length; | |
(function add(args) { | |
jQuery.each(args, function (_, arg) { | |
var type = jQuery.type(arg); | |
if (type === "function") { | |
if (!options.unique || !self.has(arg)) { | |
list.push(arg); | |
} | |
} else if (arg && arg.length && type !== "string") { | |
add(arg); | |
} | |
}); | |
})(arguments); | |
if (firing) { | |
firingLength = list.length; | |
} else if (memory) { | |
firingStart = start; | |
fire(memory); | |
} | |
} | |
return this; | |
}, | |
remove: function () { | |
if (list) { | |
jQuery.each(arguments, function (_, arg) { | |
var index; | |
while ((index = jQuery.inArray(arg, list, index)) > -1) { | |
list.splice(index, 1); | |
if (firing) { | |
if (index <= firingLength) { | |
firingLength--; | |
} | |
if (index <= firingIndex) { | |
firingIndex--; | |
} | |
} | |
} | |
}); | |
} | |
return this; | |
}, | |
has: function (fn) { | |
return fn ? jQuery.inArray(fn, list) > -1 : !!(list && list.length); | |
}, | |
empty: function () { | |
list = []; | |
return this; | |
}, | |
disable: function () { | |
list = stack = memory = undefined; | |
return this; | |
}, | |
disabled: function () { | |
return !list; | |
}, | |
lock: function () { | |
stack = undefined; | |
if (!memory) { | |
self.disable(); | |
} | |
return this; | |
}, | |
locked: function () { | |
return !stack; | |
}, | |
fireWith: function (context, args) { | |
args = args || []; | |
args = [context, args.slice ? args.slice() : args]; | |
if (list && (!fired || stack)) { | |
if (firing) { | |
stack.push(args); | |
} else { | |
fire(args); | |
} | |
} | |
return this; | |
}, | |
fire: function () { | |
self.fireWith(this, arguments); | |
return this; | |
}, | |
fired: function () { | |
return !!fired; | |
} | |
}; | |
return self; | |
}; | |
jQuery.extend({ | |
Deferred: function (func) { | |
var tuples = [ | |
["resolve", "done", jQuery.Callbacks("once memory"), "resolved"], | |
["reject", "fail", jQuery.Callbacks("once memory"), "rejected"], | |
["notify", "progress", jQuery.Callbacks("memory")] | |
], | |
state = "pending", | |
promise = { | |
state: function () { | |
return state; | |
}, | |
always: function () { | |
deferred.done(arguments).fail(arguments); | |
return this; | |
}, | |
then: function () { | |
var fns = arguments; | |
return jQuery.Deferred(function (newDefer) { | |
jQuery.each(tuples, function (i, tuple) { | |
var action = tuple[0], | |
fn = jQuery.isFunction(fns[i]) && fns[i]; | |
deferred[tuple[1]](function () { | |
var returned = fn && fn.apply(this, arguments); | |
if (returned && jQuery.isFunction(returned.promise)) { | |
returned.promise() | |
.done(newDefer.resolve) | |
.fail(newDefer.reject) | |
.progress(newDefer.notify); | |
} else { | |
newDefer[action + "With"](this === promise ? newDefer.promise() : this, fn ? [returned] : arguments); | |
} | |
}); | |
}); | |
fns = null; | |
}).promise(); | |
}, | |
promise: function (obj) { | |
return obj != null ? jQuery.extend(obj, promise) : promise; | |
} | |
}, | |
deferred = {}; | |
promise.pipe = promise.then; | |
jQuery.each(tuples, function (i, tuple) { | |
var list = tuple[2], | |
stateString = tuple[3]; | |
promise[tuple[1]] = list.add; | |
if (stateString) { | |
list.add(function () { | |
state = stateString; | |
}, tuples[i ^ 1][2].disable, tuples[2][2].lock); | |
} | |
deferred[tuple[0]] = function () { | |
deferred[tuple[0] + "With"](this === deferred ? promise : this, arguments); | |
return this; | |
}; | |
deferred[tuple[0] + "With"] = list.fireWith; | |
}); | |
promise.promise(deferred); | |
if (func) { | |
func.call(deferred, deferred); | |
} | |
return deferred; | |
}, | |
when: function (subordinate) { | |
var i = 0, | |
resolveValues = core_slice.call(arguments), | |
length = resolveValues.length, | |
remaining = length !== 1 || (subordinate && jQuery.isFunction(subordinate.promise)) ? length : 0, | |
deferred = remaining === 1 ? subordinate : jQuery.Deferred(), | |
updateFunc = function (i, contexts, values) { | |
return function (value) { | |
contexts[i] = this; | |
values[i] = arguments.length > 1 ? core_slice.call(arguments) : value; | |
if (values === progressValues) { | |
deferred.notifyWith(contexts, values); | |
} else if (!(--remaining)) { | |
deferred.resolveWith(contexts, values); | |
} | |
}; | |
}, | |
progressValues, progressContexts, resolveContexts; | |
if (length > 1) { | |
progressValues = new Array(length); | |
progressContexts = new Array(length); | |
resolveContexts = new Array(length); | |
for (; i < length; i++) { | |
if (resolveValues[i] && jQuery.isFunction(resolveValues[i].promise)) { | |
resolveValues[i].promise() | |
.done(updateFunc(i, resolveContexts, resolveValues)) | |
.fail(deferred.reject) | |
.progress(updateFunc(i, progressContexts, progressValues)); | |
} else { | |
--remaining; | |
} | |
} | |
} | |
if (!remaining) { | |
deferred.resolveWith(resolveContexts, resolveValues); | |
} | |
return deferred.promise(); | |
} | |
}); | |
jQuery.support = (function () { | |
var support, all, a, input, select, fragment, opt, eventName, isSupported, i, div = document.createElement("div"); | |
div.setAttribute("className", "t"); | |
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; | |
all = div.getElementsByTagName("*"); | |
a = div.getElementsByTagName("a")[0]; | |
if (!all || !a || !all.length) { | |
return {}; | |
} | |
select = document.createElement("select"); | |
opt = select.appendChild(document.createElement("option")); | |
input = div.getElementsByTagName("input")[0]; | |
a.style.cssText = "top:1px;float:left;opacity:.5"; | |
support = { | |
getSetAttribute: div.className !== "t", | |
leadingWhitespace: div.firstChild.nodeType === 3, | |
tbody: !div.getElementsByTagName("tbody").length, | |
htmlSerialize: !!div.getElementsByTagName("link").length, | |
style: /top/.test(a.getAttribute("style")), | |
hrefNormalized: a.getAttribute("href") === "/a", | |
opacity: /^0.5/.test(a.style.opacity), | |
cssFloat: !!a.style.cssFloat, | |
checkOn: !!input.value, | |
optSelected: opt.selected, | |
enctype: !!document.createElement("form").enctype, | |
html5Clone: document.createElement("nav").cloneNode(true).outerHTML !== "<:nav></:nav>", | |
boxModel: document.compatMode === "CSS1Compat", | |
deleteExpando: true, | |
noCloneEvent: true, | |
inlineBlockNeedsLayout: false, | |
shrinkWrapBlocks: false, | |
reliableMarginRight: true, | |
boxSizingReliable: true, | |
pixelPosition: false | |
}; | |
input.checked = true; | |
support.noCloneChecked = input.cloneNode(true).checked; | |
select.disabled = true; | |
support.optDisabled = !opt.disabled; | |
try { | |
delete div.test; | |
} catch (e) { | |
support.deleteExpando = false; | |
} | |
input = document.createElement("input"); | |
input.setAttribute("value", ""); | |
support.input = input.getAttribute("value") === ""; | |
input.value = "t"; | |
input.setAttribute("type", "radio"); | |
support.radioValue = input.value === "t"; | |
input.setAttribute("checked", "t"); | |
input.setAttribute("name", "t"); | |
fragment = document.createDocumentFragment(); | |
fragment.appendChild(input); | |
support.appendChecked = input.checked; | |
support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; | |
if (div.attachEvent) { | |
div.attachEvent("onclick", function () { | |
support.noCloneEvent = false; | |
}); | |
div.cloneNode(true).click(); | |
} | |
for (i in { | |
submit: true, | |
change: true, | |
focusin: true | |
}) { | |
div.setAttribute(eventName = "on" + i, "t"); | |
support[i + "Bubbles"] = eventName in window || div.attributes[eventName].expando === false; | |
} | |
div.style.backgroundClip = "content-box"; | |
div.cloneNode(true).style.backgroundClip = ""; | |
support.clearCloneStyle = div.style.backgroundClip === "content-box"; | |
jQuery(function () { | |
var container, marginDiv, tds, divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", | |
body = document.getElementsByTagName("body")[0]; | |
if (!body) { | |
return; | |
} | |
container = document.createElement("div"); | |
container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; | |
body.appendChild(container).appendChild(div); | |
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; | |
tds = div.getElementsByTagName("td"); | |
tds[0].style.cssText = "padding:0;margin:0;border:0;display:none"; | |
isSupported = (tds[0].offsetHeight === 0); | |
tds[0].style.display = ""; | |
tds[1].style.display = "none"; | |
support.reliableHiddenOffsets = isSupported && (tds[0].offsetHeight === 0); | |
div.innerHTML = ""; | |
div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; | |
support.boxSizing = (div.offsetWidth === 4); | |
support.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== 1); | |
if (window.getComputedStyle) { | |
support.pixelPosition = (window.getComputedStyle(div, null) || {}).top !== "1%"; | |
support.boxSizingReliable = (window.getComputedStyle(div, null) || { | |
width: "4px" | |
}).width === "4px"; | |
marginDiv = div.appendChild(document.createElement("div")); | |
marginDiv.style.cssText = div.style.cssText = divReset; | |
marginDiv.style.marginRight = marginDiv.style.width = "0"; | |
div.style.width = "1px"; | |
support.reliableMarginRight = !parseFloat((window.getComputedStyle(marginDiv, null) || {}).marginRight); | |
} | |
if (typeof div.style.zoom !== core_strundefined) { | |
div.innerHTML = ""; | |
div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; | |
support.inlineBlockNeedsLayout = (div.offsetWidth === 3); | |
div.style.display = "block"; | |
div.innerHTML = "<div></div>"; | |
div.firstChild.style.width = "5px"; | |
support.shrinkWrapBlocks = (div.offsetWidth !== 3); | |
if (support.inlineBlockNeedsLayout) { | |
body.style.zoom = 1; | |
} | |
} | |
body.removeChild(container); | |
container = div = tds = marginDiv = null; | |
}); | |
all = select = fragment = opt = a = input = null; | |
return support; | |
})(); | |
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, | |
rmultiDash = /([A-Z])/g; | |
function internalData(elem, name, data, pvt) { | |
if (!jQuery.acceptData(elem)) { | |
return; | |
} | |
var thisCache, ret, internalKey = jQuery.expando, | |
getByName = typeof name === "string", | |
isNode = elem.nodeType, | |
cache = isNode ? jQuery.cache : elem, | |
id = isNode ? elem[internalKey] : elem[internalKey] && internalKey; | |
if ((!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined) { | |
return; | |
} | |
if (!id) { | |
if (isNode) { | |
elem[internalKey] = id = core_deletedIds.pop() || jQuery.guid++; | |
} else { | |
id = internalKey; | |
} | |
} | |
if (!cache[id]) { | |
cache[id] = {}; | |
if (!isNode) { | |
cache[id].toJSON = jQuery.noop; | |
} | |
} | |
if (typeof name === "object" || typeof name === "function") { | |
if (pvt) { | |
cache[id] = jQuery.extend(cache[id], name); | |
} else { | |
cache[id].data = jQuery.extend(cache[id].data, name); | |
} | |
} | |
thisCache = cache[id]; | |
if (!pvt) { | |
if (!thisCache.data) { | |
thisCache.data = {}; | |
} | |
thisCache = thisCache.data; | |
} | |
if (data !== undefined) { | |
thisCache[jQuery.camelCase(name)] = data; | |
} | |
if (getByName) { | |
ret = thisCache[name]; | |
if (ret == null) { | |
ret = thisCache[jQuery.camelCase(name)]; | |
} | |
} else { | |
ret = thisCache; | |
} | |
return ret; | |
} | |
function internalRemoveData(elem, name, pvt) { | |
if (!jQuery.acceptData(elem)) { | |
return; | |
} | |
var i, l, thisCache, isNode = elem.nodeType, | |
cache = isNode ? jQuery.cache : elem, | |
id = isNode ? elem[jQuery.expando] : jQuery.expando; | |
if (!cache[id]) { | |
return; | |
} | |
if (name) { | |
thisCache = pvt ? cache[id] : cache[id].data; | |
if (thisCache) { | |
if (!jQuery.isArray(name)) { | |
if (name in thisCache) { | |
name = [name]; | |
} else { | |
name = jQuery.camelCase(name); | |
if (name in thisCache) { | |
name = [name]; | |
} else { | |
name = name.split(" "); | |
} | |
} | |
} else { | |
name = name.concat(jQuery.map(name, jQuery.camelCase)); | |
} | |
for (i = 0, l = name.length; i < l; i++) { | |
delete thisCache[name[i]]; | |
} | |
if (!(pvt ? isEmptyDataObject : jQuery.isEmptyObject)(thisCache)) { | |
return; | |
} | |
} | |
} | |
if (!pvt) { | |
delete cache[id].data; | |
if (!isEmptyDataObject(cache[id])) { | |
return; | |
} | |
} | |
if (isNode) { | |
jQuery.cleanData([elem], true); | |
} else if (jQuery.support.deleteExpando || cache != cache.window) { | |
delete cache[id]; | |
} else { | |
cache[id] = null; | |
} | |
} | |
jQuery.extend({ | |
cache: {}, | |
expando: "jQuery" + (core_version + Math.random()).replace(/\D/g, ""), | |
noData: { | |
"embed": true, | |
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", | |
"applet": true | |
}, | |
hasData: function (elem) { | |
elem = elem.nodeType ? jQuery.cache[elem[jQuery.expando]] : elem[jQuery.expando]; | |
return !!elem && !isEmptyDataObject(elem); | |
}, | |
data: function (elem, name, data) { | |
return internalData(elem, name, data); | |
}, | |
removeData: function (elem, name) { | |
return internalRemoveData(elem, name); | |
}, | |
_data: function (elem, name, data) { | |
return internalData(elem, name, data, true); | |
}, | |
_removeData: function (elem, name) { | |
return internalRemoveData(elem, name, true); | |
}, | |
acceptData: function (elem) { | |
if (elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9) { | |
return false; | |
} | |
var noData = elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]; | |
return !noData || noData !== true && elem.getAttribute("classid") === noData; | |
} | |
}); | |
jQuery.fn.extend({ | |
data: function (key, value) { | |
var attrs, name, elem = this[0], | |
i = 0, | |
data = null; | |
if (key === undefined) { | |
if (this.length) { | |
data = jQuery.data(elem); | |
if (elem.nodeType === 1 && !jQuery._data(elem, "parsedAttrs")) { | |
attrs = elem.attributes; | |
for (; i < attrs.length; i++) { | |
name = attrs[i].name; | |
if (!name.indexOf("data-")) { | |
name = jQuery.camelCase(name.slice(5)); | |
dataAttr(elem, name, data[name]); | |
} | |
} | |
jQuery._data(elem, "parsedAttrs", true); | |
} | |
} | |
return data; | |
} | |
if (typeof key === "object") { | |
return this.each(function () { | |
jQuery.data(this, key); | |
}); | |
} | |
return jQuery.access(this, function (value) { | |
if (value === undefined) { | |
return elem ? dataAttr(elem, key, jQuery.data(elem, key)) : null; | |
} | |
this.each(function () { | |
jQuery.data(this, key, value); | |
}); | |
}, null, value, arguments.length > 1, null, true); | |
}, | |
removeData: function (key) { | |
return this.each(function () { | |
jQuery.removeData(this, key); | |
}); | |
} | |
}); | |
function dataAttr(elem, key, data) { | |
if (data === undefined && elem.nodeType === 1) { | |
var name = "data-" + key.replace(rmultiDash, "-$1").toLowerCase(); | |
data = elem.getAttribute(name); | |
if (typeof data === "string") { | |
try { | |
data = data === "true" ? true : data === "false" ? false : data === "null" ? null : +data + "" === data ? +data : rbrace.test(data) ? jQuery.parseJSON(data) : data; | |
} catch (e) {} | |
jQuery.data(elem, key, data); | |
} else { | |
data = undefined; | |
} | |
} | |
return data; | |
} | |
function isEmptyDataObject(obj) { | |
var name; | |
for (name in obj) { | |
if (name === "data" && jQuery.isEmptyObject(obj[name])) { | |
continue; | |
} | |
if (name !== "toJSON") { | |
return false; | |
} | |
} | |
return true; | |
} | |
jQuery.extend({ | |
queue: function (elem, type, data) { | |
var queue; | |
if (elem) { | |
type = (type || "fx") + "queue"; | |
queue = jQuery._data(elem, type); | |
if (data) { | |
if (!queue || jQuery.isArray(data)) { | |
queue = jQuery._data(elem, type, jQuery.makeArray(data)); | |
} else { | |
queue.push(data); | |
} | |
} | |
return queue || []; | |
} | |
}, | |
dequeue: function (elem, type) { | |
type = type || "fx"; | |
var queue = jQuery.queue(elem, type), | |
startLength = queue.length, | |
fn = queue.shift(), | |
hooks = jQuery._queueHooks(elem, type), | |
next = function () { | |
jQuery.dequeue(elem, type); | |
}; | |
if (fn === "inprogress") { | |
fn = queue.shift(); | |
startLength--; | |
} | |
hooks.cur = fn; | |
if (fn) { | |
if (type === "fx") { | |
queue.unshift("inprogress"); | |
} | |
delete hooks.stop; | |
fn.call(elem, next, hooks); | |
} | |
if (!startLength && hooks) { | |
hooks.empty.fire(); | |
} | |
}, | |
_queueHooks: function (elem, type) { | |
var key = type + "queueHooks"; | |
return jQuery._data(elem, key) || jQuery._data(elem, key, { | |
empty: jQuery.Callbacks("once memory").add(function () { | |
jQuery._removeData(elem, type + "queue"); | |
jQuery._removeData(elem, key); | |
}) | |
}); | |
} | |
}); | |
jQuery.fn.extend({ | |
queue: function (type, data) { | |
var setter = 2; | |
if (typeof type !== "string") { | |
data = type; | |
type = "fx"; | |
setter--; | |
} | |
if (arguments.length < setter) { | |
return jQuery.queue(this[0], type); | |
} | |
return data === undefined ? this : this.each(function () { | |
var queue = jQuery.queue(this, type, data); | |
jQuery._queueHooks(this, type); | |
if (type === "fx" && queue[0] !== "inprogress") { | |
jQuery.dequeue(this, type); | |
} | |
}); | |
}, | |
dequeue: function (type) { | |
return this.each(function () { | |
jQuery.dequeue(this, type); | |
}); | |
}, | |
delay: function (time, type) { | |
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; | |
type = type || "fx"; | |
return this.queue(type, function (next, hooks) { | |
var timeout = setTimeout(next, time); | |
hooks.stop = function () { | |
clearTimeout(timeout); | |
}; | |
}); | |
}, | |
clearQueue: function (type) { | |
return this.queue(type || "fx", []); | |
}, | |
promise: function (type, obj) { | |
var tmp, count = 1, | |
defer = jQuery.Deferred(), | |
elements = this, | |
i = this.length, | |
resolve = function () { | |
if (!(--count)) { | |
defer.resolveWith(elements, [elements]); | |
} | |
}; | |
if (typeof type !== "string") { | |
obj = type; | |
type = undefined; | |
} | |
type = type || "fx"; | |
while (i--) { | |
tmp = jQuery._data(elements[i], type + "queueHooks"); | |
if (tmp && tmp.empty) { | |
count++; | |
tmp.empty.add(resolve); | |
} | |
} | |
resolve(); | |
return defer.promise(obj); | |
} | |
}); | |
var nodeHook, boolHook, rclass = /[\t\r\n]/g, | |
rreturn = /\r/g, | |
rfocusable = /^(?:input|select|textarea|button|object)$/i, | |
rclickable = /^(?:a|area)$/i, | |
rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i, | |
ruseDefault = /^(?:checked|selected)$/i, | |
getSetAttribute = jQuery.support.getSetAttribute, | |
getSetInput = jQuery.support.input; | |
jQuery.fn.extend({ | |
attr: function (name, value) { | |
return jQuery.access(this, jQuery.attr, name, value, arguments.length > 1); | |
}, | |
removeAttr: function (name) { | |
return this.each(function () { | |
jQuery.removeAttr(this, name); | |
}); | |
}, | |
prop: function (name, value) { | |
return jQuery.access(this, jQuery.prop, name, value, arguments.length > 1); | |
}, | |
removeProp: function (name) { | |
name = jQuery.propFix[name] || name; | |
return this.each(function () { | |
try { | |
this[name] = undefined; | |
delete this[name]; | |
} catch (e) {} | |
}); | |
}, | |
addClass: function (value) { | |
var classes, elem, cur, clazz, j, i = 0, | |
len = this.length, | |
proceed = typeof value === "string" && value; | |
if (jQuery.isFunction(value)) { | |
return this.each(function (j) { | |
jQuery(this).addClass(value.call(this, j, this.className)); | |
}); | |
} | |
if (proceed) { | |
classes = (value || "").match(core_rnotwhite) || []; | |
for (; i < len; i++) { | |
elem = this[i]; | |
cur = elem.nodeType === 1 && (elem.className ? (" " + elem.className + " ").replace(rclass, " ") : " "); | |
if (cur) { | |
j = 0; | |
while ((clazz = classes[j++])) { | |
if (cur.indexOf(" " + clazz + " ") < 0) { | |
cur += clazz + " "; | |
} | |
} | |
elem.className = jQuery.trim(cur); | |
} | |
} | |
} | |
return this; | |
}, | |
removeClass: function (value) { | |
var classes, elem, cur, clazz, j, i = 0, | |
len = this.length, | |
proceed = arguments.length === 0 || typeof value === "string" && value; | |
if (jQuery.isFunction(value)) { | |
return this.each(function (j) { | |
jQuery(this).removeClass(value.call(this, j, this.className)); | |
}); | |
} | |
if (proceed) { | |
classes = (value || "").match(core_rnotwhite) || []; | |
for (; i < len; i++) { | |
elem = this[i]; | |
cur = elem.nodeType === 1 && (elem.className ? (" " + elem.className + " ").replace(rclass, " ") : ""); | |
if (cur) { | |
j = 0; | |
while ((clazz = classes[j++])) { | |
while (cur.indexOf(" " + clazz + " ") >= 0) { | |
cur = cur.replace(" " + clazz + " ", " "); | |
} | |
} | |
elem.className = value ? jQuery.trim(cur) : ""; | |
} | |
} | |
} | |
return this; | |
}, | |
toggleClass: function (value, stateVal) { | |
var type = typeof value, | |
isBool = typeof stateVal === "boolean"; | |
if (jQuery.isFunction(value)) { | |
return this.each(function (i) { | |
jQuery(this).toggleClass(value.call(this, i, this.className, stateVal), stateVal); | |
}); | |
} | |
return this.each(function () { | |
if (type === "string") { | |
var className, i = 0, | |
self = jQuery(this), | |
state = stateVal, | |
classNames = value.match(core_rnotwhite) || []; | |
while ((className = classNames[i++])) { | |
state = isBool ? state : !self.hasClass(className); | |
self[state ? "addClass" : "removeClass"](className); | |
} | |
} else if (type === core_strundefined || type === "boolean") { | |
if (this.className) { | |
jQuery._data(this, "__className__", this.className); | |
} | |
this.className = this.className || value === false ? "" : jQuery._data(this, "__className__") || ""; | |
} | |
}); | |
}, | |
hasClass: function (selector) { | |
var className = " " + selector + " ", | |
i = 0, | |
l = this.length; | |
for (; i < l; i++) { | |
if (this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf(className) >= 0) { | |
return true; | |
} | |
} | |
return false; | |
}, | |
val: function (value) { | |
var ret, hooks, isFunction, elem = this[0]; | |
if (!arguments.length) { | |
if (elem) { | |
hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()]; | |
if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) { | |
return ret; | |
} | |
ret = elem.value; | |
return typeof ret === "string" ? ret.replace(rreturn, "") : ret == null ? "" : ret; | |
} | |
return; | |
} | |
isFunction = jQuery.isFunction(value); | |
return this.each(function (i) { | |
var val, self = jQuery(this); | |
if (this.nodeType !== 1) { | |
return; | |
} | |
if (isFunction) { | |
val = value.call(this, i, self.val()); | |
} else { | |
val = value; | |
} | |
if (val == null) { | |
val = ""; | |
} else if (typeof val === "number") { | |
val += ""; | |
} else if (jQuery.isArray(val)) { | |
val = jQuery.map(val, function (value) { | |
return value == null ? "" : value + ""; | |
}); | |
} | |
hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()]; | |
if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) { | |
this.value = val; | |
} | |
}); | |
} | |
}); | |
jQuery.extend({ | |
valHooks: { | |
option: { | |
get: function (elem) { | |
var val = elem.attributes.value; | |
return !val || val.specified ? elem.value : elem.text; | |
} | |
}, | |
select: { | |
get: function (elem) { | |
var value, option, options = elem.options, | |
index = elem.selectedIndex, | |
one = elem.type === "select-one" || index < 0, | |
values = one ? null : [], | |
max = one ? index + 1 : options.length, | |
i = index < 0 ? max : one ? index : 0; | |
for (; i < max; i++) { | |
option = options[i]; | |
if ((option.selected || i === index) && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && (!option.parentNode.disabled || !jQuery.nodeName(option.parentNode, "optgroup"))) { | |
value = jQuery(option).val(); | |
if (one) { | |
return value; | |
} | |
values.push(value); | |
} | |
} | |
return values; | |
}, | |
set: function (elem, value) { | |
var values = jQuery.makeArray(value); | |
jQuery(elem).find("option").each(function () { | |
this.selected = jQuery.inArray(jQuery(this).val(), values) >= 0; | |
}); | |
if (!values.length) { | |
elem.selectedIndex = -1; | |
} | |
return values; | |
} | |
} | |
}, | |
attr: function (elem, name, value) { | |
var hooks, notxml, ret, nType = elem.nodeType; | |
if (!elem || nType === 3 || nType === 8 || nType === 2) { | |
return; | |
} | |
if (typeof elem.getAttribute === core_strundefined) { | |
return jQuery.prop(elem, name, value); | |
} | |
notxml = nType !== 1 || !jQuery.isXMLDoc(elem); | |
if (notxml) { | |
name = name.toLowerCase(); | |
hooks = jQuery.attrHooks[name] || (rboolean.test(name) ? boolHook : nodeHook); | |
} | |
if (value !== undefined) { | |
if (value === null) { | |
jQuery.removeAttr(elem, name); | |
} else if (hooks && notxml && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) { | |
return ret; | |
} else { | |
elem.setAttribute(name, value + ""); | |
return value; | |
} | |
} else if (hooks && notxml && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { | |
return ret; | |
} else { | |
if (typeof elem.getAttribute !== core_strundefined) { | |
ret = elem.getAttribute(name); | |
} | |
return ret == null ? undefined : ret; | |
} | |
}, | |
removeAttr: function (elem, value) { | |
var name, propName, i = 0, | |
attrNames = value && value.match(core_rnotwhite); | |
if (attrNames && elem.nodeType === 1) { | |
while ((name = attrNames[i++])) { | |
propName = jQuery.propFix[name] || name; | |
if (rboolean.test(name)) { | |
if (!getSetAttribute && ruseDefault.test(name)) { | |
elem[jQuery.camelCase("default-" + name)] = elem[propName] = false; | |
} else { | |
elem[propName] = false; | |
} | |
} else { | |
jQuery.attr(elem, name, ""); | |
} | |
elem.removeAttribute(getSetAttribute ? name : propName); | |
} | |
} | |
}, | |
attrHooks: { | |
type: { | |
set: function (elem, value) { | |
if (!jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input")) { | |
var val = elem.value; | |
elem.setAttribute("type", value); | |
if (val) { | |
elem.value = val; | |
} | |
return value; | |
} | |
} | |
} | |
}, | |
propFix: { | |
tabindex: "tabIndex", | |
readonly: "readOnly", | |
"for": "htmlFor", | |
"class": "className", | |
maxlength: "maxLength", | |
cellspacing: "cellSpacing", | |
cellpadding: "cellPadding", | |
rowspan: "rowSpan", | |
colspan: "colSpan", | |
usemap: "useMap", | |
frameborder: "frameBorder", | |
contenteditable: "contentEditable" | |
}, | |
prop: function (elem, name, value) { | |
var ret, hooks, notxml, nType = elem.nodeType; | |
if (!elem || nType === 3 || nType === 8 || nType === 2) { | |
return; | |
} | |
notxml = nType !== 1 || !jQuery.isXMLDoc(elem); | |
if (notxml) { | |
name = jQuery.propFix[name] || name; | |
hooks = jQuery.propHooks[name]; | |
} | |
if (value !== undefined) { | |
if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) { | |
return ret; | |
} else { | |
return (elem[name] = value); | |
} | |
} else { | |
if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { | |
return ret; | |
} else { | |
return elem[name]; | |
} | |
} | |
}, | |
propHooks: { | |
tabIndex: { | |
get: function (elem) { | |
var attributeNode = elem.getAttributeNode("tabindex"); | |
return attributeNode && attributeNode.specified ? parseInt(attributeNode.value, 10) : rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href ? 0 : undefined; | |
} | |
} | |
} | |
}); | |
boolHook = { | |
get: function (elem, name) { | |
var | |
prop = jQuery.prop(elem, name), | |
attr = typeof prop === "boolean" && elem.getAttribute(name), | |
detail = typeof prop === "boolean" ? getSetInput && getSetAttribute ? attr != null : ruseDefault.test(name) ? elem[jQuery.camelCase("default-" + name)] : !!attr : elem.getAttributeNode(name); | |
return detail && detail.value !== false ? name.toLowerCase() : undefined; | |
}, | |
set: function (elem, value, name) { | |
if (value === false) { | |
jQuery.removeAttr(elem, name); | |
} else if (getSetInput && getSetAttribute || !ruseDefault.test(name)) { | |
elem.setAttribute(!getSetAttribute && jQuery.propFix[name] || name, name); | |
} else { | |
elem[jQuery.camelCase("default-" + name)] = elem[name] = true; | |
} | |
return name; | |
} | |
}; | |
if (!getSetInput || !getSetAttribute) { | |
jQuery.attrHooks.value = { | |
get: function (elem, name) { | |
var ret = elem.getAttributeNode(name); | |
return jQuery.nodeName(elem, "input") ? elem.defaultValue : ret && ret.specified ? ret.value : undefined; | |
}, | |
set: function (elem, value, name) { | |
if (jQuery.nodeName(elem, "input")) { | |
elem.defaultValue = value; | |
} else { | |
return nodeHook && nodeHook.set(elem, value, name); | |
} | |
} | |
}; | |
} | |
if (!getSetAttribute) { | |
nodeHook = jQuery.valHooks.button = { | |
get: function (elem, name) { | |
var ret = elem.getAttributeNode(name); | |
return ret && (name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified) ? ret.value : undefined; | |
}, | |
set: function (elem, value, name) { | |
var ret = elem.getAttributeNode(name); | |
if (!ret) { | |
elem.setAttributeNode((ret = elem.ownerDocument.createAttribute(name))); | |
} | |
ret.value = value += ""; | |
return name === "value" || value === elem.getAttribute(name) ? value : undefined; | |
} | |
}; | |
jQuery.attrHooks.contenteditable = { | |
get: nodeHook.get, | |
set: function (elem, value, name) { | |
nodeHook.set(elem, value === "" ? false : value, name); | |
} | |
}; | |
jQuery.each(["width", "height"], function (i, name) { | |
jQuery.attrHooks[name] = jQuery.extend(jQuery.attrHooks[name], { | |
set: function (elem, value) { | |
if (value === "") { | |
elem.setAttribute(name, "auto"); | |
return value; | |
} | |
} | |
}); | |
}); | |
} | |
if (!jQuery.support.hrefNormalized) { | |
jQuery.each(["href", "src", "width", "height"], function (i, name) { | |
jQuery.attrHooks[name] = jQuery.extend(jQuery.attrHooks[name], { | |
get: function (elem) { | |
var ret = elem.getAttribute(name, 2); | |
return ret == null ? undefined : ret; | |
} | |
}); | |
}); | |
jQuery.each(["href", "src"], function (i, name) { | |
jQuery.propHooks[name] = { | |
get: function (elem) { | |
return elem.getAttribute(name, 4); | |
} | |
}; | |
}); | |
} | |
if (!jQuery.support.style) { | |
jQuery.attrHooks.style = { | |
get: function (elem) { | |
return elem.style.cssText || undefined; | |
}, | |
set: function (elem, value) { | |
return (elem.style.cssText = value + ""); | |
} | |
}; | |
} | |
if (!jQuery.support.optSelected) { | |
jQuery.propHooks.selected = jQuery.extend(jQuery.propHooks.selected, { | |
get: function (elem) { | |
var parent = elem.parentNode; | |
if (parent) { | |
parent.selectedIndex; | |
if (parent.parentNode) { | |
parent.parentNode.selectedIndex; | |
} | |
} | |
return null; | |
} | |
}); | |
} | |
if (!jQuery.support.enctype) { | |
jQuery.propFix.enctype = "encoding"; | |
} | |
if (!jQuery.support.checkOn) { | |
jQuery.each(["radio", "checkbox"], function () { | |
jQuery.valHooks[this] = { | |
get: function (elem) { | |
return elem.getAttribute("value") === null ? "on" : elem.value; | |
} | |
}; | |
}); | |
} | |
jQuery.each(["radio", "checkbox"], function () { | |
jQuery.valHooks[this] = jQuery.extend(jQuery.valHooks[this], { | |
set: function (elem, value) { | |
if (jQuery.isArray(value)) { | |
return (elem.checked = jQuery.inArray(jQuery(elem).val(), value) >= 0); | |
} | |
} | |
}); | |
}); | |
var rformElems = /^(?:input|select|textarea)$/i, | |
rkeyEvent = /^key/, | |
rmouseEvent = /^(?:mouse|contextmenu)|click/, | |
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, | |
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; | |
function returnTrue() { | |
return true; | |
} | |
function returnFalse() { | |
return false; | |
} | |
jQuery.event = { | |
global: {}, | |
add: function (elem, types, handler, data, selector) { | |
var tmp, events, t, handleObjIn, special, eventHandle, handleObj, handlers, type, namespaces, origType, elemData = jQuery._data(elem); | |
if (!elemData) { | |
return; | |
} | |
if (handler.handler) { | |
handleObjIn = handler; | |
handler = handleObjIn.handler; | |
selector = handleObjIn.selector; | |
} | |
if (!handler.guid) { | |
handler.guid = jQuery.guid++; | |
} | |
if (!(events = elemData.events)) { | |
events = elemData.events = {}; | |
} | |
if (!(eventHandle = elemData.handle)) { | |
eventHandle = elemData.handle = function (e) { | |
return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply(eventHandle.elem, arguments) : undefined; | |
}; | |
eventHandle.elem = elem; | |
} | |
types = (types || "").match(core_rnotwhite) || [""]; | |
t = types.length; | |
while (t--) { | |
tmp = rtypenamespace.exec(types[t]) || []; | |
type = origType = tmp[1]; | |
namespaces = (tmp[2] || "").split(".").sort(); | |
special = jQuery.event.special[type] || {}; | |
type = (selector ? special.delegateType : special.bindType) || type; | |
special = jQuery.event.special[type] || {}; | |
handleObj = jQuery.extend({ | |
type: type, | |
origType: origType, | |
data: data, | |
handler: handler, | |
guid: handler.guid, | |
selector: selector, | |
needsContext: selector && jQuery.expr.match.needsContext.test(selector), | |
namespace: namespaces.join(".") | |
}, handleObjIn); | |
if (!(handlers = events[type])) { | |
handlers = events[type] = []; | |
handlers.delegateCount = 0; | |
if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) { | |
if (elem.addEventListener) { | |
elem.addEventListener(type, eventHandle, false); | |
} else if (elem.attachEvent) { | |
elem.attachEvent("on" + type, eventHandle); | |
} | |
} | |
} | |
if (special.add) { | |
special.add.call(elem, handleObj); | |
if (!handleObj.handler.guid) { | |
handleObj.handler.guid = handler.guid; | |
} | |
} | |
if (selector) { | |
handlers.splice(handlers.delegateCount++, 0, handleObj); | |
} else { | |
handlers.push(handleObj); | |
} | |
jQuery.event.global[type] = true; | |
} | |
elem = null; | |
}, | |
remove: function (elem, types, handler, selector, mappedTypes) { | |
var j, handleObj, tmp, origCount, t, events, special, handlers, type, namespaces, origType, elemData = jQuery.hasData(elem) && jQuery._data(elem); | |
if (!elemData || !(events = elemData.events)) { | |
return; | |
} | |
types = (types || "").match(core_rnotwhite) || [""]; | |
t = types.length; | |
while (t--) { | |
tmp = rtypenamespace.exec(types[t]) || []; | |
type = origType = tmp[1]; | |
namespaces = (tmp[2] || "").split(".").sort(); | |
if (!type) { | |
for (type in events) { | |
jQuery.event.remove(elem, type + types[t], handler, selector, true); | |
} | |
continue; | |
} | |
special = jQuery.event.special[type] || {}; | |
type = (selector ? special.delegateType : special.bindType) || type; | |
handlers = events[type] || []; | |
tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)"); | |
origCount = j = handlers.length; | |
while (j--) { | |
handleObj = handlers[j]; | |
if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) { | |
handlers.splice(j, 1); | |
if (handleObj.selector) { | |
handlers.delegateCount--; | |
} | |
if (special.remove) { | |
special.remove.call(elem, handleObj); | |
} | |
} | |
} | |
if (origCount && !handlers.length) { | |
if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) { | |
jQuery.removeEvent(elem, type, elemData.handle); | |
} | |
delete events[type]; | |
} | |
} | |
if (jQuery.isEmptyObject(events)) { | |
delete elemData.handle; | |
jQuery._removeData(elem, "events"); | |
} | |
}, | |
trigger: function (event, data, elem, onlyHandlers) { | |
var handle, ontype, cur, bubbleType, special, tmp, i, eventPath = [elem || document], | |
type = core_hasOwn.call(event, "type") ? event.type : event, | |
namespaces = core_hasOwn.call(event, "namespace") ? event.namespace.split(".") : []; | |
cur = tmp = elem = elem || document; | |
if (elem.nodeType === 3 || elem.nodeType === 8) { | |
return; | |
} | |
if (rfocusMorph.test(type + jQuery.event.triggered)) { | |
return; | |
} | |
if (type.indexOf(".") >= 0) { | |
namespaces = type.split("."); | |
type = namespaces.shift(); | |
namespaces.sort(); | |
} | |
ontype = type.indexOf(":") < 0 && "on" + type; | |
event = event[jQuery.expando] ? event : new jQuery.Event(type, typeof event === "object" && event); | |
event.isTrigger = true; | |
event.namespace = namespaces.join("."); | |
event.namespace_re = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; | |
event.result = undefined; | |
if (!event.target) { | |
event.target = elem; | |
} | |
data = data == null ? [event] : jQuery.makeArray(data, [event]); | |
special = jQuery.event.special[type] || {}; | |
if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) { | |
return; | |
} | |
if (!onlyHandlers && !special.noBubble && !jQuery.isWindow(elem)) { | |
bubbleType = special.delegateType || type; | |
if (!rfocusMorph.test(bubbleType + type)) { | |
cur = cur.parentNode; | |
} | |
for (; cur; cur = cur.parentNode) { | |
eventPath.push(cur); | |
tmp = cur; | |
} | |
if (tmp === (elem.ownerDocument || document)) { | |
eventPath.push(tmp.defaultView || tmp.parentWindow || window); | |
} | |
} | |
i = 0; | |
while ((cur = eventPath[i++]) && !event.isPropagationStopped()) { | |
event.type = i > 1 ? bubbleType : special.bindType || type; | |
handle = (jQuery._data(cur, "events") || {})[event.type] && jQuery._data(cur, "handle"); | |
if (handle) { | |
handle.apply(cur, data); | |
} | |
handle = ontype && cur[ontype]; | |
if (handle && jQuery.acceptData(cur) && handle.apply && handle.apply(cur, data) === false) { | |
event.preventDefault(); | |
} | |
} | |
event.type = type; | |
if (!onlyHandlers && !event.isDefaultPrevented()) { | |
if ((!special._default || special._default.apply(elem.ownerDocument, data) === false) && !(type === "click" && jQuery.nodeName(elem, "a")) && jQuery.acceptData(elem)) { | |
if (ontype && elem[type] && !jQuery.isWindow(elem)) { | |
tmp = elem[ontype]; | |
if (tmp) { | |
elem[ontype] = null; | |
} | |
jQuery.event.triggered = type; | |
try { | |
elem[type](); | |
} catch (e) {} | |
jQuery.event.triggered = undefined; | |
if (tmp) { | |
elem[ontype] = tmp; | |
} | |
} | |
} | |
} | |
return event.result; | |
}, | |
dispatch: function (event) { | |
event = jQuery.event.fix(event); | |
var i, ret, handleObj, matched, j, handlerQueue = [], | |
args = core_slice.call(arguments), | |
handlers = (jQuery._data(this, "events") || {})[event.type] || [], | |
special = jQuery.event.special[event.type] || {}; | |
args[0] = event; | |
event.delegateTarget = this; | |
if (special.preDispatch && special.preDispatch.call(this, event) === false) { | |
return; | |
} | |
handlerQueue = jQuery.event.handlers.call(this, event, handlers); | |
i = 0; | |
while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) { | |
event.currentTarget = matched.elem; | |
j = 0; | |
while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) { | |
if (!event.namespace_re || event.namespace_re.test(handleObj.namespace)) { | |
event.handleObj = handleObj; | |
event.data = handleObj.data; | |
ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler) | |
.apply(matched.elem, args); | |
if (ret !== undefined) { | |
if ((event.result = ret) === false) { | |
event.preventDefault(); | |
event.stopPropagation(); | |
} | |
} | |
} | |
} | |
} | |
if (special.postDispatch) { | |
special.postDispatch.call(this, event); | |
} | |
return event.result; | |
}, | |
handlers: function (event, handlers) { | |
var sel, handleObj, matches, i, handlerQueue = [], | |
delegateCount = handlers.delegateCount, | |
cur = event.target; | |
if (delegateCount && cur.nodeType && (!event.button || event.type !== "click")) { | |
for (; cur != this; cur = cur.parentNode || this) { | |
if (cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click")) { | |
matches = []; | |
for (i = 0; i < delegateCount; i++) { | |
handleObj = handlers[i]; | |
sel = handleObj.selector + " "; | |
if (matches[sel] === undefined) { | |
matches[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) >= 0 : jQuery.find(sel, this, null, [cur]).length; | |
} | |
if (matches[sel]) { | |
matches.push(handleObj); | |
} | |
} | |
if (matches.length) { | |
handlerQueue.push({ | |
elem: cur, | |
handlers: matches | |
}); | |
} | |
} | |
} | |
} | |
if (delegateCount < handlers.length) { | |
handlerQueue.push({ | |
elem: this, | |
handlers: handlers.slice(delegateCount) | |
}); | |
} | |
return handlerQueue; | |
}, | |
fix: function (event) { | |
if (event[jQuery.expando]) { | |
return event; | |
} | |
var i, prop, copy, type = event.type, | |
originalEvent = event, | |
fixHook = this.fixHooks[type]; | |
if (!fixHook) { | |
this.fixHooks[type] = fixHook = rmouseEvent.test(type) ? this.mouseHooks : rkeyEvent.test(type) ? this.keyHooks : {}; | |
} | |
copy = fixHook.props ? this.props.concat(fixHook.props) : this.props; | |
event = new jQuery.Event(originalEvent); | |
i = copy.length; | |
while (i--) { | |
prop = copy[i]; | |
event[prop] = originalEvent[prop]; | |
} | |
if (!event.target) { | |
event.target = originalEvent.srcElement || document; | |
} | |
if (event.target.nodeType === 3) { | |
event.target = event.target.parentNode; | |
} | |
event.metaKey = !!event.metaKey; | |
return fixHook.filter ? fixHook.filter(event, originalEvent) : event; | |
}, | |
props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), | |
fixHooks: {}, | |
keyHooks: { | |
props: "char charCode key keyCode".split(" "), | |
filter: function (event, original) { | |
if (event.which == null) { | |
event.which = original.charCode != null ? original.charCode : original.keyCode; | |
} | |
return event; | |
} | |
}, | |
mouseHooks: { | |
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), | |
filter: function (event, original) { | |
var body, eventDoc, doc, button = original.button, | |
fromElement = original.fromElement; | |
if (event.pageX == null && original.clientX != null) { | |
eventDoc = event.target.ownerDocument || document; | |
doc = eventDoc.documentElement; | |
body = eventDoc.body; | |
event.pageX = original.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); | |
event.pageY = original.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); | |
} | |
if (!event.relatedTarget && fromElement) { | |
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; | |
} | |
if (!event.which && button !== undefined) { | |
event.which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0))); | |
} | |
return event; | |
} | |
}, | |
special: { | |
load: { | |
noBubble: true | |
}, | |
click: { | |
trigger: function () { | |
if (jQuery.nodeName(this, "input") && this.type === "checkbox" && this.click) { | |
this.click(); | |
return false; | |
} | |
} | |
}, | |
focus: { | |
trigger: function () { | |
if (this !== document.activeElement && this.focus) { | |
try { | |
this.focus(); | |
return false; | |
} catch (e) {} | |
} | |
}, | |
delegateType: "focusin" | |
}, | |
blur: { | |
trigger: function () { | |
if (this === document.activeElement && this.blur) { | |
this.blur(); | |
return false; | |
} | |
}, | |
delegateType: "focusout" | |
}, | |
beforeunload: { | |
postDispatch: function (event) { | |
if (event.result !== undefined) { | |
event.originalEvent.returnValue = event.result; | |
} | |
} | |
} | |
}, | |
simulate: function (type, elem, event, bubble) { | |
var e = jQuery.extend(new jQuery.Event(), event, { | |
type: type, | |
isSimulated: true, | |
originalEvent: {} | |
}); | |
if (bubble) { | |
jQuery.event.trigger(e, null, elem); | |
} else { | |
jQuery.event.dispatch.call(elem, e); | |
} | |
if (e.isDefaultPrevented()) { | |
event.preventDefault(); | |
} | |
} | |
}; | |
jQuery.removeEvent = document.removeEventListener ? function (elem, type, handle) { | |
if (elem.removeEventListener) { | |
elem.removeEventListener(type, handle, false); | |
} | |
} : function (elem, type, handle) { | |
var name = "on" + type; | |
if (elem.detachEvent) { | |
if (typeof elem[name] === core_strundefined) { | |
elem[name] = null; | |
} | |
elem.detachEvent(name, handle); | |
} | |
}; | |
jQuery.Event = function (src, props) { | |
if (!(this instanceof jQuery.Event)) { | |
return new jQuery.Event(src, props); | |
} | |
if (src && src.type) { | |
this.originalEvent = src; | |
this.type = src.type; | |
this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false || src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse; | |
} else { | |
this.type = src; | |
} | |
if (props) { | |
jQuery.extend(this, props); | |
} | |
this.timeStamp = src && src.timeStamp || jQuery.now(); | |
this[jQuery.expando] = true; | |
}; | |
jQuery.Event.prototype = { | |
isDefaultPrevented: returnFalse, | |
isPropagationStopped: returnFalse, | |
isImmediatePropagationStopped: returnFalse, | |
preventDefault: function () { | |
var e = this.originalEvent; | |
this.isDefaultPrevented = returnTrue; | |
if (!e) { | |
return; | |
} | |
if (e.preventDefault) { | |
e.preventDefault(); | |
} else { | |
e.returnValue = false; | |
} | |
}, | |
stopPropagation: function () { | |
var e = this.originalEvent; | |
this.isPropagationStopped = returnTrue; | |
if (!e) { | |
return; | |
} | |
if (e.stopPropagation) { | |
e.stopPropagation(); | |
} | |
e.cancelBubble = true; | |
}, | |
stopImmediatePropagation: function () { | |
this.isImmediatePropagationStopped = returnTrue; | |
this.stopPropagation(); | |
} | |
}; | |
jQuery.each({ | |
mouseenter: "mouseover", | |
mouseleave: "mouseout" | |
}, function (orig, fix) { | |
jQuery.event.special[orig] = { | |
delegateType: fix, | |
bindType: fix, | |
handle: function (event) { | |
var ret, target = this, | |
related = event.relatedTarget, | |
handleObj = event.handleObj; | |
if (!related || (related !== target && !jQuery.contains(target, related))) { | |
event.type = handleObj.origType; | |
ret = handleObj.handler.apply(this, arguments); | |
event.type = fix; | |
} | |
return ret; | |
} | |
}; | |
}); | |
if (!jQuery.support.submitBubbles) { | |
jQuery.event.special.submit = { | |
setup: function () { | |
if (jQuery.nodeName(this, "form")) { | |
return false; | |
} | |
jQuery.event.add(this, "click._submit keypress._submit", function (e) { | |
var elem = e.target, | |
form = jQuery.nodeName(elem, "input") || jQuery.nodeName(elem, "button") ? elem.form : undefined; | |
if (form && !jQuery._data(form, "submitBubbles")) { | |
jQuery.event.add(form, "submit._submit", function (event) { | |
event._submit_bubble = true; | |
}); | |
jQuery._data(form, "submitBubbles", true); | |
} | |
}); | |
}, | |
postDispatch: function (event) { | |
if (event._submit_bubble) { | |
delete event._submit_bubble; | |
if (this.parentNode && !event.isTrigger) { | |
jQuery.event.simulate("submit", this.parentNode, event, true); | |
} | |
} | |
}, | |
teardown: function () { | |
if (jQuery.nodeName(this, "form")) { | |
return false; | |
} | |
jQuery.event.remove(this, "._submit"); | |
} | |
}; | |
} | |
if (!jQuery.support.changeBubbles) { | |
jQuery.event.special.change = { | |
setup: function () { | |
if (rformElems.test(this.nodeName)) { | |
if (this.type === "checkbox" || this.type === "radio") { | |
jQuery.event.add(this, "propertychange._change", function (event) { | |
if (event.originalEvent.propertyName === "checked") { | |
this._just_changed = true; | |
} | |
}); | |
jQuery.event.add(this, "click._change", function (event) { | |
if (this._just_changed && !event.isTrigger) { | |
this._just_changed = false; | |
} | |
jQuery.event.simulate("change", this, event, true); | |
}); | |
} | |
return false; | |
} | |
jQuery.event.add(this, "beforeactivate._change", function (e) { | |
var elem = e.target; | |
if (rformElems.test(elem.nodeName) && !jQuery._data(elem, "changeBubbles")) { | |
jQuery.event.add(elem, "change._change", function (event) { | |
if (this.parentNode && !event.isSimulated && !event.isTrigger) { | |
jQuery.event.simulate("change", this.parentNode, event, true); | |
} | |
}); | |
jQuery._data(elem, "changeBubbles", true); | |
} | |
}); | |
}, | |
handle: function (event) { | |
var elem = event.target; | |
if (this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox")) { | |
return event.handleObj.handler.apply(this, arguments); | |
} | |
}, | |
teardown: function () { | |
jQuery.event.remove(this, "._change"); | |
return !rformElems.test(this.nodeName); | |
} | |
}; | |
} | |
if (!jQuery.support.focusinBubbles) { | |
jQuery.each({ | |
focus: "focusin", | |
blur: "focusout" | |
}, function (orig, fix) { | |
var attaches = 0, | |
handler = function (event) { | |
jQuery.event.simulate(fix, event.target, jQuery.event.fix(event), true); | |
}; | |
jQuery.event.special[fix] = { | |
setup: function () { | |
if (attaches++ === 0) { | |
document.addEventListener(orig, handler, true); | |
} | |
}, | |
teardown: function () { | |
if (--attaches === 0) { | |
document.removeEventListener(orig, handler, true); | |
} | |
} | |
}; | |
}); | |
} | |
jQuery.fn.extend({ | |
on: function (types, selector, data, fn, one) { | |
var type, origFn; | |
if (typeof types === "object") { | |
if (typeof selector !== "string") { | |
data = data || selector; | |
selector = undefined; | |
} | |
for (type in types) { | |
this.on(type, selector, data, types[type], one); | |
} | |
return this; | |
} | |
if (data == null && fn == null) { | |
fn = selector; | |
data = selector = undefined; | |
} else if (fn == null) { | |
if (typeof selector === "string") { | |
fn = data; | |
data = undefined; | |
} else { | |
fn = data; | |
data = selector; | |
selector = undefined; | |
} | |
} | |
if (fn === false) { | |
fn = returnFalse; | |
} else if (!fn) { | |
return this; | |
} | |
if (one === 1) { | |
origFn = fn; | |
fn = function (event) { | |
jQuery().off(event); | |
return origFn.apply(this, arguments); | |
}; | |
fn.guid = origFn.guid || (origFn.guid = jQuery.guid++); | |
} | |
return this.each(function () { | |
jQuery.event.add(this, types, fn, data, selector); | |
}); | |
}, | |
one: function (types, selector, data, fn) { | |
return this.on(types, selector, data, fn, 1); | |
}, | |
off: function (types, selector, fn) { | |
var handleObj, type; | |
if (types && types.preventDefault && types.handleObj) { | |
handleObj = types.handleObj; | |
jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler); | |
return this; | |
} | |
if (typeof types === "object") { | |
for (type in types) { | |
this.off(type, selector, types[type]); | |
} | |
return this; | |
} | |
if (selector === false || typeof selector === "function") { | |
fn = selector; | |
selector = undefined; | |
} | |
if (fn === false) { | |
fn = returnFalse; | |
} | |
return this.each(function () { | |
jQuery.event.remove(this, types, fn, selector); | |
}); | |
}, | |
bind: function (types, data, fn) { | |
return this.on(types, null, data, fn); | |
}, | |
unbind: function (types, fn) { | |
return this.off(types, null, fn); | |
}, | |
delegate: function (selector, types, data, fn) { | |
return this.on(types, selector, data, fn); | |
}, | |
undelegate: function (selector, types, fn) { | |
return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn); | |
}, | |
trigger: function (type, data) { | |
return this.each(function () { | |
jQuery.event.trigger(type, data, this); | |
}); | |
}, | |
triggerHandler: function (type, data) { | |
var elem = this[0]; | |
if (elem) { | |
return jQuery.event.trigger(type, data, elem, true); | |
} | |
} | |
}); | |
/*! | |
* Sizzle CSS Selector Engine | |
* Copyright 2012 jQuery Foundation and other contributors | |
* Released under the MIT license | |
* http://sizzlejs.com/ | |
*/ | |
(function (window, undefined) { | |
var i, cachedruns, Expr, getText, isXML, compile, hasDuplicate, outermostContext, setDocument, document, docElem, documentIsXML, rbuggyQSA, rbuggyMatches, matches, contains, sortOrder, expando = "sizzle" + -(new Date()), | |
preferredDoc = window.document, | |
support = {}, | |
dirruns = 0, | |
done = 0, | |
classCache = createCache(), | |
tokenCache = createCache(), | |
compilerCache = createCache(), | |
strundefined = typeof undefined, | |
MAX_NEGATIVE = 1 << 31, | |
arr = [], | |
pop = arr.pop, | |
push = arr.push, | |
slice = arr.slice, | |
indexOf = arr.indexOf || function (elem) { | |
var i = 0, | |
len = this.length; | |
for (; i < len; i++) { | |
if (this[i] === elem) { | |
return i; | |
} | |
} | |
return -1; | |
}, | |
whitespace = "[\\x20\\t\\r\\n\\f]", | |
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", | |
identifier = characterEncoding.replace("w", "w#"), | |
operators = "([*^$|!~]?=)", | |
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + | |
"*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", | |
pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace(3, 8) + ")*)|.*)\\)|)", | |
rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"), | |
rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), | |
rcombinators = new RegExp("^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*"), | |
rpseudo = new RegExp(pseudos), | |
ridentifier = new RegExp("^" + identifier + "$"), | |
matchExpr = { | |
"ID": new RegExp("^#(" + characterEncoding + ")"), | |
"CLASS": new RegExp("^\\.(" + characterEncoding + ")"), | |
"NAME": new RegExp("^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]"), | |
"TAG": new RegExp("^(" + characterEncoding.replace("w", "w*") + ")"), | |
"ATTR": new RegExp("^" + attributes), | |
"PSEUDO": new RegExp("^" + pseudos), | |
"CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + | |
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + | |
"*(\\d+)|))" + whitespace + "*\\)|)", "i"), | |
"needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + | |
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i") | |
}, | |
rsibling = /[\x20\t\r\n\f]*[+~]/, | |
rnative = /^[^{]+\{\s*\[native code/, | |
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, | |
rinputs = /^(?:input|select|textarea|button)$/i, | |
rheader = /^h\d$/i, | |
rescape = /'|\\/g, | |
rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, | |
runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g, | |
funescape = function (_, escaped) { | |
var high = "0x" + escaped - 0x10000; | |
return high !== high ? escaped : high < 0 ? String.fromCharCode(high + 0x10000) : String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00); | |
}; | |
try { | |
slice.call(preferredDoc.documentElement.childNodes, 0)[0].nodeType; | |
} catch (e) { | |
slice = function (i) { | |
var elem, results = []; | |
while ((elem = this[i++])) { | |
results.push(elem); | |
} | |
return results; | |
}; | |
} | |
function isNative(fn) { | |
return rnative.test(fn + ""); | |
} | |
function createCache() { | |
var cache, keys = []; | |
return (cache = function (key, value) { | |
if (keys.push(key += " ") > Expr.cacheLength) { | |
delete cache[keys.shift()]; | |
} | |
return (cache[key] = value); | |
}); | |
} | |
function markFunction(fn) { | |
fn[expando] = true; | |
return fn; | |
} | |
function assert(fn) { | |
var div = document.createElement("div"); | |
try { | |
return fn(div); | |
} catch (e) { | |
return false; | |
} finally { | |
div = null; | |
} | |
} | |
function Sizzle(selector, context, results, seed) { | |
var match, elem, m, nodeType, i, groups, old, nid, newContext, newSelector; | |
if ((context ? context.ownerDocument || context : preferredDoc) !== document) { | |
setDocument(context); | |
} | |
context = context || document; | |
results = results || []; | |
if (!selector || typeof selector !== "string") { | |
return results; | |
} | |
if ((nodeType = context.nodeType) !== 1 && nodeType !== 9) { | |
return []; | |
} | |
if (!documentIsXML && !seed) { | |
if ((match = rquickExpr.exec(selector))) { | |
if ((m = match[1])) { | |
if (nodeType === 9) { | |
elem = context.getElementById(m); | |
if (elem && elem.parentNode) { | |
if (elem.id === m) { | |
results.push(elem); | |
return results; | |
} | |
} else { | |
return results; | |
} | |
} else { | |
if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) && contains(context, elem) && elem.id === m) { | |
results.push(elem); | |
return results; | |
} | |
} | |
} else if (match[2]) { | |
push.apply(results, slice.call(context.getElementsByTagName(selector), 0)); | |
return results; | |
} else if ((m = match[3]) && support.getByClassName && context.getElementsByClassName) { | |
push.apply(results, slice.call(context.getElementsByClassName(m), 0)); | |
return results; | |
} | |
} | |
if (support.qsa && !rbuggyQSA.test(selector)) { | |
old = true; | |
nid = expando; | |
newContext = context; | |
newSelector = nodeType === 9 && selector; | |
if (nodeType === 1 && context.nodeName.toLowerCase() !== "object") { | |
groups = tokenize(selector); | |
if ((old = context.getAttribute("id"))) { | |
nid = old.replace(rescape, "\\$&"); | |
} else { | |
context.setAttribute("id", nid); | |
} | |
nid = "[id='" + nid + "'] "; | |
i = groups.length; | |
while (i--) { | |
groups[i] = nid + toSelector(groups[i]); | |
} | |
newContext = rsibling.test(selector) && context.parentNode || context; | |
newSelector = groups.join(","); | |
} | |
if (newSelector) { | |
try { | |
push.apply(results, slice.call(newContext.querySelectorAll(newSelector), 0)); | |
return results; | |
} catch (qsaError) {} finally { | |
if (!old) { | |
context.removeAttribute("id"); | |
} | |
} | |
} | |
} | |
} | |
return select(selector.replace(rtrim, "$1"), context, results, seed); | |
} | |
isXML = Sizzle.isXML = function (elem) { | |
var documentElement = elem && (elem.ownerDocument || elem).documentElement; | |
return documentElement ? documentElement.nodeName !== "HTML" : false; | |
}; | |
setDocument = Sizzle.setDocument = function (node) { | |
var doc = node ? node.ownerDocument || node : preferredDoc; | |
if (doc === document || doc.nodeType !== 9 || !doc.documentElement) { | |
return document; | |
} | |
document = doc; | |
docElem = doc.documentElement; | |
documentIsXML = isXML(doc); | |
support.tagNameNoComments = assert(function (div) { | |
div.appendChild(doc.createComment("")); | |
return !div.getElementsByTagName("*").length; | |
}); | |
support.attributes = assert(function (div) { | |
div.innerHTML = "<select></select>"; | |
var type = typeof div.lastChild.getAttribute("multiple"); | |
return type !== "boolean" && type !== "string"; | |
}); | |
support.getByClassName = assert(function (div) { | |
div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>"; | |
if (!div.getElementsByClassName || !div.getElementsByClassName("e").length) { | |
return false; | |
} | |
div.lastChild.className = "e"; | |
return div.getElementsByClassName("e").length === 2; | |
}); | |
support.getByName = assert(function (div) { | |
div.id = expando + 0; | |
div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>"; | |
docElem.insertBefore(div, docElem.firstChild); | |
var pass = doc.getElementsByName && doc.getElementsByName(expando).length === 2 + | |
doc.getElementsByName(expando + 0).length; | |
support.getIdNotName = !doc.getElementById(expando); | |
docElem.removeChild(div); | |
return pass; | |
}); | |
Expr.attrHandle = assert(function (div) { | |
div.innerHTML = "<a href='#'></a>"; | |
return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && div.firstChild.getAttribute("href") === "#"; | |
}) ? {} : { | |
"href": function (elem) { | |
return elem.getAttribute("href", 2); | |
}, | |
"type": function (elem) { | |
return elem.getAttribute("type"); | |
} | |
}; | |
if (support.getIdNotName) { | |
Expr.find["ID"] = function (id, context) { | |
if (typeof context.getElementById !== strundefined && !documentIsXML) { | |
var m = context.getElementById(id); | |
return m && m.parentNode ? [m] : []; | |
} | |
}; | |
Expr.filter["ID"] = function (id) { | |
var attrId = id.replace(runescape, funescape); | |
return function (elem) { | |
return elem.getAttribute("id") === attrId; | |
}; | |
}; | |
} else { | |
Expr.find["ID"] = function (id, context) { | |
if (typeof context.getElementById !== strundefined && !documentIsXML) { | |
var m = context.getElementById(id); | |
return m ? m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? [m] : undefined : []; | |
} | |
}; | |
Expr.filter["ID"] = function (id) { | |
var attrId = id.replace(runescape, funescape); | |
return function (elem) { | |
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); | |
return node && node.value === attrId; | |
}; | |
}; | |
} | |
Expr.find["TAG"] = support.tagNameNoComments ? function (tag, context) { | |
if (typeof context.getElementsByTagName !== strundefined) { | |
return context.getElementsByTagName(tag); | |
} | |
} : function (tag, context) { | |
var elem, tmp = [], | |
i = 0, | |
results = context.getElementsByTagName(tag); | |
if (tag === "*") { | |
while ((elem = results[i++])) { | |
if (elem.nodeType === 1) { | |
tmp.push(elem); | |
} | |
} | |
return tmp; | |
} | |
return results; | |
}; | |
Expr.find["NAME"] = support.getByName && function (tag, context) { | |
if (typeof context.getElementsByName !== strundefined) { | |
return context.getElementsByName(name); | |
} | |
}; | |
Expr.find["CLASS"] = support.getByClassName && function (className, context) { | |
if (typeof context.getElementsByClassName !== strundefined && !documentIsXML) { | |
return context.getElementsByClassName(className); | |
} | |
}; | |
rbuggyMatches = []; | |
rbuggyQSA = [":focus"]; | |
if ((support.qsa = isNative(doc.querySelectorAll))) { | |
assert(function (div) { | |
div.innerHTML = "<select><option selected=''></option></select>"; | |
if (!div.querySelectorAll("[selected]").length) { | |
rbuggyQSA.push("\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)"); | |
} | |
if (!div.querySelectorAll(":checked").length) { | |
rbuggyQSA.push(":checked"); | |
} | |
}); | |
assert(function (div) { | |
div.innerHTML = "<input type='hidden' i=''/>"; | |
if (div.querySelectorAll("[i^='']").length) { | |
rbuggyQSA.push("[*^$]=" + whitespace + "*(?:\"\"|'')"); | |
} | |
if (!div.querySelectorAll(":enabled").length) { | |
rbuggyQSA.push(":enabled", ":disabled"); | |
} | |
div.querySelectorAll("*,:x"); | |
rbuggyQSA.push(",.*:"); | |
}); | |
} | |
if ((support.matchesSelector = isNative((matches = docElem.matchesSelector || docElem.mozMatchesSelector || docElem.webkitMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)))) { | |
assert(function (div) { | |
support.disconnectedMatch = matches.call(div, "div"); | |
matches.call(div, "[s!='']:x"); | |
rbuggyMatches.push("!=", pseudos); | |
}); | |
} | |
rbuggyQSA = new RegExp(rbuggyQSA.join("|")); | |
rbuggyMatches = new RegExp(rbuggyMatches.join("|")); | |
contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? function (a, b) { | |
var adown = a.nodeType === 9 ? a.documentElement : a, | |
bup = b && b.parentNode; | |
return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16)); | |
} : function (a, b) { | |
if (b) { | |
while ((b = b.parentNode)) { | |
if (b === a) { | |
return true; | |
} | |
} | |
} | |
return false; | |
}; | |
sortOrder = docElem.compareDocumentPosition ? function (a, b) { | |
var compare; | |
if (a === b) { | |
hasDuplicate = true; | |
return 0; | |
} | |
if ((compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition(b))) { | |
if (compare & 1 || a.parentNode && a.parentNode.nodeType === 11) { | |
if (a === doc || contains(preferredDoc, a)) { | |
return -1; | |
} | |
if (b === doc || contains(preferredDoc, b)) { | |
return 1; | |
} | |
return 0; | |
} | |
return compare & 4 ? -1 : 1; | |
} | |
return a.compareDocumentPosition ? -1 : 1; | |
} : function (a, b) { | |
var cur, i = 0, | |
aup = a.parentNode, | |
bup = b.parentNode, | |
ap = [a], | |
bp = [b]; | |
if (a === b) { | |
hasDuplicate = true; | |
return 0; | |
} else if (!aup || !bup) { | |
return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : 0; | |
} else if (aup === bup) { | |
return siblingCheck(a, b); | |
} | |
cur = a; | |
while ((cur = cur.parentNode)) { | |
ap.unshift(cur); | |
} | |
cur = b; | |
while ((cur = cur.parentNode)) { | |
bp.unshift(cur); | |
} | |
while (ap[i] === bp[i]) { | |
i++; | |
} | |
return i ? siblingCheck(ap[i], bp[i]) : ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0; | |
}; | |
hasDuplicate = false; | |
[0, 0].sort(sortOrder); | |
support.detectDuplicates = hasDuplicate; | |
return document; | |
}; | |
Sizzle.matches = function (expr, elements) { | |
return Sizzle(expr, null, null, elements); | |
}; | |
Sizzle.matchesSelector = function (elem, expr) { | |
if ((elem.ownerDocument || elem) !== document) { | |
setDocument(elem); | |
} | |
expr = expr.replace(rattributeQuotes, "='$1']"); | |
if (support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr)) { | |
try { | |
var ret = matches.call(elem, expr); | |
if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) { | |
return ret; | |
} | |
} catch (e) {} | |
} | |
return Sizzle(expr, document, null, [elem]).length > 0; | |
}; | |
Sizzle.contains = function (context, elem) { | |
if ((context.ownerDocument || context) !== document) { | |
setDocument(context); | |
} | |
return contains(context, elem); | |
}; | |
Sizzle.attr = function (elem, name) { | |
var val; | |
if ((elem.ownerDocument || elem) !== document) { | |
setDocument(elem); | |
} | |
if (!documentIsXML) { | |
name = name.toLowerCase(); | |
} | |
if ((val = Expr.attrHandle[name])) { | |
return val(elem); | |
} | |
if (documentIsXML || support.attributes) { | |
return elem.getAttribute(name); | |
} | |
return ((val = elem.getAttributeNode(name)) || elem.getAttribute(name)) && elem[name] === true ? name : val && val.specified ? val.value : null; | |
}; | |
Sizzle.error = function (msg) { | |
throw new Error("Syntax error, unrecognized expression: " + msg); | |
}; | |
Sizzle.uniqueSort = function (results) { | |
var elem, duplicates = [], | |
i = 1, | |
j = 0; | |
hasDuplicate = !support.detectDuplicates; | |
results.sort(sortOrder); | |
if (hasDuplicate) { | |
for (; | |
(elem = results[i]); i++) { | |
if (elem === results[i - 1]) { | |
j = duplicates.push(i); | |
} | |
} | |
while (j--) { | |
results.splice(duplicates[j], 1); | |
} | |
} | |
return results; | |
}; | |
function siblingCheck(a, b) { | |
var cur = b && a, | |
diff = cur && (~b.sourceIndex || MAX_NEGATIVE) - (~a.sourceIndex || MAX_NEGATIVE); | |
if (diff) { | |
return diff; | |
} | |
if (cur) { | |
while ((cur = cur.nextSibling)) { | |
if (cur === b) { | |
return -1; | |
} | |
} | |
} | |
return a ? 1 : -1; | |
} | |
function createInputPseudo(type) { | |
return function (elem) { | |
var name = elem.nodeName.toLowerCase(); | |
return name === "input" && elem.type === type; | |
}; | |
} | |
function createButtonPseudo(type) { | |
return function (elem) { | |
var name = elem.nodeName.toLowerCase(); | |
return (name === "input" || name === "button") && elem.type === type; | |
}; | |
} | |
function createPositionalPseudo(fn) { | |
return markFunction(function (argument) { | |
argument = +argument; | |
return markFunction(function (seed, matches) { | |
var j, matchIndexes = fn([], seed.length, argument), | |
i = matchIndexes.length; | |
while (i--) { | |
if (seed[(j = matchIndexes[i])]) { | |
seed[j] = !(matches[j] = seed[j]); | |
} | |
} | |
}); | |
}); | |
} | |
getText = Sizzle.getText = function (elem) { | |
var node, ret = "", | |
i = 0, | |
nodeType = elem.nodeType; | |
if (!nodeType) { | |
for (; | |
(node = elem[i]); i++) { | |
ret += getText(node); | |
} | |
} else if (nodeType === 1 || nodeType === 9 || nodeType === 11) { | |
if (typeof elem.textContent === "string") { | |
return elem.textContent; | |
} else { | |
for (elem = elem.firstChild; elem; elem = elem.nextSibling) { | |
ret += getText(elem); | |
} | |
} | |
} else if (nodeType === 3 || nodeType === 4) { | |
return elem.nodeValue; | |
} | |
return ret; | |
}; | |
Expr = Sizzle.selectors = { | |
cacheLength: 50, | |
createPseudo: markFunction, | |
match: matchExpr, | |
find: {}, | |
relative: { | |
">": { | |
dir: "parentNode", | |
first: true | |
}, | |
" ": { | |
dir: "parentNode" | |
}, | |
"+": { | |
dir: "previousSibling", | |
first: true | |
}, | |
"~": { | |
dir: "previousSibling" | |
} | |
}, | |
preFilter: { | |
"ATTR": function (match) { | |
match[1] = match[1].replace(runescape, funescape); | |
match[3] = (match[4] || match[5] || "").replace(runescape, funescape); | |
if (match[2] === "~=") { | |
match[3] = " " + match[3] + " "; | |
} | |
return match.slice(0, 4); | |
}, | |
"CHILD": function (match) { | |
match[1] = match[1].toLowerCase(); | |
if (match[1].slice(0, 3) === "nth") { | |
if (!match[3]) { | |
Sizzle.error(match[0]); | |
} | |
match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd")); | |
match[5] = +((match[7] + match[8]) || match[3] === "odd"); | |
} else if (match[3]) { | |
Sizzle.error(match[0]); | |
} | |
return match; | |
}, | |
"PSEUDO": function (match) { | |
var excess, unquoted = !match[5] && match[2]; | |
if (matchExpr["CHILD"].test(match[0])) { | |
return null; | |
} | |
if (match[4]) { | |
match[2] = match[4]; | |
} else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) { | |
match[0] = match[0].slice(0, excess); | |
match[2] = unquoted.slice(0, excess); | |
} | |
return match.slice(0, 3); | |
} | |
}, | |
filter: { | |
"TAG": function (nodeName) { | |
if (nodeName === "*") { | |
return function () { | |
return true; | |
}; | |
} | |
nodeName = nodeName.replace(runescape, funescape).toLowerCase(); | |
return function (elem) { | |
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; | |
}; | |
}, | |
"CLASS": function (className) { | |
var pattern = classCache[className + " "]; | |
return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function (elem) { | |
return pattern.test(elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || ""); | |
}); | |
}, | |
"ATTR": function (name, operator, check) { | |
return function (elem) { | |
var result = Sizzle.attr(elem, name); | |
if (result == null) { | |
return operator === "!="; | |
} | |
if (!operator) { | |
return true; | |
} | |
result += ""; | |
return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf(check) === 0 : operator === "*=" ? check && result.indexOf(check) > -1 : operator === "$=" ? check && result.slice(-check.length) === check : operator === "~=" ? (" " + result + " ").indexOf(check) > -1 : operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : false; | |
}; | |
}, | |
"CHILD": function (type, what, argument, first, last) { | |
var simple = type.slice(0, 3) !== "nth", | |
forward = type.slice(-4) !== "last", | |
ofType = what === "of-type"; | |
return first === 1 && last === 0 ? function (elem) { | |
return !!elem.parentNode; | |
} : function (elem, context, xml) { | |
var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", | |
parent = elem.parentNode, | |
name = ofType && elem.nodeName.toLowerCase(), | |
useCache = !xml && !ofType; | |
if (parent) { | |
if (simple) { | |
while (dir) { | |
node = elem; | |
while ((node = node[dir])) { | |
if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) { | |
return false; | |
} | |
} | |
start = dir = type === "only" && !start && "nextSibling"; | |
} | |
return true; | |
} | |
start = [forward ? parent.firstChild : parent.lastChild]; | |
if (forward && useCache) { | |
outerCache = parent[expando] || (parent[expando] = {}); | |
cache = outerCache[type] || []; | |
nodeIndex = cache[0] === dirruns && cache[1]; | |
diff = cache[0] === dirruns && cache[2]; | |
node = nodeIndex && parent.childNodes[nodeIndex]; | |
while ((node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop())) { | |
if (node.nodeType === 1 && ++diff && node === elem) { | |
outerCache[type] = [dirruns, nodeIndex, diff]; | |
break; | |
} | |
} | |
} else if (useCache && (cache = (elem[expando] || (elem[expando] = {}))[type]) && cache[0] === dirruns) { | |
diff = cache[1]; | |
} else { | |
while ((node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop())) { | |
if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) { | |
if (useCache) { | |
(node[expando] || (node[expando] = {}))[type] = [dirruns, diff]; | |
} | |
if (node === elem) { | |
break; | |
} | |
} | |
} | |
} | |
diff -= last; | |
return diff === first || (diff % first === 0 && diff / first >= 0); | |
} | |
}; | |
}, | |
"PSEUDO": function (pseudo, argument) { | |
var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo); | |
if (fn[expando]) { | |
return fn(argument); | |
} | |
if (fn.length > 1) { | |
args = [pseudo, pseudo, "", argument]; | |
return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) { | |
var idx, matched = fn(seed, argument), | |
i = matched.length; | |
while (i--) { | |
idx = indexOf.call(seed, matched[i]); | |
seed[idx] = !(matches[idx] = matched[i]); | |
} | |
}) : function (elem) { | |
return fn(elem, 0, args); | |
}; | |
} | |
return fn; | |
} | |
}, | |
pseudos: { | |
"not": markFunction(function (selector) { | |
var input = [], | |
results = [], | |
matcher = compile(selector.replace(rtrim, "$1")); | |
return matcher[expando] ? markFunction(function (seed, matches, context, xml) { | |
var elem, unmatched = matcher(seed, null, xml, []), | |
i = seed.length; | |
while (i--) { | |
if ((elem = unmatched[i])) { | |
seed[i] = !(matches[i] = elem); | |
} | |
} | |
}) : function (elem, context, xml) { | |
input[0] = elem; | |
matcher(input, null, xml, results); | |
return !results.pop(); | |
}; | |
}), | |
"has": markFunction(function (selector) { | |
return function (elem) { | |
return Sizzle(selector, elem).length > 0; | |
}; | |
}), | |
"contains": markFunction(function (text) { | |
return function (elem) { | |
return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1; | |
}; | |
}), | |
"lang": markFunction(function (lang) { | |
if (!ridentifier.test(lang || "")) { | |
Sizzle.error("unsupported lang: " + lang); | |
} | |
lang = lang.replace(runescape, funescape).toLowerCase(); | |
return function (elem) { | |
var elemLang; | |
do { | |
if ((elemLang = documentIsXML ? elem.getAttribute("xml:lang") || elem.getAttribute("lang") : elem.lang)) { | |
elemLang = elemLang.toLowerCase(); | |
return elemLang === lang || elemLang.indexOf(lang + "-") === 0; | |
} | |
} while ((elem = elem.parentNode) && elem.nodeType === 1); | |
return false; | |
}; | |
}), | |
"target": function (elem) { | |
var hash = window.location && window.location.hash; | |
return hash && hash.slice(1) === elem.id; | |
}, | |
"root": function (elem) { | |
return elem === docElem; | |
}, | |
"focus": function (elem) { | |
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); | |
}, | |
"enabled": function (elem) { | |
return elem.disabled === false; | |
}, | |
"disabled": function (elem) { | |
return elem.disabled === true; | |
}, | |
"checked": function (elem) { | |
var nodeName = elem.nodeName.toLowerCase(); | |
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); | |
}, | |
"selected": function (elem) { | |
if (elem.parentNode) { | |
elem.parentNode.selectedIndex; | |
} | |
return elem.selected === true; | |
}, | |
"empty": function (elem) { | |
for (elem = elem.firstChild; elem; elem = elem.nextSibling) { | |
if (elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4) { | |
return false; | |
} | |
} | |
return true; | |
}, | |
"parent": function (elem) { | |
return !Expr.pseudos["empty"](elem); | |
}, | |
"header": function (elem) { | |
return rheader.test(elem.nodeName); | |
}, | |
"input": function (elem) { | |
return rinputs.test(elem.nodeName); | |
}, | |
"button": function (elem) { | |
var name = elem.nodeName.toLowerCase(); | |
return name === "input" && elem.type === "button" || name === "button"; | |
}, | |
"text": function (elem) { | |
var attr; | |
return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type); | |
}, | |
"first": createPositionalPseudo(function () { | |
return [0]; | |
}), | |
"last": createPositionalPseudo(function (matchIndexes, length) { | |
return [length - 1]; | |
}), | |
"eq": createPositionalPseudo(function (matchIndexes, length, argument) { | |
return [argument < 0 ? argument + length : argument]; | |
}), | |
"even": createPositionalPseudo(function (matchIndexes, length) { | |
var i = 0; | |
for (; i < length; i += 2) { | |
matchIndexes.push(i); | |
} | |
return matchIndexes; | |
}), | |
"odd": createPositionalPseudo(function (matchIndexes, length) { | |
var i = 1; | |
for (; i < length; i += 2) { | |
matchIndexes.push(i); | |
} | |
return matchIndexes; | |
}), | |
"lt": createPositionalPseudo(function (matchIndexes, length, argument) { | |
var i = argument < 0 ? argument + length : argument; | |
for (; --i >= 0;) { | |
matchIndexes.push(i); | |
} | |
return matchIndexes; | |
}), | |
"gt": createPositionalPseudo(function (matchIndexes, length, argument) { | |
var i = argument < 0 ? argument + length : argument; | |
for (; ++i < length;) { | |
matchIndexes.push(i); | |
} | |
return matchIndexes; | |
}) | |
} | |
}; | |
for (i in { | |
radio: true, | |
checkbox: true, | |
file: true, | |
password: true, | |
image: true | |
}) { | |
Expr.pseudos[i] = createInputPseudo(i); | |
} | |
for (i in { | |
submit: true, | |
reset: true | |
}) { | |
Expr.pseudos[i] = createButtonPseudo(i); | |
} | |
function tokenize(selector, parseOnly) { | |
var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + " "]; | |
if (cached) { | |
return parseOnly ? 0 : cached.slice(0); | |
} | |
soFar = selector; | |
groups = []; | |
preFilters = Expr.preFilter; | |
while (soFar) { | |
if (!matched || (match = rcomma.exec(soFar))) { | |
if (match) { | |
soFar = soFar.slice(match[0].length) || soFar; | |
} | |
groups.push(tokens = []); | |
} | |
matched = false; | |
if ((match = rcombinators.exec(soFar))) { | |
matched = match.shift(); | |
tokens.push({ | |
value: matched, | |
type: match[0].replace(rtrim, " ") | |
}); | |
soFar = soFar.slice(matched.length); | |
} | |
for (type in Expr.filter) { | |
if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) { | |
matched = match.shift(); | |
tokens.push({ | |
value: matched, | |
type: type, | |
matches: match | |
}); | |
soFar = soFar.slice(matched.length); | |
} | |
} | |
if (!matched) { | |
break; | |
} | |
} | |
return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : tokenCache(selector, groups).slice(0); | |
} | |
function toSelector(tokens) { | |
var i = 0, | |
len = tokens.length, | |
selector = ""; | |
for (; i < len; i++) { | |
selector += tokens[i].value; | |
} | |
return selector; | |
} | |
function addCombinator(matcher, combinator, base) { | |
var dir = combinator.dir, | |
checkNonElements = base && dir === "parentNode", | |
doneName = done++; | |
return combinator.first ? function (elem, context, xml) { | |
while ((elem = elem[dir])) { | |
if (elem.nodeType === 1 || checkNonElements) { | |
return matcher(elem, context, xml); | |
} | |
} | |
} : function (elem, context, xml) { | |
var data, cache, outerCache, dirkey = dirruns + " " + doneName; | |
if (xml) { | |
while ((elem = elem[dir])) { | |
if (elem.nodeType === 1 || checkNonElements) { | |
if (matcher(elem, context, xml)) { | |
return true; | |
} | |
} | |
} | |
} else { | |
while ((elem = elem[dir])) { | |
if (elem.nodeType === 1 || checkNonElements) { | |
outerCache = elem[expando] || (elem[expando] = {}); | |
if ((cache = outerCache[dir]) && cache[0] === dirkey) { | |
if ((data = cache[1]) === true || data === cachedruns) { | |
return data === true; | |
} | |
} else { | |
cache = outerCache[dir] = [dirkey]; | |
cache[1] = matcher(elem, context, xml) || cachedruns; | |
if (cache[1] === true) { | |
return true; | |
} | |
} | |
} | |
} | |
} | |
}; | |
} | |
function elementMatcher(matchers) { | |
return matchers.length > 1 ? function (elem, context, xml) { | |
var i = matchers.length; | |
while (i--) { | |
if (!matchers[i](elem, context, xml)) { | |
return false; | |
} | |
} | |
return true; | |
} : matchers[0]; | |
} | |
function condense(unmatched, map, filter, context, xml) { | |
var elem, newUnmatched = [], | |
i = 0, | |
len = unmatched.length, | |
mapped = map != null; | |
for (; i < len; i++) { | |
if ((elem = unmatched[i])) { | |
if (!filter || filter(elem, context, xml)) { | |
newUnmatched.push(elem); | |
if (mapped) { | |
map.push(i); | |
} | |
} | |
} | |
} | |
return newUnmatched; | |
} | |
function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) { | |
if (postFilter && !postFilter[expando]) { | |
postFilter = setMatcher(postFilter); | |
} | |
if (postFinder && !postFinder[expando]) { | |
postFinder = setMatcher(postFinder, postSelector); | |
} | |
return markFunction(function (seed, results, context, xml) { | |
var temp, i, elem, preMap = [], | |
postMap = [], | |
preexisting = results.length, | |
elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []), | |
matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems, | |
matcherOut = matcher ? postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results : matcherIn; | |
if (matcher) { | |
matcher(matcherIn, matcherOut, context, xml); | |
} | |
if (postFilter) { | |
temp = condense(matcherOut, postMap); | |
postFilter(temp, [], context, xml); | |
i = temp.length; | |
while (i--) { | |
if ((elem = temp[i])) { | |
matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem); | |
} | |
} | |
} | |
if (seed) { | |
if (postFinder || preFilter) { | |
if (postFinder) { | |
temp = []; | |
i = matcherOut.length; | |
while (i--) { | |
if ((elem = matcherOut[i])) { | |
temp.push((matcherIn[i] = elem)); | |
} | |
} | |
postFinder(null, (matcherOut = []), temp, xml); | |
} | |
i = matcherOut.length; | |
while (i--) { | |
if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf.call(seed, elem) : preMap[i]) > -1) { | |
seed[temp] = !(results[temp] = elem); | |
} | |
} | |
} | |
} else { | |
matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut); | |
if (postFinder) { | |
postFinder(null, results, matcherOut, xml); | |
} else { | |
push.apply(results, matcherOut); | |
} | |
} | |
}); | |
} | |
function matcherFromTokens(tokens) { | |
var checkContext, matcher, j, len = tokens.length, | |
leadingRelative = Expr.relative[tokens[0].type], | |
implicitRelative = leadingRelative || Expr.relative[" "], | |
i = leadingRelative ? 1 : 0, | |
matchContext = addCombinator(function (elem) { | |
return elem === checkContext; | |
}, implicitRelative, true), | |
matchAnyContext = addCombinator(function (elem) { | |
return indexOf.call(checkContext, elem) > -1; | |
}, implicitRelative, true), | |
matchers = [ | |
function (elem, context, xml) { | |
return (!leadingRelative && (xml || context !== outermostContext)) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml)); | |
} | |
]; | |
for (; i < len; i++) { | |
if ((matcher = Expr.relative[tokens[i].type])) { | |
matchers = [addCombinator(elementMatcher(matchers), matcher)]; | |
} else { | |
matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches); | |
if (matcher[expando]) { | |
j = ++i; | |
for (; j < len; j++) { | |
if (Expr.relative[tokens[j].type]) { | |
break; | |
} | |
} | |
return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(tokens.slice(0, i - 1)).replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens((tokens = tokens.slice(j))), j < len && toSelector(tokens)); | |
} | |
matchers.push(matcher); | |
} | |
} | |
return elementMatcher(matchers); | |
} | |
function matcherFromGroupMatchers(elementMatchers, setMatchers) { | |
var matcherCachedRuns = 0, | |
bySet = setMatchers.length > 0, | |
byElement = elementMatchers.length > 0, | |
superMatcher = function (seed, context, xml, results, expandContext) { | |
var elem, j, matcher, setMatched = [], | |
matchedCount = 0, | |
i = "0", | |
unmatched = seed && [], | |
outermost = expandContext != null, | |
contextBackup = outermostContext, | |
elems = seed || byElement && Expr.find["TAG"]("*", expandContext && context.parentNode || context), | |
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); | |
if (outermost) { | |
outermostContext = context !== document && context; | |
cachedruns = matcherCachedRuns; | |
} | |
for (; | |
(elem = elems[i]) != null; i++) { | |
if (byElement && elem) { | |
j = 0; | |
while ((matcher = elementMatchers[j++])) { | |
if (matcher(elem, context, xml)) { | |
results.push(elem); | |
break; | |
} | |
} | |
if (outermost) { | |
dirruns = dirrunsUnique; | |
cachedruns = ++matcherCachedRuns; | |
} | |
} | |
if (bySet) { | |
if ((elem = !matcher && elem)) { | |
matchedCount--; | |
} | |
if (seed) { | |
unmatched.push(elem); | |
} | |
} | |
} | |
matchedCount += i; | |
if (bySet && i !== matchedCount) { | |
j = 0; | |
while ((matcher = setMatchers[j++])) { | |
matcher(unmatched, setMatched, context, xml); | |
} | |
if (seed) { | |
if (matchedCount > 0) { | |
while (i--) { | |
if (!(unmatched[i] || setMatched[i])) { | |
setMatched[i] = pop.call(results); | |
} | |
} | |
} | |
setMatched = condense(setMatched); | |
} | |
push.apply(results, setMatched); | |
if (outermost && !seed && setMatched.length > 0 && (matchedCount + setMatchers.length) > 1) { | |
Sizzle.uniqueSort(results); | |
} | |
} | |
if (outermost) { | |
dirruns = dirrunsUnique; | |
outermostContext = contextBackup; | |
} | |
return unmatched; | |
}; | |
return bySet ? markFunction(superMatcher) : superMatcher; | |
} | |
compile = Sizzle.compile = function (selector, group) { | |
var i, setMatchers = [], | |
elementMatchers = [], | |
cached = compilerCache[selector + " "]; | |
if (!cached) { | |
if (!group) { | |
group = tokenize(selector); | |
} | |
i = group.length; | |
while (i--) { | |
cached = matcherFromTokens(group[i]); | |
if (cached[expando]) { | |
setMatchers.push(cached); | |
} else { | |
elementMatchers.push(cached); | |
} | |
} | |
cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers)); | |
} | |
return cached; | |
}; | |
function multipleContexts(selector, contexts, results) { | |
var i = 0, | |
len = contexts.length; | |
for (; i < len; i++) { | |
Sizzle(selector, contexts[i], results); | |
} | |
return results; | |
} | |
function select(selector, context, results, seed) { | |
var i, tokens, token, type, find, match = tokenize(selector); | |
if (!seed) { | |
if (match.length === 1) { | |
tokens = match[0] = match[0].slice(0); | |
if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && !documentIsXML && Expr.relative[tokens[1].type]) { | |
context = Expr.find["ID"](token.matches[0].replace(runescape, funescape), context)[0]; | |
if (!context) { | |
return results; | |
} | |
selector = selector.slice(tokens.shift().value.length); | |
} | |
i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length; | |
while (i--) { | |
token = tokens[i]; | |
if (Expr.relative[(type = token.type)]) { | |
break; | |
} | |
if ((find = Expr.find[type])) { | |
if ((seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && context.parentNode || context))) { | |
tokens.splice(i, 1); | |
selector = seed.length && toSelector(tokens); | |
if (!selector) { | |
push.apply(results, slice.call(seed, 0)); | |
return results; | |
} | |
break; | |
} | |
} | |
} | |
} | |
} | |
compile(selector, match)(seed, context, documentIsXML, results, rsibling.test(selector)); | |
return results; | |
} | |
Expr.pseudos["nth"] = Expr.pseudos["eq"]; | |
function setFilters() {} | |
Expr.filters = setFilters.prototype = Expr.pseudos; | |
Expr.setFilters = new setFilters(); | |
setDocument(); | |
Sizzle.attr = jQuery.attr; | |
jQuery.find = Sizzle; | |
jQuery.expr = Sizzle.selectors; | |
jQuery.expr[":"] = jQuery.expr.pseudos; | |
jQuery.unique = Sizzle.uniqueSort; | |
jQuery.text = Sizzle.getText; | |
jQuery.isXMLDoc = Sizzle.isXML; | |
jQuery.contains = Sizzle.contains; | |
})(window); | |
var runtil = /Until$/, | |
rparentsprev = /^(?:parents|prev(?:Until|All))/, | |
isSimple = /^.[^:#\[\.,]*$/, | |
rneedsContext = jQuery.expr.match.needsContext, | |
guaranteedUnique = { | |
children: true, | |
contents: true, | |
next: true, | |
prev: true | |
}; | |
jQuery.fn.extend({ | |
find: function (selector) { | |
var i, ret, self, len = this.length; | |
if (typeof selector !== "string") { | |
self = this; | |
return this.pushStack(jQuery(selector).filter(function () { | |
for (i = 0; i < len; i++) { | |
if (jQuery.contains(self[i], this)) { | |
return true; | |
} | |
} | |
})); | |
} | |
ret = []; | |
for (i = 0; i < len; i++) { | |
jQuery.find(selector, this[i], ret); | |
} | |
ret = this.pushStack(len > 1 ? jQuery.unique(ret) : ret); | |
ret.selector = (this.selector ? this.selector + " " : "") + selector; | |
return ret; | |
}, | |
has: function (target) { | |
var i, targets = jQuery(target, this), | |
len = targets.length; | |
return this.filter(function () { | |
for (i = 0; i < len; i++) { | |
if (jQuery.contains(this, targets[i])) { | |
return true; | |
} | |
} | |
}); | |
}, | |
not: function (selector) { | |
return this.pushStack(winnow(this, selector, false)); | |
}, | |
filter: function (selector) { | |
return this.pushStack(winnow(this, selector, true)); | |
}, | |
is: function (selector) { | |
return !!selector && (typeof selector === "string" ? rneedsContext.test(selector) ? jQuery(selector, this.context).index(this[0]) >= 0 : jQuery.filter(selector, this).length > 0 : this.filter(selector).length > 0); | |
}, | |
closest: function (selectors, context) { | |
var cur, i = 0, | |
l = this.length, | |
ret = [], | |
pos = rneedsContext.test(selectors) || typeof selectors !== "string" ? jQuery(selectors, context || this.context) : 0; | |
for (; i < l; i++) { | |
cur = this[i]; | |
while (cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11) { | |
if (pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors)) { | |
ret.push(cur); | |
break; | |
} | |
cur = cur.parentNode; | |
} | |
} | |
return this.pushStack(ret.length > 1 ? jQuery.unique(ret) : ret); | |
}, | |
index: function (elem) { | |
if (!elem) { | |
return (this[0] && this[0].parentNode) ? this.first().prevAll().length : -1; | |
} | |
if (typeof elem === "string") { | |
return jQuery.inArray(this[0], jQuery(elem)); | |
} | |
return jQuery.inArray(elem.jquery ? elem[0] : elem, this); | |
}, | |
add: function (selector, context) { | |
var set = typeof selector === "string" ? jQuery(selector, context) : jQuery.makeArray(selector && selector.nodeType ? [selector] : selector), all = jQuery.merge(this.get(), set); | |
return this.pushStack(jQuery.unique(all)); | |
}, | |
addBack: function (selector) { | |
return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector)); | |
} | |
}); | |
jQuery.fn.andSelf = jQuery.fn.addBack; | |
function sibling(cur, dir) { | |
do { | |
cur = cur[dir]; | |
} while (cur && cur.nodeType !== 1); | |
return cur; | |
} | |
jQuery.each({ | |
parent: function (elem) { | |
var parent = elem.parentNode; | |
return parent && parent.nodeType !== 11 ? parent : null; | |
}, | |
parents: function (elem) { | |
return jQuery.dir(elem, "parentNode"); | |
}, | |
parentsUntil: function (elem, i, until) { | |
return jQuery.dir(elem, "parentNode", until); | |
}, | |
next: function (elem) { | |
return sibling(elem, "nextSibling"); | |
}, | |
prev: function (elem) { | |
return sibling(elem, "previousSibling"); | |
}, | |
nextAll: function (elem) { | |
return jQuery.dir(elem, "nextSibling"); | |
}, | |
prevAll: function (elem) { | |
return jQuery.dir(elem, "previousSibling"); | |
}, | |
nextUntil: function (elem, i, until) { | |
return jQuery.dir(elem, "nextSibling", until); | |
}, | |
prevUntil: function (elem, i, until) { | |
return jQuery.dir(elem, "previousSibling", until); | |
}, | |
siblings: function (elem) { | |
return jQuery.sibling((elem.parentNode || {}).firstChild, elem); | |
}, | |
children: function (elem) { | |
return jQuery.sibling(elem.firstChild); | |
}, | |
contents: function (elem) { | |
return jQuery.nodeName(elem, "iframe") ? elem.contentDocument || elem.contentWindow.document : jQuery.merge([], elem.childNodes); | |
} | |
}, function (name, fn) { | |
jQuery.fn[name] = function (until, selector) { | |
var ret = jQuery.map(this, fn, until); | |
if (!runtil.test(name)) { | |
selector = until; | |
} | |
if (selector && typeof selector === "string") { | |
ret = jQuery.filter(selector, ret); | |
} | |
ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret; | |
if (this.length > 1 && rparentsprev.test(name)) { | |
ret = ret.reverse(); | |
} | |
return this.pushStack(ret); | |
}; | |
}); | |
jQuery.extend({ | |
filter: function (expr, elems, not) { | |
if (not) { | |
expr = ":not(" + expr + ")"; | |
} | |
return elems.length === 1 ? jQuery.find.matchesSelector(elems[0], expr) ? [elems[0]] : [] : jQuery.find.matches(expr, elems); | |
}, | |
dir: function (elem, dir, until) { | |
var matched = [], | |
cur = elem[dir]; | |
while (cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery(cur).is(until))) { | |
if (cur.nodeType === 1) { | |
matched.push(cur); | |
} | |
cur = cur[dir]; | |
} | |
return matched; | |
}, | |
sibling: function (n, elem) { | |
var r = []; | |
for (; n; n = n.nextSibling) { | |
if (n.nodeType === 1 && n !== elem) { | |
r.push(n); | |
} | |
} | |
return r; | |
} | |
}); | |
function winnow(elements, qualifier, keep) { | |
qualifier = qualifier || 0; | |
if (jQuery.isFunction(qualifier)) { | |
return jQuery.grep(elements, function (elem, i) { | |
var retVal = !!qualifier.call(elem, i, elem); | |
return retVal === keep; | |
}); | |
} else if (qualifier.nodeType) { | |
return jQuery.grep(elements, function (elem) { | |
return (elem === qualifier) === keep; | |
}); | |
} else if (typeof qualifier === "string") { | |
var filtered = jQuery.grep(elements, function (elem) { | |
return elem.nodeType === 1; | |
}); | |
if (isSimple.test(qualifier)) { | |
return jQuery.filter(qualifier, filtered, !keep); | |
} else { | |
qualifier = jQuery.filter(qualifier, filtered); | |
} | |
} | |
return jQuery.grep(elements, function (elem) { | |
return (jQuery.inArray(elem, qualifier) >= 0) === keep; | |
}); | |
} | |
function createSafeFragment(document) { | |
var list = nodeNames.split("|"), | |
safeFrag = document.createDocumentFragment(); | |
if (safeFrag.createElement) { | |
while (list.length) { | |
safeFrag.createElement(list.pop()); | |
} | |
} | |
return safeFrag; | |
} | |
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + | |
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", | |
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, | |
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), | |
rleadingWhitespace = /^\s+/, | |
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, | |
rtagName = /<([\w:]+)/, | |
rtbody = /<tbody/i, | |
rhtml = /<|&#?\w+;/, | |
rnoInnerhtml = /<(?:script|style|link)/i, | |
manipulation_rcheckableType = /^(?:checkbox|radio)$/i, | |
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, | |
rscriptType = /^$|\/(?:java|ecma)script/i, | |
rscriptTypeMasked = /^true\/(.*)/, | |
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, | |
wrapMap = { | |
option: [1, "<select multiple='multiple'>", "</select>"], | |
legend: [1, "<fieldset>", "</fieldset>"], | |
area: [1, "<map>", "</map>"], | |
param: [1, "<object>", "</object>"], | |
thead: [1, "<table>", "</table>"], | |
tr: [2, "<table><tbody>", "</tbody></table>"], | |
col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"], | |
td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], | |
_default: jQuery.support.htmlSerialize ? [0, "", ""] : [1, "X<div>", "</div>"] | |
}, | |
safeFragment = createSafeFragment(document), | |
fragmentDiv = safeFragment.appendChild(document.createElement("div")); | |
wrapMap.optgroup = wrapMap.option; | |
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; | |
wrapMap.th = wrapMap.td; | |
jQuery.fn.extend({ | |
text: function (value) { | |
return jQuery.access(this, function (value) { | |
return value === undefined ? jQuery.text(this) : this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(value)); | |
}, null, value, arguments.length); | |
}, | |
wrapAll: function (html) { | |
if (jQuery.isFunction(html)) { | |
return this.each(function (i) { | |
jQuery(this).wrapAll(html.call(this, i)); | |
}); | |
} | |
if (this[0]) { | |
var wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true); | |
if (this[0].parentNode) { | |
wrap.insertBefore(this[0]); | |
} | |
wrap.map(function () { | |
var elem = this; | |
while (elem.firstChild && elem.firstChild.nodeType === 1) { | |
elem = elem.firstChild; | |
} | |
return elem; | |
}).append(this); | |
} | |
return this; | |
}, | |
wrapInner: function (html) { | |
if (jQuery.isFunction(html)) { | |
return this.each(function (i) { | |
jQuery(this).wrapInner(html.call(this, i)); | |
}); | |
} | |
return this.each(function () { | |
var self = jQuery(this), | |
contents = self.contents(); | |
if (contents.length) { | |
contents.wrapAll(html); | |
} else { | |
self.append(html); | |
} | |
}); | |
}, | |
wrap: function (html) { | |
var isFunction = jQuery.isFunction(html); | |
return this.each(function (i) { | |
jQuery(this).wrapAll(isFunction ? html.call(this, i) : html); | |
}); | |
}, | |
unwrap: function () { | |
return this.parent().each(function () { | |
if (!jQuery.nodeName(this, "body")) { | |
jQuery(this).replaceWith(this.childNodes); | |
} | |
}).end(); | |
}, | |
append: function () { | |
return this.domManip(arguments, true, function (elem) { | |
if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { | |
this.appendChild(elem); | |
} | |
}); | |
}, | |
prepend: function () { | |
return this.domManip(arguments, true, function (elem) { | |
if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { | |
this.insertBefore(elem, this.firstChild); | |
} | |
}); | |
}, | |
before: function () { | |
return this.domManip(arguments, false, function (elem) { | |
if (this.parentNode) { | |
this.parentNode.insertBefore(elem, this); | |
} | |
}); | |
}, | |
after: function () { | |
return this.domManip(arguments, false, function (elem) { | |
if (this.parentNode) { | |
this.parentNode.insertBefore(elem, this.nextSibling); | |
} | |
}); | |
}, | |
remove: function (selector, keepData) { | |
var elem, i = 0; | |
for (; | |
(elem = this[i]) != null; i++) { | |
if (!selector || jQuery.filter(selector, [elem]).length > 0) { | |
if (!keepData && elem.nodeType === 1) { | |
jQuery.cleanData(getAll(elem)); | |
} | |
if (elem.parentNode) { | |
if (keepData && jQuery.contains(elem.ownerDocument, elem)) { | |
setGlobalEval(getAll(elem, "script")); | |
} | |
elem.parentNode.removeChild(elem); | |
} | |
} | |
} | |
return this; | |
}, | |
empty: function () { | |
var elem, i = 0; | |
for (; | |
(elem = this[i]) != null; i++) { | |
if (elem.nodeType === 1) { | |
jQuery.cleanData(getAll(elem, false)); | |
} | |
while (elem.firstChild) { | |
elem.removeChild(elem.firstChild); | |
} | |
if (elem.options && jQuery.nodeName(elem, "select")) { | |
elem.options.length = 0; | |
} | |
} | |
return this; | |
}, | |
clone: function (dataAndEvents, deepDataAndEvents) { | |
dataAndEvents = dataAndEvents == null ? false : dataAndEvents; | |
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; | |
return this.map(function () { | |
return jQuery.clone(this, dataAndEvents, deepDataAndEvents); | |
}); | |
}, | |
html: function (value) { | |
return jQuery.access(this, function (value) { | |
var elem = this[0] || {}, | |
i = 0, | |
l = this.length; | |
if (value === undefined) { | |
return elem.nodeType === 1 ? elem.innerHTML.replace(rinlinejQuery, "") : undefined; | |
} | |
if (typeof value === "string" && !rnoInnerhtml.test(value) && (jQuery.support.htmlSerialize || !rnoshimcache.test(value)) && (jQuery.support.leadingWhitespace || !rleadingWhitespace.test(value)) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) { | |
value = value.replace(rxhtmlTag, "<$1></$2>"); | |
try { | |
for (; i < l; i++) { | |
elem = this[i] || {}; | |
if (elem.nodeType === 1) { | |
jQuery.cleanData(getAll(elem, false)); | |
elem.innerHTML = value; | |
} | |
} | |
elem = 0; | |
} catch (e) {} | |
} | |
if (elem) { | |
this.empty().append(value); | |
} | |
}, null, value, arguments.length); | |
}, | |
replaceWith: function (value) { | |
var isFunc = jQuery.isFunction(value); | |
if (!isFunc && typeof value !== "string") { | |
value = jQuery(value).not(this).detach(); | |
} | |
return this.domManip([value], true, function (elem) { | |
var next = this.nextSibling, | |
parent = this.parentNode; | |
if (parent) { | |
jQuery(this).remove(); | |
parent.insertBefore(elem, next); | |
} | |
}); | |
}, | |
detach: function (selector) { | |
return this.remove(selector, true); | |
}, | |
domManip: function (args, table, callback) { | |
args = core_concat.apply([], args); | |
var first, node, hasScripts, scripts, doc, fragment, i = 0, | |
l = this.length, | |
set = this, | |
iNoClone = l - 1, | |
value = args[0], | |
isFunction = jQuery.isFunction(value); | |
if (isFunction || !(l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test(value))) { | |
return this.each(function (index) { | |
var self = set.eq(index); | |
if (isFunction) { | |
args[0] = value.call(this, index, table ? self.html() : undefined); | |
} | |
self.domManip(args, table, callback); | |
}); | |
} | |
if (l) { | |
fragment = jQuery.buildFragment(args, this[0].ownerDocument, false, this); | |
first = fragment.firstChild; | |
if (fragment.childNodes.length === 1) { | |
fragment = first; | |
} | |
if (first) { | |
table = table && jQuery.nodeName(first, "tr"); | |
scripts = jQuery.map(getAll(fragment, "script"), disableScript); | |
hasScripts = scripts.length; | |
for (; i < l; i++) { | |
node = fragment; | |
if (i !== iNoClone) { | |
node = jQuery.clone(node, true, true); | |
if (hasScripts) { | |
jQuery.merge(scripts, getAll(node, "script")); | |
} | |
} | |
callback.call(table && jQuery.nodeName(this[i], "table") ? findOrAppend(this[i], "tbody") : this[i], node, i); | |
} | |
if (hasScripts) { | |
doc = scripts[scripts.length - 1].ownerDocument; | |
jQuery.map(scripts, restoreScript); | |
for (i = 0; i < hasScripts; i++) { | |
node = scripts[i]; | |
if (rscriptType.test(node.type || "") && !jQuery._data(node, "globalEval") && jQuery.contains(doc, node)) { | |
if (node.src) { | |
jQuery.ajax({ | |
url: node.src, | |
type: "GET", | |
dataType: "script", | |
async: false, | |
global: false, | |
"throws": true | |
}); | |
} else { | |
jQuery.globalEval((node.text || node.textContent || node.innerHTML || "").replace(rcleanScript, "")); | |
} | |
} | |
} | |
} | |
fragment = first = null; | |
} | |
} | |
return this; | |
} | |
}); | |
function findOrAppend(elem, tag) { | |
return elem.getElementsByTagName(tag)[0] || elem.appendChild(elem.ownerDocument.createElement(tag)); | |
} | |
function disableScript(elem) { | |
var attr = elem.getAttributeNode("type"); | |
elem.type = (attr && attr.specified) + "/" + elem.type; | |
return elem; | |
} | |
function restoreScript(elem) { | |
var match = rscriptTypeMasked.exec(elem.type); | |
if (match) { | |
elem.type = match[1]; | |
} else { | |
elem.removeAttribute("type"); | |
} | |
return elem; | |
} | |
function setGlobalEval(elems, refElements) { | |
var elem, i = 0; | |
for (; | |
(elem = elems[i]) != null; i++) { | |
jQuery._data(elem, "globalEval", !refElements || jQuery._data(refElements[i], "globalEval")); | |
} | |
} | |
function cloneCopyEvent(src, dest) { | |
if (dest.nodeType !== 1 || !jQuery.hasData(src)) { | |
return; | |
} | |
var type, i, l, oldData = jQuery._data(src), | |
curData = jQuery._data(dest, oldData), | |
events = oldData.events; | |
if (events) { | |
delete curData.handle; | |
curData.events = {}; | |
for (type in events) { | |
for (i = 0, l = events[type].length; i < l; i++) { | |
jQuery.event.add(dest, type, events[type][i]); | |
} | |
} | |
} | |
if (curData.data) { | |
curData.data = jQuery.extend({}, curData.data); | |
} | |
} | |
function fixCloneNodeIssues(src, dest) { | |
var nodeName, e, data; | |
if (dest.nodeType !== 1) { | |
return; | |
} | |
nodeName = dest.nodeName.toLowerCase(); | |
if (!jQuery.support.noCloneEvent && dest[jQuery.expando]) { | |
data = jQuery._data(dest); | |
for (e in data.events) { | |
jQuery.removeEvent(dest, e, data.handle); | |
} | |
dest.removeAttribute(jQuery.expando); | |
} | |
if (nodeName === "script" && dest.text !== src.text) { | |
disableScript(dest).text = src.text; | |
restoreScript(dest); | |
} else if (nodeName === "object") { | |
if (dest.parentNode) { | |
dest.outerHTML = src.outerHTML; | |
} | |
if (jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML))) { | |
dest.innerHTML = src.innerHTML; | |
} | |
} else if (nodeName === "input" && manipulation_rcheckableType.test(src.type)) { | |
dest.defaultChecked = dest.checked = src.checked; | |
if (dest.value !== src.value) { | |
dest.value = src.value; | |
} | |
} else if (nodeName === "option") { | |
dest.defaultSelected = dest.selected = src.defaultSelected; | |
} else if (nodeName === "input" || nodeName === "textarea") { | |
dest.defaultValue = src.defaultValue; | |
} | |
} | |
jQuery.each({ | |
appendTo: "append", | |
prependTo: "prepend", | |
insertBefore: "before", | |
insertAfter: "after", | |
replaceAll: "replaceWith" | |
}, function (name, original) { | |
jQuery.fn[name] = function (selector) { | |
var elems, i = 0, | |
ret = [], | |
insert = jQuery(selector), | |
last = insert.length - 1; | |
for (; i <= last; i++) { | |
elems = i === last ? this : this.clone(true); | |
jQuery(insert[i])[original](elems); | |
core_push.apply(ret, elems.get()); | |
} | |
return this.pushStack(ret); | |
}; | |
}); | |
function getAll(context, tag) { | |
var elems, elem, i = 0, | |
found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName(tag || "*") : typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll(tag || "*") : undefined; | |
if (!found) { | |
for (found = [], elems = context.childNodes || context; | |
(elem = elems[i]) != null; i++) { | |
if (!tag || jQuery.nodeName(elem, tag)) { | |
found.push(elem); | |
} else { | |
jQuery.merge(found, getAll(elem, tag)); | |
} | |
} | |
} | |
return tag === undefined || tag && jQuery.nodeName(context, tag) ? jQuery.merge([context], found) : found; | |
} | |
function fixDefaultChecked(elem) { | |
if (manipulation_rcheckableType.test(elem.type)) { | |
elem.defaultChecked = elem.checked; | |
} | |
} | |
jQuery.extend({ | |
clone: function (elem, dataAndEvents, deepDataAndEvents) { | |
var destElements, node, clone, i, srcElements, inPage = jQuery.contains(elem.ownerDocument, elem); | |
if (jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test("<" + elem.nodeName + ">")) { | |
clone = elem.cloneNode(true); | |
} else { | |
fragmentDiv.innerHTML = elem.outerHTML; | |
fragmentDiv.removeChild(clone = fragmentDiv.firstChild); | |
} | |
if ((!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) { | |
destElements = getAll(clone); | |
srcElements = getAll(elem); | |
for (i = 0; | |
(node = srcElements[i]) != null; ++i) { | |
if (destElements[i]) { | |
fixCloneNodeIssues(node, destElements[i]); | |
} | |
} | |
} | |
if (dataAndEvents) { | |
if (deepDataAndEvents) { | |
srcElements = srcElements || getAll(elem); | |
destElements = destElements || getAll(clone); | |
for (i = 0; | |
(node = srcElements[i]) != null; i++) { | |
cloneCopyEvent(node, destElements[i]); | |
} | |
} else { | |
cloneCopyEvent(elem, clone); | |
} | |
} | |
destElements = getAll(clone, "script"); | |
if (destElements.length > 0) { | |
setGlobalEval(destElements, !inPage && getAll(elem, "script")); | |
} | |
destElements = srcElements = node = null; | |
return clone; | |
}, | |
buildFragment: function (elems, context, scripts, selection) { | |
var j, elem, contains, tmp, tag, tbody, wrap, l = elems.length, | |
safe = createSafeFragment(context), | |
nodes = [], | |
i = 0; | |
for (; i < l; i++) { | |
elem = elems[i]; | |
if (elem || elem === 0) { | |
if (jQuery.type(elem) === "object") { | |
jQuery.merge(nodes, elem.nodeType ? [elem] : elem); | |
} else if (!rhtml.test(elem)) { | |
nodes.push(context.createTextNode(elem)); | |
} else { | |
tmp = tmp || safe.appendChild(context.createElement("div")); | |
tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase(); | |
wrap = wrapMap[tag] || wrapMap._default; | |
tmp.innerHTML = wrap[1] + elem.replace(rxhtmlTag, "<$1></$2>") + wrap[2]; | |
j = wrap[0]; | |
while (j--) { | |
tmp = tmp.lastChild; | |
} | |
if (!jQuery.support.leadingWhitespace && rleadingWhitespace.test(elem)) { | |
nodes.push(context.createTextNode(rleadingWhitespace.exec(elem)[0])); | |
} | |
if (!jQuery.support.tbody) { | |
elem = tag === "table" && !rtbody.test(elem) ? tmp.firstChild : wrap[1] === "<table>" && !rtbody.test(elem) ? tmp : 0; | |
j = elem && elem.childNodes.length; | |
while (j--) { | |
if (jQuery.nodeName((tbody = elem.childNodes[j]), "tbody") && !tbody.childNodes.length) { | |
elem.removeChild(tbody); | |
} | |
} | |
} | |
jQuery.merge(nodes, tmp.childNodes); | |
tmp.textContent = ""; | |
while (tmp.firstChild) { | |
tmp.removeChild(tmp.firstChild); | |
} | |
tmp = safe.lastChild; | |
} | |
} | |
} | |
if (tmp) { | |
safe.removeChild(tmp); | |
} | |
if (!jQuery.support.appendChecked) { | |
jQuery.grep(getAll(nodes, "input"), fixDefaultChecked); | |
} | |
i = 0; | |
while ((elem = nodes[i++])) { | |
if (selection && jQuery.inArray(elem, selection) !== -1) { | |
continue; | |
} | |
contains = jQuery.contains(elem.ownerDocument, elem); | |
tmp = getAll(safe.appendChild(elem), "script"); | |
if (contains) { | |
setGlobalEval(tmp); | |
} | |
if (scripts) { | |
j = 0; | |
while ((elem = tmp[j++])) { | |
if (rscriptType.test(elem.type || "")) { | |
scripts.push(elem); | |
} | |
} | |
} | |
} | |
tmp = null; | |
return safe; | |
}, | |
cleanData: function (elems, acceptData) { | |
var elem, type, id, data, i = 0, | |
internalKey = jQuery.expando, | |
cache = jQuery.cache, | |
deleteExpando = jQuery.support.deleteExpando, | |
special = jQuery.event.special; | |
for (; | |
(elem = elems[i]) != null; i++) { | |
if (acceptData || jQuery.acceptData(elem)) { | |
id = elem[internalKey]; | |
data = id && cache[id]; | |
if (data) { | |
if (data.events) { | |
for (type in data.events) { | |
if (special[type]) { | |
jQuery.event.remove(elem, type); | |
} else { | |
jQuery.removeEvent(elem, type, data.handle); | |
} | |
} | |
} | |
if (cache[id]) { | |
delete cache[id]; | |
if (deleteExpando) { | |
delete elem[internalKey]; | |
} else if (typeof elem.removeAttribute !== core_strundefined) { | |
elem.removeAttribute(internalKey); | |
} else { | |
elem[internalKey] = null; | |
} | |
core_deletedIds.push(id); | |
} | |
} | |
} | |
} | |
} | |
}); | |
var iframe, getStyles, curCSS, ralpha = /alpha\([^)]*\)/i, | |
ropacity = /opacity\s*=\s*([^)]*)/, | |
rposition = /^(top|right|bottom|left)$/, | |
rdisplayswap = /^(none|table(?!-c[ea]).+)/, | |
rmargin = /^margin/, | |
rnumsplit = new RegExp("^(" + core_pnum + ")(.*)$", "i"), | |
rnumnonpx = new RegExp("^(" + core_pnum + ")(?!px)[a-z%]+$", "i"), | |
rrelNum = new RegExp("^([+-])=(" + core_pnum + ")", "i"), | |
elemdisplay = { | |
BODY: "block" | |
}, | |
cssShow = { | |
position: "absolute", | |
visibility: "hidden", | |
display: "block" | |
}, | |
cssNormalTransform = { | |
letterSpacing: 0, | |
fontWeight: 400 | |
}, | |
cssExpand = ["Top", "Right", "Bottom", "Left"], | |
cssPrefixes = ["Webkit", "O", "Moz", "ms"]; | |
function vendorPropName(style, name) { | |
if (name in style) { | |
return name; | |
} | |
var capName = name.charAt(0).toUpperCase() + name.slice(1), | |
origName = name, | |
i = cssPrefixes.length; | |
while (i--) { | |
name = cssPrefixes[i] + capName; | |
if (name in style) { | |
return name; | |
} | |
} | |
return origName; | |
} | |
function isHidden(elem, el) { | |
elem = el || elem; | |
return jQuery.css(elem, "display") === "none" || !jQuery.contains(elem.ownerDocument, elem); | |
} | |
function showHide(elements, show) { | |
var display, elem, hidden, values = [], | |
index = 0, | |
length = elements.length; | |
for (; index < length; index++) { | |
elem = elements[index]; | |
if (!elem.style) { | |
continue; | |
} | |
values[index] = jQuery._data(elem, "olddisplay"); | |
display = elem.style.display; | |
if (show) { | |
if (!values[index] && display === "none") { | |
elem.style.display = ""; | |
} | |
if (elem.style.display === "" && isHidden(elem)) { | |
values[index] = jQuery._data(elem, "olddisplay", css_defaultDisplay(elem.nodeName)); | |
} | |
} else { | |
if (!values[index]) { | |
hidden = isHidden(elem); | |
if (display && display !== "none" || !hidden) { | |
jQuery._data(elem, "olddisplay", hidden ? display : jQuery.css(elem, "display")); | |
} | |
} | |
} | |
} | |
for (index = 0; index < length; index++) { | |
elem = elements[index]; | |
if (!elem.style) { | |
continue; | |
} | |
if (!show || elem.style.display === "none" || elem.style.display === "") { | |
elem.style.display = show ? values[index] || "" : "none"; | |
} | |
} | |
return elements; | |
} | |
jQuery.fn.extend({ | |
css: function (name, value) { | |
return jQuery.access(this, function (elem, name, value) { | |
var len, styles, map = {}, | |
i = 0; | |
if (jQuery.isArray(name)) { | |
styles = getStyles(elem); | |
len = name.length; | |
for (; i < len; i++) { | |
map[name[i]] = jQuery.css(elem, name[i], false, styles); | |
} | |
return map; | |
} | |
return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name); | |
}, name, value, arguments.length > 1); | |
}, | |
show: function () { | |
return showHide(this, true); | |
}, | |
hide: function () { | |
return showHide(this); | |
}, | |
toggle: function (state) { | |
var bool = typeof state === "boolean"; | |
return this.each(function () { | |
if (bool ? state : isHidden(this)) { | |
jQuery(this).show(); | |
} else { | |
jQuery(this).hide(); | |
} | |
}); | |
} | |
}); | |
jQuery.extend({ | |
cssHooks: { | |
opacity: { | |
get: function (elem, computed) { | |
if (computed) { | |
var ret = curCSS(elem, "opacity"); | |
return ret === "" ? "1" : ret; | |
} | |
} | |
} | |
}, | |
cssNumber: { | |
"columnCount": true, | |
"fillOpacity": true, | |
"fontWeight": true, | |
"lineHeight": true, | |
"opacity": true, | |
"orphans": true, | |
"widows": true, | |
"zIndex": true, | |
"zoom": true | |
}, | |
cssProps: { | |
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" | |
}, | |
style: function (elem, name, value, extra) { | |
if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) { | |
return; | |
} | |
var ret, type, hooks, origName = jQuery.camelCase(name), | |
style = elem.style; | |
name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(style, origName)); | |
hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; | |
if (value !== undefined) { | |
type = typeof value; | |
if (type === "string" && (ret = rrelNum.exec(value))) { | |
value = (ret[1] + 1) * ret[2] + parseFloat(jQuery.css(elem, name)); | |
type = "number"; | |
} | |
if (value == null || type === "number" && isNaN(value)) { | |
return; | |
} | |
if (type === "number" && !jQuery.cssNumber[origName]) { | |
value += "px"; | |
} | |
if (!jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0) { | |
style[name] = "inherit"; | |
} | |
if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) { | |
try { | |
style[name] = value; | |
} catch (e) {} | |
} | |
} else { | |
if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) { | |
return ret; | |
} | |
return style[name]; | |
} | |
}, | |
css: function (elem, name, extra, styles) { | |
var num, val, hooks, origName = jQuery.camelCase(name); | |
name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(elem.style, origName)); | |
hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; | |
if (hooks && "get" in hooks) { | |
val = hooks.get(elem, true, extra); | |
} | |
if (val === undefined) { | |
val = curCSS(elem, name, styles); | |
} | |
if (val === "normal" && name in cssNormalTransform) { | |
val = cssNormalTransform[name]; | |
} | |
if (extra === "" || extra) { | |
num = parseFloat(val); | |
return extra === true || jQuery.isNumeric(num) ? num || 0 : val; | |
} | |
return val; | |
}, | |
swap: function (elem, options, callback, args) { | |
var ret, name, old = {}; | |
for (name in options) { | |
old[name] = elem.style[name]; | |
elem.style[name] = options[name]; | |
} | |
ret = callback.apply(elem, args || []); | |
for (name in options) { | |
elem.style[name] = old[name]; | |
} | |
return ret; | |
} | |
}); | |
if (window.getComputedStyle) { | |
getStyles = function (elem) { | |
return window.getComputedStyle(elem, null); | |
}; | |
curCSS = function (elem, name, _computed) { | |
var width, minWidth, maxWidth, computed = _computed || getStyles(elem), | |
ret = computed ? computed.getPropertyValue(name) || computed[name] : undefined, | |
style = elem.style; | |
if (computed) { | |
if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) { | |
ret = jQuery.style(elem, name); | |
} | |
if (rnumnonpx.test(ret) && rmargin.test(name)) { | |
width = style.width; | |
minWidth = style.minWidth; | |
maxWidth = style.maxWidth; | |
style.minWidth = style.maxWidth = style.width = ret; | |
ret = computed.width; | |
style.width = width; | |
style.minWidth = minWidth; | |
style.maxWidth = maxWidth; | |
} | |
} | |
return ret; | |
}; | |
} else if (document.documentElement.currentStyle) { | |
getStyles = function (elem) { | |
return elem.currentStyle; | |
}; | |
curCSS = function (elem, name, _computed) { | |
var left, rs, rsLeft, computed = _computed || getStyles(elem), | |
ret = computed ? computed[name] : undefined, | |
style = elem.style; | |
if (ret == null && style && style[name]) { | |
ret = style[name]; | |
} | |
if (rnumnonpx.test(ret) && !rposition.test(name)) { | |
left = style.left; | |
rs = elem.runtimeStyle; | |
rsLeft = rs && rs.left; | |
if (rsLeft) { | |
rs.left = elem.currentStyle.left; | |
} | |
style.left = name === "fontSize" ? "1em" : ret; | |
ret = style.pixelLeft + "px"; | |
style.left = left; | |
if (rsLeft) { | |
rs.left = rsLeft; | |
} | |
} | |
return ret === "" ? "auto" : ret; | |
}; | |
} | |
function setPositiveNumber(elem, value, subtract) { | |
var matches = rnumsplit.exec(value); | |
return matches ? Math.max(0, matches[1] - (subtract || 0)) + (matches[2] || "px") : value; | |
} | |
function augmentWidthOrHeight(elem, name, extra, isBorderBox, styles) { | |
var i = extra === (isBorderBox ? "border" : "content") ? 4 : name === "width" ? 1 : 0, | |
val = 0; | |
for (; i < 4; i += 2) { | |
if (extra === "margin") { | |
val += jQuery.css(elem, extra + cssExpand[i], true, styles); | |
} | |
if (isBorderBox) { | |
if (extra === "content") { | |
val -= jQuery.css(elem, "padding" + cssExpand[i], true, styles); | |
} | |
if (extra !== "margin") { | |
val -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles); | |
} | |
} else { | |
val += jQuery.css(elem, "padding" + cssExpand[i], true, styles); | |
if (extra !== "padding") { | |
val += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles); | |
} | |
} | |
} | |
return val; | |
} | |
function getWidthOrHeight(elem, name, extra) { | |
var valueIsBorderBox = true, | |
val = name === "width" ? elem.offsetWidth : elem.offsetHeight, | |
styles = getStyles(elem), | |
isBorderBox = jQuery.support.boxSizing && jQuery.css(elem, "boxSizing", false, styles) === "border-box"; | |
if (val <= 0 || val == null) { | |
val = curCSS(elem, name, styles); | |
if (val < 0 || val == null) { | |
val = elem.style[name]; | |
} | |
if (rnumnonpx.test(val)) { | |
return val; | |
} | |
valueIsBorderBox = isBorderBox && (jQuery.support.boxSizingReliable || val === elem.style[name]); | |
val = parseFloat(val) || 0; | |
} | |
return (val + | |
augmentWidthOrHeight(elem, name, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles)) + "px"; | |
} | |
function css_defaultDisplay(nodeName) { | |
var doc = document, | |
display = elemdisplay[nodeName]; | |
if (!display) { | |
display = actualDisplay(nodeName, doc); | |
if (display === "none" || !display) { | |
iframe = (iframe || jQuery("<iframe frameborder='0' width='0' height='0'/>") | |
.css("cssText", "display:block !important")).appendTo(doc.documentElement); | |
doc = (iframe[0].contentWindow || iframe[0].contentDocument).document; | |
doc.write("<!doctype html><html><body>"); | |
doc.close(); | |
display = actualDisplay(nodeName, doc); | |
iframe.detach(); | |
} | |
elemdisplay[nodeName] = display; | |
} | |
return display; | |
} | |
function actualDisplay(name, doc) { | |
var elem = jQuery(doc.createElement(name)).appendTo(doc.body), | |
display = jQuery.css(elem[0], "display"); | |
elem.remove(); | |
return display; | |
} | |
jQuery.each(["height", "width"], function (i, name) { | |
jQuery.cssHooks[name] = { | |
get: function (elem, computed, extra) { | |
if (computed) { | |
return elem.offsetWidth === 0 && rdisplayswap.test(jQuery.css(elem, "display")) ? jQuery.swap(elem, cssShow, function () { | |
return getWidthOrHeight(elem, name, extra); | |
}) : getWidthOrHeight(elem, name, extra); | |
} | |
}, | |
set: function (elem, value, extra) { | |
var styles = extra && getStyles(elem); | |
return setPositiveNumber(elem, value, extra ? augmentWidthOrHeight(elem, name, extra, jQuery.support.boxSizing && jQuery.css(elem, "boxSizing", false, styles) === "border-box", styles) : 0); | |
} | |
}; | |
}); | |
if (!jQuery.support.opacity) { | |
jQuery.cssHooks.opacity = { | |
get: function (elem, computed) { | |
return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ? (0.01 * parseFloat(RegExp.$1)) + "" : computed ? "1" : ""; | |
}, | |
set: function (elem, value) { | |
var style = elem.style, | |
currentStyle = elem.currentStyle, | |
opacity = jQuery.isNumeric(value) ? "alpha(opacity=" + value * 100 + ")" : "", | |
filter = currentStyle && currentStyle.filter || style.filter || ""; | |
style.zoom = 1; | |
if ((value >= 1 || value === "") && jQuery.trim(filter.replace(ralpha, "")) === "" && style.removeAttribute) { | |
style.removeAttribute("filter"); | |
if (value === "" || currentStyle && !currentStyle.filter) { | |
return; | |
} | |
} | |
style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : filter + " " + opacity; | |
} | |
}; | |
} | |
jQuery(function () { | |
if (!jQuery.support.reliableMarginRight) { | |
jQuery.cssHooks.marginRight = { | |
get: function (elem, computed) { | |
if (computed) { | |
return jQuery.swap(elem, { | |
"display": "inline-block" | |
}, curCSS, [elem, "marginRight"]); | |
} | |
} | |
}; | |
} | |
if (!jQuery.support.pixelPosition && jQuery.fn.position) { | |
jQuery.each(["top", "left"], function (i, prop) { | |
jQuery.cssHooks[prop] = { | |
get: function (elem, computed) { | |
if (computed) { | |
computed = curCSS(elem, prop); | |
return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed; | |
} | |
} | |
}; | |
}); | |
} | |
}); | |
if (jQuery.expr && jQuery.expr.filters) { | |
jQuery.expr.filters.hidden = function (elem) { | |
return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css(elem, "display")) === "none"); | |
}; | |
jQuery.expr.filters.visible = function (elem) { | |
return !jQuery.expr.filters.hidden(elem); | |
}; | |
} | |
jQuery.each({ | |
margin: "", | |
padding: "", | |
border: "Width" | |
}, function (prefix, suffix) { | |
jQuery.cssHooks[prefix + suffix] = { | |
expand: function (value) { | |
var i = 0, | |
expanded = {}, | |
parts = typeof value === "string" ? value.split(" ") : [value]; | |
for (; i < 4; i++) { | |
expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0]; | |
} | |
return expanded; | |
} | |
}; | |
if (!rmargin.test(prefix)) { | |
jQuery.cssHooks[prefix + suffix].set = setPositiveNumber; | |
} | |
}); | |
var r20 = /%20/g, | |
rbracket = /\[\]$/, | |
rCRLF = /\r?\n/g, | |
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, | |
rsubmittable = /^(?:input|select|textarea|keygen)/i; | |
jQuery.fn.extend({ | |
serialize: function () { | |
return jQuery.param(this.serializeArray()); | |
}, | |
serializeArray: function () { | |
return this.map(function () { | |
var elements = jQuery.prop(this, "elements"); | |
return elements ? jQuery.makeArray(elements) : this; | |
}) | |
.filter(function () { | |
var type = this.type; | |
return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !manipulation_rcheckableType.test(type)); | |
}) | |
.map(function (i, elem) { | |
var val = jQuery(this).val(); | |
return val == null ? null : jQuery.isArray(val) ? jQuery.map(val, function (val) { | |
return { | |
name: elem.name, | |
value: val.replace(rCRLF, "\r\n") | |
}; | |
}) : { | |
name: elem.name, | |
value: val.replace(rCRLF, "\r\n") | |
}; | |
}).get(); | |
} | |
}); | |
jQuery.param = function (a, traditional) { | |
var prefix, s = [], | |
add = function (key, value) { | |
value = jQuery.isFunction(value) ? value() : (value == null ? "" : value); | |
s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value); | |
}; | |
if (traditional === undefined) { | |
traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; | |
} | |
if (jQuery.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) { | |
jQuery.each(a, function () { | |
add(this.name, this.value); | |
}); | |
} else { | |
for (prefix in a) { | |
buildParams(prefix, a[prefix], traditional, add); | |
} | |
} | |
return s.join("&").replace(r20, "+"); | |
}; | |
function buildParams(prefix, obj, traditional, add) { | |
var name; | |
if (jQuery.isArray(obj)) { | |
jQuery.each(obj, function (i, v) { | |
if (traditional || rbracket.test(prefix)) { | |
add(prefix, v); | |
} else { | |
buildParams(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add); | |
} | |
}); | |
} else if (!traditional && jQuery.type(obj) === "object") { | |
for (name in obj) { | |
buildParams(prefix + "[" + name + "]", obj[name], traditional, add); | |
} | |
} else { | |
add(prefix, obj); | |
} | |
} | |
jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick " + | |
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + | |
"change select submit keydown keypress keyup error contextmenu").split(" "), function (i, name) { | |
jQuery.fn[name] = function (data, fn) { | |
return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name); | |
}; | |
}); | |
jQuery.fn.hover = function (fnOver, fnOut) { | |
return this.mouseenter(fnOver).mouseleave(fnOut || fnOver); | |
}; | |
var | |
ajaxLocParts, ajaxLocation, ajax_nonce = jQuery.now(), | |
ajax_rquery = /\?/, | |
rhash = /#.*$/, | |
rts = /([?&])_=[^&]*/, | |
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, | |
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, | |
rnoContent = /^(?:GET|HEAD)$/, | |
rprotocol = /^\/\//, | |
rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, | |
_load = jQuery.fn.load, | |
prefilters = {}, | |
transports = {}, | |
allTypes = "*/".concat("*"); | |
try { | |
ajaxLocation = location.href; | |
} catch (e) { | |
ajaxLocation = document.createElement("a"); | |
ajaxLocation.href = ""; | |
ajaxLocation = ajaxLocation.href; | |
} | |
ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || []; | |
function addToPrefiltersOrTransports(structure) { | |
return function (dataTypeExpression, func) { | |
if (typeof dataTypeExpression !== "string") { | |
func = dataTypeExpression; | |
dataTypeExpression = "*"; | |
} | |
var dataType, i = 0, | |
dataTypes = dataTypeExpression.toLowerCase().match(core_rnotwhite) || []; | |
if (jQuery.isFunction(func)) { | |
while ((dataType = dataTypes[i++])) { | |
if (dataType[0] === "+") { | |
dataType = dataType.slice(1) || "*"; | |
(structure[dataType] = structure[dataType] || []).unshift(func); | |
} else { | |
(structure[dataType] = structure[dataType] || []).push(func); | |
} | |
} | |
} | |
}; | |
} | |
function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) { | |
var inspected = {}, | |
seekingTransport = (structure === transports); | |
function inspect(dataType) { | |
var selected; | |
inspected[dataType] = true; | |
jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) { | |
var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR); | |
if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) { | |
options.dataTypes.unshift(dataTypeOrTransport); | |
inspect(dataTypeOrTransport); | |
return false; | |
} else if (seekingTransport) { | |
return !(selected = dataTypeOrTransport); | |
} | |
}); | |
return selected; | |
} | |
return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*"); | |
} | |
function ajaxExtend(target, src) { | |
var deep, key, flatOptions = jQuery.ajaxSettings.flatOptions || {}; | |
for (key in src) { | |
if (src[key] !== undefined) { | |
(flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key]; | |
} | |
} | |
if (deep) { | |
jQuery.extend(true, target, deep); | |
} | |
return target; | |
} | |
jQuery.fn.load = function (url, params, callback) { | |
if (typeof url !== "string" && _load) { | |
return _load.apply(this, arguments); | |
} | |
var selector, response, type, self = this, | |
off = url.indexOf(" "); | |
if (off >= 0) { | |
selector = url.slice(off, url.length); | |
url = url.slice(0, off); | |
} | |
if (jQuery.isFunction(params)) { | |
callback = params; | |
params = undefined; | |
} else if (params && typeof params === "object") { | |
type = "POST"; | |
} | |
if (self.length > 0) { | |
jQuery.ajax({ | |
url: url, | |
type: type, | |
dataType: "html", | |
data: params | |
}).done(function (responseText) { | |
response = arguments; | |
self.html(selector ? jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) : responseText); | |
}).complete(callback && function (jqXHR, status) { | |
self.each(callback, response || [jqXHR.responseText, status, jqXHR]); | |
}); | |
} | |
return this; | |
}; | |
jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (i, type) { | |
jQuery.fn[type] = function (fn) { | |
return this.on(type, fn); | |
}; | |
}); | |
jQuery.each(["get", "post"], function (i, method) { | |
jQuery[method] = function (url, data, callback, type) { | |
if (jQuery.isFunction(data)) { | |
type = type || callback; | |
callback = data; | |
data = undefined; | |
} | |
return jQuery.ajax({ | |
url: url, | |
type: method, | |
dataType: type, | |
data: data, | |
success: callback | |
}); | |
}; | |
}); | |
jQuery.extend({ | |
active: 0, | |
lastModified: {}, | |
etag: {}, | |
ajaxSettings: { | |
url: ajaxLocation, | |
type: "GET", | |
isLocal: rlocalProtocol.test(ajaxLocParts[1]), | |
global: true, | |
processData: true, | |
async: true, | |
contentType: "application/x-www-form-urlencoded; charset=UTF-8", | |
accepts: { | |
"*": allTypes, | |
text: "text/plain", | |
html: "text/html", | |
xml: "application/xml, text/xml", | |
json: "application/json, text/javascript" | |
}, | |
contents: { | |
xml: /xml/, | |
html: /html/, | |
json: /json/ | |
}, | |
responseFields: { | |
xml: "responseXML", | |
text: "responseText" | |
}, | |
converters: { | |
"* text": window.String, | |
"text html": true, | |
"text json": jQuery.parseJSON, | |
"text xml": jQuery.parseXML | |
}, | |
flatOptions: { | |
url: true, | |
context: true | |
} | |
}, | |
ajaxSetup: function (target, settings) { | |
return settings ? ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) : ajaxExtend(jQuery.ajaxSettings, target); | |
}, | |
ajaxPrefilter: addToPrefiltersOrTransports(prefilters), | |
ajaxTransport: addToPrefiltersOrTransports(transports), | |
ajax: function (url, options) { | |
if (typeof url === "object") { | |
options = url; | |
url = undefined; | |
} | |
options = options || {}; | |
var | |
parts, i, cacheURL, responseHeadersString, timeoutTimer, fireGlobals, transport, responseHeaders, s = jQuery.ajaxSetup({}, options), | |
callbackContext = s.context || s, | |
globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event, | |
deferred = jQuery.Deferred(), | |
completeDeferred = jQuery.Callbacks("once memory"), | |
statusCode = s.statusCode || {}, | |
requestHeaders = {}, | |
requestHeadersNames = {}, | |
state = 0, | |
strAbort = "canceled", | |
jqXHR = { | |
readyState: 0, | |
getResponseHeader: function (key) { | |
var match; | |
if (state === 2) { | |
if (!responseHeaders) { | |
responseHeaders = {}; | |
while ((match = rheaders.exec(responseHeadersString))) { | |
responseHeaders[match[1].toLowerCase()] = match[2]; | |
} | |
} | |
match = responseHeaders[key.toLowerCase()]; | |
} | |
return match == null ? null : match; | |
}, | |
getAllResponseHeaders: function () { | |
return state === 2 ? responseHeadersString : null; | |
}, | |
setRequestHeader: function (name, value) { | |
var lname = name.toLowerCase(); | |
if (!state) { | |
name = requestHeadersNames[lname] = requestHeadersNames[lname] || name; | |
requestHeaders[name] = value; | |
} | |
return this; | |
}, | |
overrideMimeType: function (type) { | |
if (!state) { | |
s.mimeType = type; | |
} | |
return this; | |
}, | |
statusCode: function (map) { | |
var code; | |
if (map) { | |
if (state < 2) { | |
for (code in map) { | |
statusCode[code] = [statusCode[code], map[code]]; | |
} | |
} else { | |
jqXHR.always(map[jqXHR.status]); | |
} | |
} | |
return this; | |
}, | |
abort: function (statusText) { | |
var finalText = statusText || strAbort; | |
if (transport) { | |
transport.abort(finalText); | |
} | |
done(0, finalText); | |
return this; | |
} | |
}; | |
deferred.promise(jqXHR).complete = completeDeferred.add; | |
jqXHR.success = jqXHR.done; | |
jqXHR.error = jqXHR.fail; | |
s.url = ((url || s.url || ajaxLocation) + "").replace(rhash, "").replace(rprotocol, ajaxLocParts[1] + "//"); | |
s.type = options.method || options.type || s.method || s.type; | |
s.dataTypes = jQuery.trim(s.dataType || "*").toLowerCase().match(core_rnotwhite) || [""]; | |
if (s.crossDomain == null) { | |
parts = rurl.exec(s.url.toLowerCase()); | |
s.crossDomain = !!(parts && (parts[1] !== ajaxLocParts[1] || parts[2] !== ajaxLocParts[2] || (parts[3] || (parts[1] === "http:" ? 80 : 443)) != (ajaxLocParts[3] || (ajaxLocParts[1] === "http:" ? 80 : 443)))); | |
} | |
if (s.data && s.processData && typeof s.data !== "string") { | |
s.data = jQuery.param(s.data, s.traditional); | |
} | |
inspectPrefiltersOrTransports(prefilters, s, options, jqXHR); | |
if (state === 2) { | |
return jqXHR; | |
} | |
fireGlobals = s.global; | |
if (fireGlobals && jQuery.active++ === 0) { | |
jQuery.event.trigger("ajaxStart"); | |
} | |
s.type = s.type.toUpperCase(); | |
s.hasContent = !rnoContent.test(s.type); | |
cacheURL = s.url; | |
if (!s.hasContent) { | |
if (s.data) { | |
cacheURL = (s.url += (ajax_rquery.test(cacheURL) ? "&" : "?") + s.data); | |
delete s.data; | |
} | |
if (s.cache === false) { | |
s.url = rts.test(cacheURL) ? cacheURL.replace(rts, "$1_=" + ajax_nonce++) : cacheURL + (ajax_rquery.test(cacheURL) ? "&" : "?") + "_=" + ajax_nonce++; | |
} | |
} | |
if (s.ifModified) { | |
if (jQuery.lastModified[cacheURL]) { | |
jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]); | |
} | |
if (jQuery.etag[cacheURL]) { | |
jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]); | |
} | |
} | |
if (s.data && s.hasContent && s.contentType !== false || options.contentType) { | |
jqXHR.setRequestHeader("Content-Type", s.contentType); | |
} | |
jqXHR.setRequestHeader("Accept", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"]); | |
for (i in s.headers) { | |
jqXHR.setRequestHeader(i, s.headers[i]); | |
} | |
if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || state === 2)) { | |
return jqXHR.abort(); | |
} | |
strAbort = "abort"; | |
for (i in { | |
success: 1, | |
error: 1, | |
complete: 1 | |
}) { | |
jqXHR[i](s[i]); | |
} | |
transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR); | |
if (!transport) { | |
done(-1, "No Transport"); | |
} else { | |
jqXHR.readyState = 1; | |
if (fireGlobals) { | |
globalEventContext.trigger("ajaxSend", [jqXHR, s]); | |
} | |
if (s.async && s.timeout > 0) { | |
timeoutTimer = setTimeout(function () { | |
jqXHR.abort("timeout"); | |
}, s.timeout); | |
} | |
try { | |
state = 1; | |
transport.send(requestHeaders, done); | |
} catch (e) { | |
if (state < 2) { | |
done(-1, e); | |
} else { | |
throw e; | |
} | |
} | |
} | |
function done(status, nativeStatusText, responses, headers) { | |
var isSuccess, success, error, response, modified, statusText = nativeStatusText; | |
if (state === 2) { | |
return; | |
} | |
state = 2; | |
if (timeoutTimer) { | |
clearTimeout(timeoutTimer); | |
} | |
transport = undefined; | |
responseHeadersString = headers || ""; | |
jqXHR.readyState = status > 0 ? 4 : 0; | |
if (responses) { | |
response = ajaxHandleResponses(s, jqXHR, responses); | |
} | |
if (status >= 200 && status < 300 || status === 304) { | |
if (s.ifModified) { | |
modified = jqXHR.getResponseHeader("Last-Modified"); | |
if (modified) { | |
jQuery.lastModified[cacheURL] = modified; | |
} | |
modified = jqXHR.getResponseHeader("etag"); | |
if (modified) { | |
jQuery.etag[cacheURL] = modified; | |
} | |
} | |
if (status === 204) { | |
isSuccess = true; | |
statusText = "nocontent"; | |
} else if (status === 304) { | |
isSuccess = true; | |
statusText = "notmodified"; | |
} else { | |
isSuccess = ajaxConvert(s, response); | |
statusText = isSuccess.state; | |
success = isSuccess.data; | |
error = isSuccess.error; | |
isSuccess = !error; | |
} | |
} else { | |
error = statusText; | |
if (status || !statusText) { | |
statusText = "error"; | |
if (status < 0) { | |
status = 0; | |
} | |
} | |
} | |
jqXHR.status = status; | |
jqXHR.statusText = (nativeStatusText || statusText) + ""; | |
if (isSuccess) { | |
deferred.resolveWith(callbackContext, [success, statusText, jqXHR]); | |
} else { | |
deferred.rejectWith(callbackContext, [jqXHR, statusText, error]); | |
} | |
jqXHR.statusCode(statusCode); | |
statusCode = undefined; | |
if (fireGlobals) { | |
globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]); | |
} | |
completeDeferred.fireWith(callbackContext, [jqXHR, statusText]); | |
if (fireGlobals) { | |
globalEventContext.trigger("ajaxComplete", [jqXHR, s]); | |
if (!(--jQuery.active)) { | |
jQuery.event.trigger("ajaxStop"); | |
} | |
} | |
} | |
return jqXHR; | |
}, | |
getScript: function (url, callback) { | |
return jQuery.get(url, undefined, callback, "script"); | |
}, | |
getJSON: function (url, data, callback) { | |
return jQuery.get(url, data, callback, "json"); | |
} | |
}); | |
function ajaxHandleResponses(s, jqXHR, responses) { | |
var firstDataType, ct, finalDataType, type, contents = s.contents, | |
dataTypes = s.dataTypes, | |
responseFields = s.responseFields; | |
for (type in responseFields) { | |
if (type in responses) { | |
jqXHR[responseFields[type]] = responses[type]; | |
} | |
} | |
while (dataTypes[0] === "*") { | |
dataTypes.shift(); | |
if (ct === undefined) { | |
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); | |
} | |
} | |
if (ct) { | |
for (type in contents) { | |
if (contents[type] && contents[type].test(ct)) { | |
dataTypes.unshift(type); | |
break; | |
} | |
} | |
} | |
if (dataTypes[0] in responses) { | |
finalDataType = dataTypes[0]; | |
} else { | |
for (type in responses) { | |
if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) { | |
finalDataType = type; | |
break; | |
} | |
if (!firstDataType) { | |
firstDataType = type; | |
} | |
} | |
finalDataType = finalDataType || firstDataType; | |
} | |
if (finalDataType) { | |
if (finalDataType !== dataTypes[0]) { | |
dataTypes.unshift(finalDataType); | |
} | |
return responses[finalDataType]; | |
} | |
} | |
function ajaxConvert(s, response) { | |
var conv2, current, conv, tmp, converters = {}, | |
i = 0, | |
dataTypes = s.dataTypes.slice(), | |
prev = dataTypes[0]; | |
if (s.dataFilter) { | |
response = s.dataFilter(response, s.dataType); | |
} | |
if (dataTypes[1]) { | |
for (conv in s.converters) { | |
converters[conv.toLowerCase()] = s.converters[conv]; | |
} | |
} | |
for (; | |
(current = dataTypes[++i]);) { | |
if (current !== "*") { | |
if (prev !== "*" && prev !== current) { | |
conv = converters[prev + " " + current] || converters["* " + current]; | |
if (!conv) { | |
for (conv2 in converters) { | |
tmp = conv2.split(" "); | |
if (tmp[1] === current) { | |
conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]]; | |
if (conv) { | |
if (conv === true) { | |
conv = converters[conv2]; | |
} else if (converters[conv2] !== true) { | |
current = tmp[0]; | |
dataTypes.splice(i--, 0, current); | |
} | |
break; | |
} | |
} | |
} | |
} | |
if (conv !== true) { | |
if (conv && s["throws"]) { | |
response = conv(response); | |
} else { | |
try { | |
response = conv(response); | |
} catch (e) { | |
return { | |
state: "parsererror", | |
error: conv ? e : "No conversion from " + prev + " to " + current | |
}; | |
} | |
} | |
} | |
} | |
prev = current; | |
} | |
} | |
return { | |
state: "success", | |
data: response | |
}; | |
} | |
jQuery.ajaxSetup({ | |
accepts: { | |
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" | |
}, | |
contents: { | |
script: /(?:java|ecma)script/ | |
}, | |
converters: { | |
"text script": function (text) { | |
jQuery.globalEval(text); | |
return text; | |
} | |
} | |
}); | |
jQuery.ajaxPrefilter("script", function (s) { | |
if (s.cache === undefined) { | |
s.cache = false; | |
} | |
if (s.crossDomain) { | |
s.type = "GET"; | |
s.global = false; | |
} | |
}); | |
jQuery.ajaxTransport("script", function (s) { | |
if (s.crossDomain) { | |
var script, head = document.head || jQuery("head")[0] || document.documentElement; | |
return { | |
send: function (_, callback) { | |
script = document.createElement("script"); | |
script.async = true; | |
if (s.scriptCharset) { | |
script.charset = s.scriptCharset; | |
} | |
script.src = s.url; | |
script.onload = script.onreadystatechange = function (_, isAbort) { | |
if (isAbort || !script.readyState || /loaded|complete/.test(script.readyState)) { | |
script.onload = script.onreadystatechange = null; | |
if (script.parentNode) { | |
script.parentNode.removeChild(script); | |
} | |
script = null; | |
if (!isAbort) { | |
callback(200, "success"); | |
} | |
} | |
}; | |
head.insertBefore(script, head.firstChild); | |
}, | |
abort: function () { | |
if (script) { | |
script.onload(undefined, true); | |
} | |
} | |
}; | |
} | |
}); | |
var oldCallbacks = [], | |
rjsonp = /(=)\?(?=&|$)|\?\?/; | |
jQuery.ajaxSetup({ | |
jsonp: "callback", | |
jsonpCallback: function () { | |
var callback = oldCallbacks.pop() || (jQuery.expando + "_" + (ajax_nonce++)); | |
this[callback] = true; | |
return callback; | |
} | |
}); | |
jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) { | |
var callbackName, overwritten, responseContainer, jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? "url" : typeof s.data === "string" && !(s.contentType || "").indexOf("application/x-www-form-urlencoded") && rjsonp.test(s.data) && "data"); | |
if (jsonProp || s.dataTypes[0] === "jsonp") { | |
callbackName = s.jsonpCallback = jQuery.isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback; | |
if (jsonProp) { | |
s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName); | |
} else if (s.jsonp !== false) { | |
s.url += (ajax_rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName; | |
} | |
s.converters["script json"] = function () { | |
if (!responseContainer) { | |
jQuery.error(callbackName + " was not called"); | |
} | |
return responseContainer[0]; | |
}; | |
s.dataTypes[0] = "json"; | |
overwritten = window[callbackName]; | |
window[callbackName] = function () { | |
responseContainer = arguments; | |
}; | |
jqXHR.always(function () { | |
window[callbackName] = overwritten; | |
if (s[callbackName]) { | |
s.jsonpCallback = originalSettings.jsonpCallback; | |
oldCallbacks.push(callbackName); | |
} | |
if (responseContainer && jQuery.isFunction(overwritten)) { | |
overwritten(responseContainer[0]); | |
} | |
responseContainer = overwritten = undefined; | |
}); | |
return "script"; | |
} | |
}); | |
var xhrCallbacks, xhrSupported, xhrId = 0, | |
xhrOnUnloadAbort = window.ActiveXObject && function () { | |
var key; | |
for (key in xhrCallbacks) { | |
xhrCallbacks[key](undefined, true); | |
} | |
}; | |
function createStandardXHR() { | |
try { | |
return new window.XMLHttpRequest(); | |
} catch (e) {} | |
} | |
function createActiveXHR() { | |
try { | |
return new window.ActiveXObject("Microsoft.XMLHTTP"); | |
} catch (e) {} | |
} | |
jQuery.ajaxSettings.xhr = window.ActiveXObject ? function () { | |
return !this.isLocal && createStandardXHR() || createActiveXHR(); | |
} : createStandardXHR; | |
xhrSupported = jQuery.ajaxSettings.xhr(); | |
jQuery.support.cors = !!xhrSupported && ("withCredentials" in xhrSupported); | |
xhrSupported = jQuery.support.ajax = !!xhrSupported; | |
if (xhrSupported) { | |
jQuery.ajaxTransport(function (s) { | |
if (!s.crossDomain || jQuery.support.cors) { | |
var callback; | |
return { | |
send: function (headers, complete) { | |
var handle, i, xhr = s.xhr(); | |
if (s.username) { | |
xhr.open(s.type, s.url, s.async, s.username, s.password); | |
} else { | |
xhr.open(s.type, s.url, s.async); | |
} | |
if (s.xhrFields) { | |
for (i in s.xhrFields) { | |
xhr[i] = s.xhrFields[i]; | |
} | |
} | |
if (s.mimeType && xhr.overrideMimeType) { | |
xhr.overrideMimeType(s.mimeType); | |
} | |
if (!s.crossDomain && !headers["X-Requested-With"]) { | |
headers["X-Requested-With"] = "XMLHttpRequest"; | |
} | |
try { | |
for (i in headers) { | |
xhr.setRequestHeader(i, headers[i]); | |
} | |
} catch (err) {} | |
xhr.send((s.hasContent && s.data) || null); | |
callback = function (_, isAbort) { | |
var status, responseHeaders, statusText, responses; | |
try { | |
if (callback && (isAbort || xhr.readyState === 4)) { | |
callback = undefined; | |
if (handle) { | |
xhr.onreadystatechange = jQuery.noop; | |
if (xhrOnUnloadAbort) { | |
delete xhrCallbacks[handle]; | |
} | |
} | |
if (isAbort) { | |
if (xhr.readyState !== 4) { | |
xhr.abort(); | |
} | |
} else { | |
responses = {}; | |
status = xhr.status; | |
responseHeaders = xhr.getAllResponseHeaders(); | |
if (typeof xhr.responseText === "string") { | |
responses.text = xhr.responseText; | |
} | |
try { | |
statusText = xhr.statusText; | |
} catch (e) { | |
statusText = ""; | |
} | |
if (!status && s.isLocal && !s.crossDomain) { | |
status = responses.text ? 200 : 404; | |
} else if (status === 1223) { | |
status = 204; | |
} | |
} | |
} | |
} catch (firefoxAccessException) { | |
if (!isAbort) { | |
complete(-1, firefoxAccessException); | |
} | |
} | |
if (responses) { | |
complete(status, statusText, responses, responseHeaders); | |
} | |
}; | |
if (!s.async) { | |
callback(); | |
} else if (xhr.readyState === 4) { | |
setTimeout(callback); | |
} else { | |
handle = ++xhrId; | |
if (xhrOnUnloadAbort) { | |
if (!xhrCallbacks) { | |
xhrCallbacks = {}; | |
jQuery(window).unload(xhrOnUnloadAbort); | |
} | |
xhrCallbacks[handle] = callback; | |
} | |
xhr.onreadystatechange = callback; | |
} | |
}, | |
abort: function () { | |
if (callback) { | |
callback(undefined, true); | |
} | |
} | |
}; | |
} | |
}); | |
} | |
var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/, | |
rfxnum = new RegExp("^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i"), | |
rrun = /queueHooks$/, | |
animationPrefilters = [defaultPrefilter], | |
tweeners = { | |
"*": [ | |
function (prop, value) { | |
var end, unit, tween = this.createTween(prop, value), | |
parts = rfxnum.exec(value), | |
target = tween.cur(), | |
start = +target || 0, | |
scale = 1, | |
maxIterations = 20; | |
if (parts) { | |
end = +parts[2]; | |
unit = parts[3] || (jQuery.cssNumber[prop] ? "" : "px"); | |
if (unit !== "px" && start) { | |
start = jQuery.css(tween.elem, prop, true) || end || 1; | |
do { | |
scale = scale || ".5"; | |
start = start / scale; | |
jQuery.style(tween.elem, prop, start + unit); | |
} while (scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations); | |
} | |
tween.unit = unit; | |
tween.start = start; | |
tween.end = parts[1] ? start + (parts[1] + 1) * end : end; | |
} | |
return tween; | |
} | |
] | |
}; | |
function createFxNow() { | |
setTimeout(function () { | |
fxNow = undefined; | |
}); | |
return (fxNow = jQuery.now()); | |
} | |
function createTweens(animation, props) { | |
jQuery.each(props, function (prop, value) { | |
var collection = (tweeners[prop] || []).concat(tweeners["*"]), | |
index = 0, | |
length = collection.length; | |
for (; index < length; index++) { | |
if (collection[index].call(animation, prop, value)) { | |
return; | |
} | |
} | |
}); | |
} | |
function Animation(elem, properties, options) { | |
var result, stopped, index = 0, | |
length = animationPrefilters.length, | |
deferred = jQuery.Deferred().always(function () { | |
delete tick.elem; | |
}), | |
tick = function () { | |
if (stopped) { | |
return false; | |
} | |
var currentTime = fxNow || createFxNow(), | |
remaining = Math.max(0, animation.startTime + animation.duration - currentTime), | |
temp = remaining / animation.duration || 0, | |
percent = 1 - temp, | |
index = 0, | |
length = animation.tweens.length; | |
for (; index < length; index++) { | |
animation.tweens[index].run(percent); | |
} | |
deferred.notifyWith(elem, [animation, percent, remaining]); | |
if (percent < 1 && length) { | |
return remaining; | |
} else { | |
deferred.resolveWith(elem, [animation]); | |
return false; | |
} | |
}, | |
animation = deferred.promise({ | |
elem: elem, | |
props: jQuery.extend({}, properties), | |
opts: jQuery.extend(true, { | |
specialEasing: {} | |
}, options), | |
originalProperties: properties, | |
originalOptions: options, | |
startTime: fxNow || createFxNow(), | |
duration: options.duration, | |
tweens: [], | |
createTween: function (prop, end) { | |
var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing); | |
animation.tweens.push(tween); | |
return tween; | |
}, | |
stop: function (gotoEnd) { | |
var index = 0, | |
length = gotoEnd ? animation.tweens.length : 0; | |
if (stopped) { | |
return this; | |
} | |
stopped = true; | |
for (; index < length; index++) { | |
animation.tweens[index].run(1); | |
} | |
if (gotoEnd) { | |
deferred.resolveWith(elem, [animation, gotoEnd]); | |
} else { | |
deferred.rejectWith(elem, [animation, gotoEnd]); | |
} | |
return this; | |
} | |
}), | |
props = animation.props; | |
propFilter(props, animation.opts.specialEasing); | |
for (; index < length; index++) { | |
result = animationPrefilters[index].call(animation, elem, props, animation.opts); | |
if (result) { | |
return result; | |
} | |
} | |
createTweens(animation, props); | |
if (jQuery.isFunction(animation.opts.start)) { | |
animation.opts.start.call(elem, animation); | |
} | |
jQuery.fx.timer(jQuery.extend(tick, { | |
elem: elem, | |
anim: animation, | |
queue: animation.opts.queue | |
})); | |
return animation.progress(animation.opts.progress) | |
.done(animation.opts.done, animation.opts.complete) | |
.fail(animation.opts.fail) | |
.always(animation.opts.always); | |
} | |
function propFilter(props, specialEasing) { | |
var value, name, index, easing, hooks; | |
for (index in props) { | |
name = jQuery.camelCase(index); | |
easing = specialEasing[name]; | |
value = props[index]; | |
if (jQuery.isArray(value)) { | |
easing = value[1]; | |
value = props[index] = value[0]; | |
} | |
if (index !== name) { | |
props[name] = value; | |
delete props[index]; | |
} | |
hooks = jQuery.cssHooks[name]; | |
if (hooks && "expand" in hooks) { | |
value = hooks.expand(value); | |
delete props[name]; | |
for (index in value) { | |
if (!(index in props)) { | |
props[index] = value[index]; | |
specialEasing[index] = easing; | |
} | |
} | |
} else { | |
specialEasing[name] = easing; | |
} | |
} | |
} | |
jQuery.Animation = jQuery.extend(Animation, { | |
tweener: function (props, callback) { | |
if (jQuery.isFunction(props)) { | |
callback = props; | |
props = ["*"]; | |
} else { | |
props = props.split(" "); | |
} | |
var prop, index = 0, | |
length = props.length; | |
for (; index < length; index++) { | |
prop = props[index]; | |
tweeners[prop] = tweeners[prop] || []; | |
tweeners[prop].unshift(callback); | |
} | |
}, | |
prefilter: function (callback, prepend) { | |
if (prepend) { | |
animationPrefilters.unshift(callback); | |
} else { | |
animationPrefilters.push(callback); | |
} | |
} | |
}); | |
function defaultPrefilter(elem, props, opts) { | |
var prop, index, length, value, dataShow, toggle, tween, hooks, oldfire, anim = this, | |
style = elem.style, | |
orig = {}, | |
handled = [], | |
hidden = elem.nodeType && isHidden(elem); | |
if (!opts.queue) { | |
hooks = jQuery._queueHooks(elem, "fx"); | |
if (hooks.unqueued == null) { | |
hooks.unqueued = 0; | |
oldfire = hooks.empty.fire; | |
hooks.empty.fire = function () { | |
if (!hooks.unqueued) { | |
oldfire(); | |
} | |
}; | |
} | |
hooks.unqueued++; | |
anim.always(function () { | |
anim.always(function () { | |
hooks.unqueued--; | |
if (!jQuery.queue(elem, "fx").length) { | |
hooks.empty.fire(); | |
} | |
}); | |
}); | |
} | |
if (elem.nodeType === 1 && ("height" in props || "width" in props)) { | |
opts.overflow = [style.overflow, style.overflowX, style.overflowY]; | |
if (jQuery.css(elem, "display") === "inline" && jQuery.css(elem, "float") === "none") { | |
if (!jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay(elem.nodeName) === "inline") { | |
style.display = "inline-block"; | |
} else { | |
style.zoom = 1; | |
} | |
} | |
} | |
if (opts.overflow) { | |
style.overflow = "hidden"; | |
if (!jQuery.support.shrinkWrapBlocks) { | |
anim.always(function () { | |
style.overflow = opts.overflow[0]; | |
style.overflowX = opts.overflow[1]; | |
style.overflowY = opts.overflow[2]; | |
}); | |
} | |
} | |
for (index in props) { | |
value = props[index]; | |
if (rfxtypes.exec(value)) { | |
delete props[index]; | |
toggle = toggle || value === "toggle"; | |
if (value === (hidden ? "hide" : "show")) { | |
continue; | |
} | |
handled.push(index); | |
} | |
} | |
length = handled.length; | |
if (length) { | |
dataShow = jQuery._data(elem, "fxshow") || jQuery._data(elem, "fxshow", {}); | |
if ("hidden" in dataShow) { | |
hidden = dataShow.hidden; | |
} | |
if (toggle) { | |
dataShow.hidden = !hidden; | |
} | |
if (hidden) { | |
jQuery(elem).show(); | |
} else { | |
anim.done(function () { | |
jQuery(elem).hide(); | |
}); | |
} | |
anim.done(function () { | |
var prop; | |
jQuery._removeData(elem, "fxshow"); | |
for (prop in orig) { | |
jQuery.style(elem, prop, orig[prop]); | |
} | |
}); | |
for (index = 0; index < length; index++) { | |
prop = handled[index]; | |
tween = anim.createTween(prop, hidden ? dataShow[prop] : 0); | |
orig[prop] = dataShow[prop] || jQuery.style(elem, prop); | |
if (!(prop in dataShow)) { | |
dataShow[prop] = tween.start; | |
if (hidden) { | |
tween.end = tween.start; | |
tween.start = prop === "width" || prop === "height" ? 1 : 0; | |
} | |
} | |
} | |
} | |
} | |
function Tween(elem, options, prop, end, easing) { | |
return new Tween.prototype.init(elem, options, prop, end, easing); | |
} | |
jQuery.Tween = Tween; | |
Tween.prototype = { | |
constructor: Tween, | |
init: function (elem, options, prop, end, easing, unit) { | |
this.elem = elem; | |
this.prop = prop; | |
this.easing = easing || "swing"; | |
this.options = options; | |
this.start = this.now = this.cur(); | |
this.end = end; | |
this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px"); | |
}, | |
cur: function () { | |
var hooks = Tween.propHooks[this.prop]; | |
return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this); | |
}, | |
run: function (percent) { | |
var eased, hooks = Tween.propHooks[this.prop]; | |
if (this.options.duration) { | |
this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration); | |
} else { | |
this.pos = eased = percent; | |
} | |
this.now = (this.end - this.start) * eased + this.start; | |
if (this.options.step) { | |
this.options.step.call(this.elem, this.now, this); | |
} | |
if (hooks && hooks.set) { | |
hooks.set(this); | |
} else { | |
Tween.propHooks._default.set(this); | |
} | |
return this; | |
} | |
}; | |
Tween.prototype.init.prototype = Tween.prototype; | |
Tween.propHooks = { | |
_default: { | |
get: function (tween) { | |
var result; | |
if (tween.elem[tween.prop] != null && (!tween.elem.style || tween.elem.style[tween.prop] == null)) { | |
return tween.elem[tween.prop]; | |
} | |
result = jQuery.css(tween.elem, tween.prop, ""); | |
return !result || result === "auto" ? 0 : result; | |
}, | |
set: function (tween) { | |
if (jQuery.fx.step[tween.prop]) { | |
jQuery.fx.step[tween.prop](tween); | |
} else if (tween.elem.style && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) { | |
jQuery.style(tween.elem, tween.prop, tween.now + tween.unit); | |
} else { | |
tween.elem[tween.prop] = tween.now; | |
} | |
} | |
} | |
}; | |
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { | |
set: function (tween) { | |
if (tween.elem.nodeType && tween.elem.parentNode) { | |
tween.elem[tween.prop] = tween.now; | |
} | |
} | |
}; | |
jQuery.each(["toggle", "show", "hide"], function (i, name) { | |
var cssFn = jQuery.fn[name]; | |
jQuery.fn[name] = function (speed, easing, callback) { | |
return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback); | |
}; | |
}); | |
jQuery.fn.extend({ | |
fadeTo: function (speed, to, easing, callback) { | |
return this.filter(isHidden).css("opacity", 0).show() | |
.end().animate({ | |
opacity: to | |
}, speed, easing, callback); | |
}, | |
animate: function (prop, speed, easing, callback) { | |
var empty = jQuery.isEmptyObject(prop), | |
optall = jQuery.speed(speed, easing, callback), | |
doAnimation = function () { | |
var anim = Animation(this, jQuery.extend({}, prop), optall); | |
doAnimation.finish = function () { | |
anim.stop(true); | |
}; | |
if (empty || jQuery._data(this, "finish")) { | |
anim.stop(true); | |
} | |
}; | |
doAnimation.finish = doAnimation; | |
return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation); | |
}, | |
stop: function (type, clearQueue, gotoEnd) { | |
var stopQueue = function (hooks) { | |
var stop = hooks.stop; | |
delete hooks.stop; | |
stop(gotoEnd); | |
}; | |
if (typeof type !== "string") { | |
gotoEnd = clearQueue; | |
clearQueue = type; | |
type = undefined; | |
} | |
if (clearQueue && type !== false) { | |
this.queue(type || "fx", []); | |
} | |
return this.each(function () { | |
var dequeue = true, | |
index = type != null && type + "queueHooks", | |
timers = jQuery.timers, | |
data = jQuery._data(this); | |
if (index) { | |
if (data[index] && data[index].stop) { | |
stopQueue(data[index]); | |
} | |
} else { | |
for (index in data) { | |
if (data[index] && data[index].stop && rrun.test(index)) { | |
stopQueue(data[index]); | |
} | |
} | |
} | |
for (index = timers.length; index--;) { | |
if (timers[index].elem === this && (type == null || timers[index].queue === type)) { | |
timers[index].anim.stop(gotoEnd); | |
dequeue = false; | |
timers.splice(index, 1); | |
} | |
} | |
if (dequeue || !gotoEnd) { | |
jQuery.dequeue(this, type); | |
} | |
}); | |
}, | |
finish: function (type) { | |
if (type !== false) { | |
type = type || "fx"; | |
} | |
return this.each(function () { | |
var index, data = jQuery._data(this), | |
queue = data[type + "queue"], | |
hooks = data[type + "queueHooks"], | |
timers = jQuery.timers, | |
length = queue ? queue.length : 0; | |
data.finish = true; | |
jQuery.queue(this, type, []); | |
if (hooks && hooks.cur && hooks.cur.finish) { | |
hooks.cur.finish.call(this); | |
} | |
for (index = timers.length; index--;) { | |
if (timers[index].elem === this && timers[index].queue === type) { | |
timers[index].anim.stop(true); | |
timers.splice(index, 1); | |
} | |
} | |
for (index = 0; index < length; index++) { | |
if (queue[index] && queue[index].finish) { | |
queue[index].finish.call(this); | |
} | |
} | |
delete data.finish; | |
}); | |
} | |
}); | |
function genFx(type, includeWidth) { | |
var which, attrs = { | |
height: type | |
}, | |
i = 0; | |
includeWidth = includeWidth ? 1 : 0; | |
for (; i < 4; i += 2 - includeWidth) { | |
which = cssExpand[i]; | |
attrs["margin" + which] = attrs["padding" + which] = type; | |
} | |
if (includeWidth) { | |
attrs.opacity = attrs.width = type; | |
} | |
return attrs; | |
} | |
jQuery.each({ | |
slideDown: genFx("show"), | |
slideUp: genFx("hide"), | |
slideToggle: genFx("toggle"), | |
fadeIn: { | |
opacity: "show" | |
}, | |
fadeOut: { | |
opacity: "hide" | |
}, | |
fadeToggle: { | |
opacity: "toggle" | |
} | |
}, function (name, props) { | |
jQuery.fn[name] = function (speed, easing, callback) { | |
return this.animate(props, speed, easing, callback); | |
}; | |
}); | |
jQuery.speed = function (speed, easing, fn) { | |
var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : { | |
complete: fn || !fn && easing || jQuery.isFunction(speed) && speed, | |
duration: speed, | |
easing: fn && easing || easing && !jQuery.isFunction(easing) && easing | |
}; | |
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default; | |
if (opt.queue == null || opt.queue === true) { | |
opt.queue = "fx"; | |
} | |
opt.old = opt.complete; | |
opt.complete = function () { | |
if (jQuery.isFunction(opt.old)) { | |
opt.old.call(this); | |
} | |
if (opt.queue) { | |
jQuery.dequeue(this, opt.queue); | |
} | |
}; | |
return opt; | |
}; | |
jQuery.easing = { | |
linear: function (p) { | |
return p; | |
}, | |
swing: function (p) { | |
return 0.5 - Math.cos(p * Math.PI) / 2; | |
} | |
}; | |
jQuery.timers = []; | |
jQuery.fx = Tween.prototype.init; | |
jQuery.fx.tick = function () { | |
var timer, timers = jQuery.timers, | |
i = 0; | |
fxNow = jQuery.now(); | |
for (; i < timers.length; i++) { | |
timer = timers[i]; | |
if (!timer() && timers[i] === timer) { | |
timers.splice(i--, 1); | |
} | |
} | |
if (!timers.length) { | |
jQuery.fx.stop(); | |
} | |
fxNow = undefined; | |
}; | |
jQuery.fx.timer = function (timer) { | |
if (timer() && jQuery.timers.push(timer)) { | |
jQuery.fx.start(); | |
} | |
}; | |
jQuery.fx.interval = 13; | |
jQuery.fx.start = function () { | |
if (!timerId) { | |
timerId = setInterval(jQuery.fx.tick, jQuery.fx.interval); | |
} | |
}; | |
jQuery.fx.stop = function () { | |
clearInterval(timerId); | |
timerId = null; | |
}; | |
jQuery.fx.speeds = { | |
slow: 600, | |
fast: 200, | |
_default: 400 | |
}; | |
jQuery.fx.step = {}; | |
if (jQuery.expr && jQuery.expr.filters) { | |
jQuery.expr.filters.animated = function (elem) { | |
return jQuery.grep(jQuery.timers, function (fn) { | |
return elem === fn.elem; | |
}).length; | |
}; | |
} | |
jQuery.fn.offset = function (options) { | |
if (arguments.length) { | |
return options === undefined ? this : this.each(function (i) { | |
jQuery.offset.setOffset(this, options, i); | |
}); | |
} | |
var docElem, win, box = { | |
top: 0, | |
left: 0 | |
}, | |
elem = this[0], | |
doc = elem && elem.ownerDocument; | |
if (!doc) { | |
return; | |
} | |
docElem = doc.documentElement; | |
if (!jQuery.contains(docElem, elem)) { | |
return box; | |
} | |
if (typeof elem.getBoundingClientRect !== core_strundefined) { | |
box = elem.getBoundingClientRect(); | |
} | |
win = getWindow(doc); | |
return { | |
top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0), | |
left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0) | |
}; | |
}; | |
jQuery.offset = { | |
setOffset: function (elem, options, i) { | |
var position = jQuery.css(elem, "position"); | |
if (position === "static") { | |
elem.style.position = "relative"; | |
} | |
var curElem = jQuery(elem), | |
curOffset = curElem.offset(), | |
curCSSTop = jQuery.css(elem, "top"), | |
curCSSLeft = jQuery.css(elem, "left"), | |
calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, | |
props = {}, | |
curPosition = {}, | |
curTop, curLeft; | |
if (calculatePosition) { | |
curPosition = curElem.position(); | |
curTop = curPosition.top; | |
curLeft = curPosition.left; | |
} else { | |
curTop = parseFloat(curCSSTop) || 0; | |
curLeft = parseFloat(curCSSLeft) || 0; | |
} | |
if (jQuery.isFunction(options)) { | |
options = options.call(elem, i, curOffset); | |
} | |
if (options.top != null) { | |
props.top = (options.top - curOffset.top) + curTop; | |
} | |
if (options.left != null) { | |
props.left = (options.left - curOffset.left) + curLeft; | |
} | |
if ("using" in options) { | |
options.using.call(elem, props); | |
} else { | |
curElem.css(props); | |
} | |
} | |
}; | |
jQuery.fn.extend({ | |
position: function () { | |
if (!this[0]) { | |
return; | |
} | |
var offsetParent, offset, parentOffset = { | |
top: 0, | |
left: 0 | |
}, | |
elem = this[0]; | |
if (jQuery.css(elem, "position") === "fixed") { | |
offset = elem.getBoundingClientRect(); | |
} else { | |
offsetParent = this.offsetParent(); | |
offset = this.offset(); | |
if (!jQuery.nodeName(offsetParent[0], "html")) { | |
parentOffset = offsetParent.offset(); | |
} | |
parentOffset.top += jQuery.css(offsetParent[0], "borderTopWidth", true); | |
parentOffset.left += jQuery.css(offsetParent[0], "borderLeftWidth", true); | |
} | |
return { | |
top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true), | |
left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true) | |
}; | |
}, | |
offsetParent: function () { | |
return this.map(function () { | |
var offsetParent = this.offsetParent || document.documentElement; | |
while (offsetParent && (!jQuery.nodeName(offsetParent, "html") && jQuery.css(offsetParent, "position") === "static")) { | |
offsetParent = offsetParent.offsetParent; | |
} | |
return offsetParent || document.documentElement; | |
}); | |
} | |
}); | |
jQuery.each({ | |
scrollLeft: "pageXOffset", | |
scrollTop: "pageYOffset" | |
}, function (method, prop) { | |
var top = /Y/.test(prop); | |
jQuery.fn[method] = function (val) { | |
return jQuery.access(this, function (elem, method, val) { | |
var win = getWindow(elem); | |
if (val === undefined) { | |
return win ? (prop in win) ? win[prop] : win.document.documentElement[method] : elem[method]; | |
} | |
if (win) { | |
win.scrollTo(!top ? val : jQuery(win).scrollLeft(), top ? val : jQuery(win).scrollTop()); | |
} else { | |
elem[method] = val; | |
} | |
}, method, val, arguments.length, null); | |
}; | |
}); | |
function getWindow(elem) { | |
return jQuery.isWindow(elem) ? elem : elem.nodeType === 9 ? elem.defaultView || elem.parentWindow : false; | |
} | |
jQuery.each({ | |
Height: "height", | |
Width: "width" | |
}, function (name, type) { | |
jQuery.each({ | |
padding: "inner" + name, | |
content: type, | |
"": "outer" + name | |
}, function (defaultExtra, funcName) { | |
jQuery.fn[funcName] = function (margin, value) { | |
var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"), | |
extra = defaultExtra || (margin === true || value === true ? "margin" : "border"); | |
return jQuery.access(this, function (elem, type, value) { | |
var doc; | |
if (jQuery.isWindow(elem)) { | |
return elem.document.documentElement["client" + name]; | |
} | |
if (elem.nodeType === 9) { | |
doc = elem.documentElement; | |
return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]); | |
} | |
return value === undefined ? jQuery.css(elem, type, extra) : jQuery.style(elem, type, value, extra); | |
}, type, chainable ? margin : undefined, chainable, null); | |
}; | |
}); | |
}); | |
window.jQuery = window.$ = jQuery; | |
if (typeof define === "function" && define.amd && define.amd.jQuery) { | |
define("jquery", [], function () { | |
return jQuery; | |
}); | |
} | |
})(window); | |
if (typeof JSON !== 'object') { | |
JSON = {}; | |
} | |
(function () { | |
'use strict'; | |
function f(n) { | |
return n < 10 ? '0' + n : n; | |
} | |
if (typeof Date.prototype.toJSON !== 'function') { | |
Date.prototype.toJSON = function (key) { | |
return isFinite(this.valueOf()) ? this.getUTCFullYear() + '-' + | |
f(this.getUTCMonth() + 1) + '-' + | |
f(this.getUTCDate()) + 'T' + | |
f(this.getUTCHours()) + ':' + | |
f(this.getUTCMinutes()) + ':' + | |
f(this.getUTCSeconds()) + 'Z' : null; | |
}; | |
String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function (key) { | |
return this.valueOf(); | |
}; | |
} | |
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, | |
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, | |
gap, indent, meta = { | |
'\b': '\\b', | |
'\t': '\\t', | |
'\n': '\\n', | |
'\f': '\\f', | |
'\r': '\\r', | |
'"': '\\"', | |
'\\': '\\\\' | |
}, | |
rep; | |
function quote(string) { | |
escapable.lastIndex = 0; | |
return escapable.test(string) ? '"' + string.replace(escapable, function (a) { | |
var c = meta[a]; | |
return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); | |
}) + '"' : '"' + string + '"'; | |
} | |
function str(key, holder) { | |
var i, k, v, length, mind = gap, | |
partial, value = holder[key]; | |
if (value && typeof value === 'object' && typeof value.toJSON === 'function') { | |
value = value.toJSON(key); | |
} | |
if (typeof rep === 'function') { | |
value = rep.call(holder, key, value); | |
} | |
switch (typeof value) { | |
case 'string': | |
return quote(value); | |
case 'number': | |
return isFinite(value) ? String(value) : 'null'; | |
case 'boolean': | |
case 'null': | |
return String(value); | |
case 'object': | |
if (!value) { | |
return 'null'; | |
} | |
gap += indent; | |
partial = []; | |
if (Object.prototype.toString.apply(value) === '[object Array]') { | |
length = value.length; | |
for (i = 0; i < length; i += 1) { | |
partial[i] = str(i, value) || 'null'; | |
} | |
v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']'; | |
gap = mind; | |
return v; | |
} | |
if (rep && typeof rep === 'object') { | |
length = rep.length; | |
for (i = 0; i < length; i += 1) { | |
if (typeof rep[i] === 'string') { | |
k = rep[i]; | |
v = str(k, value); | |
if (v) { | |
partial.push(quote(k) + (gap ? ': ' : ':') + v); | |
} | |
} | |
} | |
} else { | |
for (k in value) { | |
if (Object.prototype.hasOwnProperty.call(value, k)) { | |
v = str(k, value); | |
if (v) { | |
partial.push(quote(k) + (gap ? ': ' : ':') + v); | |
} | |
} | |
} | |
} | |
v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}'; | |
gap = mind; | |
return v; | |
} | |
} | |
if (typeof JSON.stringify !== 'function') { | |
JSON.stringify = function (value, replacer, space) { | |
var i; | |
gap = ''; | |
indent = ''; | |
if (typeof space === 'number') { | |
for (i = 0; i < space; i += 1) { | |
indent += ' '; | |
} | |
} else if (typeof space === 'string') { | |
indent = space; | |
} | |
rep = replacer; | |
if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { | |
throw new Error('JSON.stringify'); | |
} | |
return str('', { | |
'': value | |
}); | |
}; | |
} | |
if (typeof JSON.parse !== 'function') { | |
JSON.parse = function (text, reviver) { | |
var j; | |
function walk(holder, key) { | |
var k, v, value = holder[key]; | |
if (value && typeof value === 'object') { | |
for (k in value) { | |
if (Object.prototype.hasOwnProperty.call(value, k)) { | |
v = walk(value, k); | |
if (v !== undefined) { | |
value[k] = v; | |
} else { | |
delete value[k]; | |
} | |
} | |
} | |
} | |
return reviver.call(holder, key, value); | |
} | |
text = String(text); | |
cx.lastIndex = 0; | |
if (cx.test(text)) { | |
text = text.replace(cx, function (a) { | |
return '\\u' + | |
('0000' + a.charCodeAt(0).toString(16)).slice(-4); | |
}); | |
} | |
if (/^[\],:{}\s]*$/ | |
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') | |
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') | |
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { | |
j = eval('(' + text + ')'); | |
return typeof reviver === 'function' ? walk({ | |
'': j | |
}, '') : j; | |
} | |
throw new SyntaxError('JSON.parse'); | |
}; | |
} | |
}()); | |
/** | |
* History.js Native Adapter | |
* @author Benjamin Arthur Lupton <[email protected]> | |
* @copyright 2010-2011 Benjamin Arthur Lupton <[email protected]> | |
* @license New BSD License <http://creativecommons.org/licenses/BSD/> | |
*/ | |
(function (window, undefined) { | |
"use strict"; | |
var History = window.History = window.History || {}; | |
if (typeof History.Adapter !== 'undefined') { | |
throw new Error('History.js Adapter has already been loaded...'); | |
} | |
History.Adapter = { | |
handlers: {}, | |
_uid: 1, | |
uid: function (element) { | |
return element._uid || (element._uid = History.Adapter._uid++); | |
}, | |
bind: function (element, eventName, callback) { | |
var uid = History.Adapter.uid(element); | |
History.Adapter.handlers[uid] = History.Adapter.handlers[uid] || {}; | |
History.Adapter.handlers[uid][eventName] = History.Adapter.handlers[uid][eventName] || []; | |
History.Adapter.handlers[uid][eventName].push(callback); | |
element['on' + eventName] = (function (element, eventName) { | |
return function (event) { | |
History.Adapter.trigger(element, eventName, event); | |
}; | |
})(element, eventName); | |
}, | |
trigger: function (element, eventName, event) { | |
event = event || {}; | |
var uid = History.Adapter.uid(element), | |
i, n; | |
History.Adapter.handlers[uid] = History.Adapter.handlers[uid] || {}; | |
History.Adapter.handlers[uid][eventName] = History.Adapter.handlers[uid][eventName] || []; | |
for (i = 0, n = History.Adapter.handlers[uid][eventName].length; i < n; ++i) { | |
History.Adapter.handlers[uid][eventName][i].apply(this, [event]); | |
} | |
}, | |
extractEventData: function (key, event) { | |
var result = (event && event[key]) || undefined; | |
return result; | |
}, | |
onDomLoad: function (callback) { | |
var timeout = window.setTimeout(function () { | |
callback(); | |
}, 2000); | |
window.onload = function () { | |
clearTimeout(timeout); | |
callback(); | |
}; | |
} | |
}; | |
if (typeof History.init !== 'undefined') { | |
History.init(); | |
} | |
})(window); | |
/** | |
* History.js HTML4 Support | |
* Depends on the HTML5 Support | |
* @author Benjamin Arthur Lupton <[email protected]> | |
* @copyright 2010-2011 Benjamin Arthur Lupton <[email protected]> | |
* @license New BSD License <http://creativecommons.org/licenses/BSD/> | |
*/ | |
(function (window, undefined) { | |
"use strict"; | |
var | |
document = window.document, | |
setTimeout = window.setTimeout || setTimeout, | |
clearTimeout = window.clearTimeout || clearTimeout, | |
setInterval = window.setInterval || setInterval, | |
History = window.History = window.History || {}; | |
if (typeof History.initHtml4 !== 'undefined') { | |
throw new Error('History.js HTML4 Support has already been loaded...'); | |
} | |
History.initHtml4 = function () { | |
if (typeof History.initHtml4.initialized !== 'undefined') { | |
return false; | |
} else { | |
History.initHtml4.initialized = true; | |
} | |
History.enabled = true; | |
History.savedHashes = []; | |
History.isLastHash = function (newHash) { | |
var oldHash = History.getHashByIndex(), | |
isLast; | |
isLast = newHash === oldHash; | |
return isLast; | |
}; | |
History.isHashEqual = function (newHash, oldHash) { | |
newHash = encodeURIComponent(newHash).replace(/%25/g, "%"); | |
oldHash = encodeURIComponent(oldHash).replace(/%25/g, "%"); | |
return newHash === oldHash; | |
}; | |
History.saveHash = function (newHash) { | |
if (History.isLastHash(newHash)) { | |
return false; | |
} | |
History.savedHashes.push(newHash); | |
return true; | |
}; | |
History.getHashByIndex = function (index) { | |
var hash = null; | |
if (typeof index === 'undefined') { | |
hash = History.savedHashes[History.savedHashes.length - 1]; | |
} else if (index < 0) { | |
hash = History.savedHashes[History.savedHashes.length + index]; | |
} else { | |
hash = History.savedHashes[index]; | |
} | |
return hash; | |
}; | |
History.discardedHashes = {}; | |
History.discardedStates = {}; | |
History.discardState = function (discardedState, forwardState, backState) { | |
var discardedStateHash = History.getHashByState(discardedState), | |
discardObject; | |
discardObject = { | |
'discardedState': discardedState, | |
'backState': backState, | |
'forwardState': forwardState | |
}; | |
History.discardedStates[discardedStateHash] = discardObject; | |
return true; | |
}; | |
History.discardHash = function (discardedHash, forwardState, backState) { | |
var discardObject = { | |
'discardedHash': discardedHash, | |
'backState': backState, | |
'forwardState': forwardState | |
}; | |
History.discardedHashes[discardedHash] = discardObject; | |
return true; | |
}; | |
History.discardedState = function (State) { | |
var StateHash = History.getHashByState(State), | |
discarded; | |
discarded = History.discardedStates[StateHash] || false; | |
return discarded; | |
}; | |
History.discardedHash = function (hash) { | |
var discarded = History.discardedHashes[hash] || false; | |
return discarded; | |
}; | |
History.recycleState = function (State) { | |
var StateHash = History.getHashByState(State); | |
if (History.discardedState(State)) { | |
delete History.discardedStates[StateHash]; | |
} | |
return true; | |
}; | |
if (History.emulated.hashChange) { | |
History.hashChangeInit = function () { | |
History.checkerFunction = null; | |
var lastDocumentHash = '', | |
iframeId, iframe, lastIframeHash, checkerRunning, startedWithHash = Boolean(History.getHash()); | |
if (History.isInternetExplorer()) { | |
iframeId = 'historyjs-iframe'; | |
iframe = document.createElement('iframe'); | |
iframe.setAttribute('id', iframeId); | |
iframe.setAttribute('src', '#'); | |
iframe.style.display = 'none'; | |
document.body.appendChild(iframe); | |
iframe.contentWindow.document.open(); | |
iframe.contentWindow.document.close(); | |
lastIframeHash = ''; | |
checkerRunning = false; | |
History.checkerFunction = function () { | |
if (checkerRunning) { | |
return false; | |
} | |
checkerRunning = true; | |
var | |
documentHash = History.getHash(), | |
iframeHash = History.getHash(iframe.contentWindow.document); | |
if (documentHash !== lastDocumentHash) { | |
lastDocumentHash = documentHash; | |
if (iframeHash !== documentHash) { | |
lastIframeHash = iframeHash = documentHash; | |
iframe.contentWindow.document.open(); | |
iframe.contentWindow.document.close(); | |
iframe.contentWindow.document.location.hash = History.escapeHash(documentHash); | |
} | |
History.Adapter.trigger(window, 'hashchange'); | |
} else if (iframeHash !== lastIframeHash) { | |
lastIframeHash = iframeHash; | |
if (startedWithHash && iframeHash === '') { | |
History.back(); | |
} else { | |
History.setHash(iframeHash, false); | |
} | |
} | |
checkerRunning = false; | |
return true; | |
}; | |
} else { | |
History.checkerFunction = function () { | |
var documentHash = History.getHash() || ''; | |
if (documentHash !== lastDocumentHash) { | |
lastDocumentHash = documentHash; | |
History.Adapter.trigger(window, 'hashchange'); | |
} | |
return true; | |
}; | |
} | |
History.intervalList.push(setInterval(History.checkerFunction, History.options.hashChangeInterval)); | |
return true; | |
}; | |
History.Adapter.onDomLoad(History.hashChangeInit); | |
} | |
if (History.emulated.pushState) { | |
History.onHashChange = function (event) { | |
var currentUrl = ((event && event.newURL) || History.getLocationHref()), | |
currentHash = History.getHashByUrl(currentUrl), | |
currentState = null, | |
currentStateHash = null, | |
currentStateHashExits = null, | |
discardObject; | |
if (History.isLastHash(currentHash)) { | |
History.busy(false); | |
return false; | |
} | |
History.doubleCheckComplete(); | |
History.saveHash(currentHash); | |
if (currentHash && History.isTraditionalAnchor(currentHash)) { | |
History.Adapter.trigger(window, 'anchorchange'); | |
History.busy(false); | |
return false; | |
} | |
currentState = History.extractState(History.getFullUrl(currentHash || History.getLocationHref()), true); | |
if (History.isLastSavedState(currentState)) { | |
History.busy(false); | |
return false; | |
} | |
currentStateHash = History.getHashByState(currentState); | |
discardObject = History.discardedState(currentState); | |
if (discardObject) { | |
if (History.getHashByIndex(-2) === History.getHashByState(discardObject.forwardState)) { | |
History.back(false); | |
} else { | |
History.forward(false); | |
} | |
return false; | |
} | |
History.pushState(currentState.data, currentState.title, encodeURI(currentState.url), false); | |
return true; | |
}; | |
History.Adapter.bind(window, 'hashchange', History.onHashChange); | |
History.pushState = function (data, title, url, queue) { | |
url = encodeURI(url).replace(/%25/g, "%"); | |
if (History.getHashByUrl(url)) { | |
throw new Error('History.js does not support states with fragment-identifiers (hashes/anchors).'); | |
} | |
if (queue !== false && History.busy()) { | |
History.pushQueue({ | |
scope: History, | |
callback: History.pushState, | |
args: arguments, | |
queue: queue | |
}); | |
return false; | |
} | |
History.busy(true); | |
var newState = History.createStateObject(data, title, url), | |
newStateHash = History.getHashByState(newState), | |
oldState = History.getState(false), | |
oldStateHash = History.getHashByState(oldState), | |
html4Hash = History.getHash(), | |
wasExpected = History.expectedStateId == newState.id; | |
History.storeState(newState); | |
History.expectedStateId = newState.id; | |
History.recycleState(newState); | |
History.setTitle(newState); | |
if (newStateHash === oldStateHash) { | |
History.busy(false); | |
return false; | |
} | |
History.saveState(newState); | |
if (!wasExpected) | |
History.Adapter.trigger(window, 'statechange'); | |
if (!History.isHashEqual(newStateHash, html4Hash) && !History.isHashEqual(newStateHash, History.getShortUrl(History.getLocationHref()))) { | |
History.setHash(newStateHash, false); | |
} | |
History.busy(false); | |
return true; | |
}; | |
History.replaceState = function (data, title, url, queue) { | |
url = encodeURI(url).replace(/%25/g, "%"); | |
if (History.getHashByUrl(url)) { | |
throw new Error('History.js does not support states with fragment-identifiers (hashes/anchors).'); | |
} | |
if (queue !== false && History.busy()) { | |
History.pushQueue({ | |
scope: History, | |
callback: History.replaceState, | |
args: arguments, | |
queue: queue | |
}); | |
return false; | |
} | |
History.busy(true); | |
var newState = History.createStateObject(data, title, url), | |
newStateHash = History.getHashByState(newState), | |
oldState = History.getState(false), | |
oldStateHash = History.getHashByState(oldState), | |
previousState = History.getStateByIndex(-2); | |
History.discardState(oldState, newState, previousState); | |
if (newStateHash === oldStateHash) { | |
History.storeState(newState); | |
History.expectedStateId = newState.id; | |
History.recycleState(newState); | |
History.setTitle(newState); | |
History.saveState(newState); | |
History.Adapter.trigger(window, 'statechange'); | |
History.busy(false); | |
} else { | |
History.pushState(newState.data, newState.title, newState.url, false); | |
} | |
return true; | |
}; | |
} | |
if (History.emulated.pushState) { | |
if (History.getHash() && !History.emulated.hashChange) { | |
History.Adapter.onDomLoad(function () { | |
History.Adapter.trigger(window, 'hashchange'); | |
}); | |
} | |
} | |
}; | |
if (typeof History.init !== 'undefined') { | |
History.init(); | |
} | |
})(window); | |
/** | |
* History.js Core | |
* @author Benjamin Arthur Lupton <[email protected]> | |
* @copyright 2010-2011 Benjamin Arthur Lupton <[email protected]> | |
* @license New BSD License <http://creativecommons.org/licenses/BSD/> | |
*/ | |
(function (window, undefined) { | |
"use strict"; | |
var | |
console = window.console || undefined, | |
document = window.document, | |
navigator = window.navigator, | |
sessionStorage = window.sessionStorage || false, | |
setTimeout = window.setTimeout, | |
clearTimeout = window.clearTimeout, | |
setInterval = window.setInterval, | |
clearInterval = window.clearInterval, | |
JSON = window.JSON, | |
alert = window.alert, | |
History = window.History = window.History || {}, | |
history = window.history; | |
try { | |
sessionStorage.setItem('TEST', '1'); | |
sessionStorage.removeItem('TEST'); | |
} catch (e) { | |
sessionStorage = false; | |
} | |
JSON.stringify = JSON.stringify || JSON.encode; | |
JSON.parse = JSON.parse || JSON.decode; | |
if (typeof History.init !== 'undefined') { | |
throw new Error('History.js Core has already been loaded...'); | |
} | |
History.init = function (options) { | |
if (typeof History.Adapter === 'undefined') { | |
return false; | |
} | |
if (typeof History.initCore !== 'undefined') { | |
History.initCore(); | |
} | |
if (typeof History.initHtml4 !== 'undefined') { | |
History.initHtml4(); | |
} | |
return true; | |
}; | |
History.initCore = function (options) { | |
if (typeof History.initCore.initialized !== 'undefined') { | |
return false; | |
} else { | |
History.initCore.initialized = true; | |
} | |
History.options = History.options || {}; | |
History.options.hashChangeInterval = History.options.hashChangeInterval || 100; | |
History.options.safariPollInterval = History.options.safariPollInterval || 500; | |
History.options.doubleCheckInterval = History.options.doubleCheckInterval || 500; | |
History.options.disableSuid = History.options.disableSuid || false; | |
History.options.storeInterval = History.options.storeInterval || 1000; | |
History.options.busyDelay = History.options.busyDelay || 250; | |
History.options.debug = History.options.debug || false; | |
History.options.initialTitle = History.options.initialTitle || document.title; | |
History.options.html4Mode = History.options.html4Mode || false; | |
History.options.delayInit = History.options.delayInit || false; | |
History.intervalList = []; | |
History.clearAllIntervals = function () { | |
var i, il = History.intervalList; | |
if (typeof il !== "undefined" && il !== null) { | |
for (i = 0; i < il.length; i++) { | |
clearInterval(il[i]); | |
} | |
History.intervalList = null; | |
} | |
}; | |
History.debug = function () { | |
if ((History.options.debug || false)) { | |
History.log.apply(History, arguments); | |
} | |
}; | |
History.log = function () { | |
var | |
consoleExists = !(typeof console === 'undefined' || typeof console.log === 'undefined' || typeof console.log.apply === 'undefined'), | |
textarea = document.getElementById('log'), | |
message, i, n, args, arg; | |
if (consoleExists) { | |
args = Array.prototype.slice.call(arguments); | |
message = args.shift(); | |
if (typeof console.debug !== 'undefined') { | |
console.debug.apply(console, [message, args]); | |
} else { | |
console.log.apply(console, [message, args]); | |
} | |
} else { | |
message = ("\n" + arguments[0] + "\n"); | |
} | |
for (i = 1, n = arguments.length; i < n; ++i) { | |
arg = arguments[i]; | |
if (typeof arg === 'object' && typeof JSON !== 'undefined') { | |
try { | |
arg = JSON.stringify(arg); | |
} catch (Exception) {} | |
} | |
message += "\n" + arg + "\n"; | |
} | |
if (textarea) { | |
textarea.value += message + "\n-----\n"; | |
textarea.scrollTop = textarea.scrollHeight - textarea.clientHeight; | |
} else if (!consoleExists) { | |
alert(message); | |
} | |
return true; | |
}; | |
History.getInternetExplorerMajorVersion = function () { | |
var result = History.getInternetExplorerMajorVersion.cached = (typeof History.getInternetExplorerMajorVersion.cached !== 'undefined') ? History.getInternetExplorerMajorVersion.cached : (function () { | |
var v = 3, | |
div = document.createElement('div'), | |
all = div.getElementsByTagName('i'); | |
while ((div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->') && all[0]) {} | |
return (v > 4) ? v : false; | |
})(); | |
return result; | |
}; | |
History.isInternetExplorer = function () { | |
var result = History.isInternetExplorer.cached = (typeof History.isInternetExplorer.cached !== 'undefined') ? History.isInternetExplorer.cached : Boolean(History.getInternetExplorerMajorVersion()); | |
return result; | |
}; | |
if (History.options.html4Mode) { | |
History.emulated = { | |
pushState: true, | |
hashChange: true | |
}; | |
} else { | |
History.emulated = { | |
pushState: !Boolean(window.history && window.history.pushState && window.history.replaceState && !((/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent) || (/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent))), | |
hashChange: Boolean(!(('onhashchange' in window) || ('onhashchange' in document)) || (History.isInternetExplorer() && History.getInternetExplorerMajorVersion() < 8)) | |
}; | |
} | |
History.enabled = !History.emulated.pushState; | |
History.bugs = { | |
setHash: Boolean(!History.emulated.pushState && navigator.vendor === 'Apple Computer, Inc.' && /AppleWebKit\/5([0-2]|3[0-3])/.test(navigator.userAgent)), | |
safariPoll: Boolean(!History.emulated.pushState && navigator.vendor === 'Apple Computer, Inc.' && /AppleWebKit\/5([0-2]|3[0-3])/.test(navigator.userAgent)), | |
ieDoubleCheck: Boolean(History.isInternetExplorer() && History.getInternetExplorerMajorVersion() < 8), | |
hashEscape: Boolean(History.isInternetExplorer() && History.getInternetExplorerMajorVersion() < 7) | |
}; | |
History.isEmptyObject = function (obj) { | |
for (var name in obj) { | |
if (obj.hasOwnProperty(name)) { | |
return false; | |
} | |
} | |
return true; | |
}; | |
History.cloneObject = function (obj) { | |
var hash, newObj; | |
if (obj) { | |
hash = JSON.stringify(obj); | |
newObj = JSON.parse(hash); | |
} else { | |
newObj = {}; | |
} | |
return newObj; | |
}; | |
History.getRootUrl = function () { | |
var rootUrl = document.location.protocol + '//' + (document.location.hostname || document.location.host); | |
if (document.location.port || false) { | |
rootUrl += ':' + document.location.port; | |
} | |
rootUrl += '/'; | |
return rootUrl; | |
}; | |
History.getBaseHref = function () { | |
var | |
baseElements = document.getElementsByTagName('base'), | |
baseElement = null, | |
baseHref = ''; | |
if (baseElements.length === 1) { | |
baseElement = baseElements[0]; | |
baseHref = baseElement.href.replace(/[^\/]+$/, ''); | |
} | |
baseHref = baseHref.replace(/\/+$/, ''); | |
if (baseHref) baseHref += '/'; | |
return baseHref; | |
}; | |
History.getBaseUrl = function () { | |
var baseUrl = History.getBaseHref() || History.getBasePageUrl() || History.getRootUrl(); | |
return baseUrl; | |
}; | |
History.getPageUrl = function () { | |
var | |
State = History.getState(false, false), | |
stateUrl = (State || {}).url || History.getLocationHref(), | |
pageUrl; | |
pageUrl = stateUrl.replace(/\/+$/, '').replace(/[^\/]+$/, function (part, index, string) { | |
return (/\./).test(part) ? part : part + '/'; | |
}); | |
return pageUrl; | |
}; | |
History.getBasePageUrl = function () { | |
var basePageUrl = (History.getLocationHref()).replace(/[#\?].*/, '').replace(/[^\/]+$/, function (part, index, string) { | |
return (/[^\/]$/).test(part) ? '' : part; | |
}).replace(/\/+$/, '') + '/'; | |
return basePageUrl; | |
}; | |
History.getFullUrl = function (url, allowBaseHref) { | |
var fullUrl = url, | |
firstChar = url.substring(0, 1); | |
allowBaseHref = (typeof allowBaseHref === 'undefined') ? true : allowBaseHref; | |
if (/[a-z]+\:\/\//.test(url)) {} else if (firstChar === '/') { | |
fullUrl = History.getRootUrl() + url.replace(/^\/+/, ''); | |
} else if (firstChar === '#') { | |
fullUrl = History.getPageUrl().replace(/#.*/, '') + url; | |
} else if (firstChar === '?') { | |
fullUrl = History.getPageUrl().replace(/[\?#].*/, '') + url; | |
} else { | |
if (allowBaseHref) { | |
fullUrl = History.getBaseUrl() + url.replace(/^(\.\/)+/, ''); | |
} else { | |
fullUrl = History.getBasePageUrl() + url.replace(/^(\.\/)+/, ''); | |
} | |
} | |
return fullUrl.replace(/\#$/, ''); | |
}; | |
History.getShortUrl = function (url) { | |
var shortUrl = url, | |
baseUrl = History.getBaseUrl(), | |
rootUrl = History.getRootUrl(); | |
if (History.emulated.pushState) { | |
shortUrl = shortUrl.replace(baseUrl, ''); | |
} | |
shortUrl = shortUrl.replace(rootUrl, '/'); | |
if (History.isTraditionalAnchor(shortUrl)) { | |
shortUrl = './' + shortUrl; | |
} | |
shortUrl = shortUrl.replace(/^(\.\/)+/g, './').replace(/\#$/, ''); | |
return shortUrl; | |
}; | |
History.getLocationHref = function (doc) { | |
doc = doc || document; | |
if (doc.URL === doc.location.href) | |
return doc.location.href; | |
if (doc.location.href === decodeURIComponent(doc.URL)) | |
return doc.URL; | |
if (doc.location.hash && decodeURIComponent(doc.location.href.replace(/^[^#]+/, "")) === doc.location.hash) | |
return doc.location.href; | |
if (doc.URL.indexOf('#') == -1 && doc.location.href.indexOf('#') != -1) | |
return doc.location.href; | |
return doc.URL || doc.location.href; | |
}; | |
History.store = {}; | |
History.idToState = History.idToState || {}; | |
History.stateToId = History.stateToId || {}; | |
History.urlToId = History.urlToId || {}; | |
History.storedStates = History.storedStates || []; | |
History.savedStates = History.savedStates || []; | |
History.normalizeStore = function () { | |
History.store.idToState = History.store.idToState || {}; | |
History.store.urlToId = History.store.urlToId || {}; | |
History.store.stateToId = History.store.stateToId || {}; | |
}; | |
History.getState = function (friendly, create) { | |
if (typeof friendly === 'undefined') { | |
friendly = true; | |
} | |
if (typeof create === 'undefined') { | |
create = true; | |
} | |
var State = History.getLastSavedState(); | |
if (!State && create) { | |
State = History.createStateObject(); | |
} | |
if (friendly) { | |
State = History.cloneObject(State); | |
State.url = State.cleanUrl || State.url; | |
} | |
return State; | |
}; | |
History.getIdByState = function (newState) { | |
var id = History.extractId(newState.url), | |
str; | |
if (!id) { | |
str = History.getStateString(newState); | |
if (typeof History.stateToId[str] !== 'undefined') { | |
id = History.stateToId[str]; | |
} else if (typeof History.store.stateToId[str] !== 'undefined') { | |
id = History.store.stateToId[str]; | |
} else { | |
while (true) { | |
id = (new Date()).getTime() + String(Math.random()).replace(/\D/g, ''); | |
if (typeof History.idToState[id] === 'undefined' && typeof History.store.idToState[id] === 'undefined') { | |
break; | |
} | |
} | |
History.stateToId[str] = id; | |
History.idToState[id] = newState; | |
} | |
} | |
return id; | |
}; | |
History.normalizeState = function (oldState) { | |
var newState, dataNotEmpty; | |
if (!oldState || (typeof oldState !== 'object')) { | |
oldState = {}; | |
} | |
if (typeof oldState.normalized !== 'undefined') { | |
return oldState; | |
} | |
if (!oldState.data || (typeof oldState.data !== 'object')) { | |
oldState.data = {}; | |
} | |
newState = {}; | |
newState.normalized = true; | |
newState.title = oldState.title || ''; | |
newState.url = History.getFullUrl(oldState.url ? oldState.url : (History.getLocationHref())); | |
newState.hash = History.getShortUrl(newState.url); | |
newState.data = History.cloneObject(oldState.data); | |
newState.id = History.getIdByState(newState); | |
newState.cleanUrl = newState.url.replace(/\??\&_suid.*/, ''); | |
newState.url = newState.cleanUrl; | |
dataNotEmpty = !History.isEmptyObject(newState.data); | |
if ((newState.title || dataNotEmpty) && History.options.disableSuid !== true) { | |
newState.hash = History.getShortUrl(newState.url).replace(/\??\&_suid.*/, ''); | |
if (!/\?/.test(newState.hash)) { | |
newState.hash += '?'; | |
} | |
newState.hash += '&_suid=' + newState.id; | |
} | |
newState.hashedUrl = History.getFullUrl(newState.hash); | |
if ((History.emulated.pushState || History.bugs.safariPoll) && History.hasUrlDuplicate(newState)) { | |
newState.url = newState.hashedUrl; | |
} | |
return newState; | |
}; | |
History.createStateObject = function (data, title, url) { | |
var State = { | |
'data': data, | |
'title': title, | |
'url': url | |
}; | |
State = History.normalizeState(State); | |
return State; | |
}; | |
History.getStateById = function (id) { | |
id = String(id); | |
var State = History.idToState[id] || History.store.idToState[id] || undefined; | |
return State; | |
}; | |
History.getStateString = function (passedState) { | |
var State, cleanedState, str; | |
State = History.normalizeState(passedState); | |
cleanedState = { | |
data: State.data, | |
title: passedState.title, | |
url: passedState.url | |
}; | |
str = JSON.stringify(cleanedState); | |
return str; | |
}; | |
History.getStateId = function (passedState) { | |
var State, id; | |
State = History.normalizeState(passedState); | |
id = State.id; | |
return id; | |
}; | |
History.getHashByState = function (passedState) { | |
var State, hash; | |
State = History.normalizeState(passedState); | |
hash = State.hash; | |
return hash; | |
}; | |
History.extractId = function (url_or_hash) { | |
var id, parts, url, tmp; | |
if (url_or_hash.indexOf('#') != -1) { | |
tmp = url_or_hash.split("#")[0]; | |
} else { | |
tmp = url_or_hash; | |
} | |
parts = /(.*)\&_suid=([0-9]+)$/.exec(tmp); | |
url = parts ? (parts[1] || url_or_hash) : url_or_hash; | |
id = parts ? String(parts[2] || '') : ''; | |
return id || false; | |
}; | |
History.isTraditionalAnchor = function (url_or_hash) { | |
var isTraditional = !(/[\/\?\.]/.test(url_or_hash)); | |
return isTraditional; | |
}; | |
History.extractState = function (url_or_hash, create) { | |
var State = null, | |
id, url; | |
create = create || false; | |
id = History.extractId(url_or_hash); | |
if (id) { | |
State = History.getStateById(id); | |
} | |
if (!State) { | |
url = History.getFullUrl(url_or_hash); | |
id = History.getIdByUrl(url) || false; | |
if (id) { | |
State = History.getStateById(id); | |
} | |
if (!State && create && !History.isTraditionalAnchor(url_or_hash)) { | |
State = History.createStateObject(null, null, url); | |
} | |
} | |
return State; | |
}; | |
History.getIdByUrl = function (url) { | |
var id = History.urlToId[url] || History.store.urlToId[url] || undefined; | |
return id; | |
}; | |
History.getLastSavedState = function () { | |
return History.savedStates[History.savedStates.length - 1] || undefined; | |
}; | |
History.getLastStoredState = function () { | |
return History.storedStates[History.storedStates.length - 1] || undefined; | |
}; | |
History.hasUrlDuplicate = function (newState) { | |
var hasDuplicate = false, | |
oldState; | |
oldState = History.extractState(newState.url); | |
hasDuplicate = oldState && oldState.id !== newState.id; | |
return hasDuplicate; | |
}; | |
History.storeState = function (newState) { | |
History.urlToId[newState.url] = newState.id; | |
History.storedStates.push(History.cloneObject(newState)); | |
return newState; | |
}; | |
History.isLastSavedState = function (newState) { | |
var isLast = false, | |
newId, oldState, oldId; | |
if (History.savedStates.length) { | |
newId = newState.id; | |
oldState = History.getLastSavedState(); | |
oldId = oldState.id; | |
isLast = (newId === oldId); | |
} | |
return isLast; | |
}; | |
History.saveState = function (newState) { | |
if (History.isLastSavedState(newState)) { | |
return false; | |
} | |
History.savedStates.push(History.cloneObject(newState)); | |
return true; | |
}; | |
History.getStateByIndex = function (index) { | |
var State = null; | |
if (typeof index === 'undefined') { | |
State = History.savedStates[History.savedStates.length - 1]; | |
} else if (index < 0) { | |
State = History.savedStates[History.savedStates.length + index]; | |
} else { | |
State = History.savedStates[index]; | |
} | |
return State; | |
}; | |
History.getCurrentIndex = function () { | |
var index = null; | |
if (History.savedStates.length < 1) { | |
index = 0; | |
} else { | |
index = History.savedStates.length - 1; | |
} | |
return index; | |
}; | |
History.getHash = function (doc) { | |
var url = History.getLocationHref(doc), | |
hash; | |
hash = History.getHashByUrl(url); | |
return hash; | |
}; | |
History.unescapeHash = function (hash) { | |
var result = History.normalizeHash(hash); | |
result = decodeURIComponent(result); | |
return result; | |
}; | |
History.normalizeHash = function (hash) { | |
var result = hash.replace(/[^#]*#/, '').replace(/#.*/, ''); | |
return result; | |
}; | |
History.setHash = function (hash, queue) { | |
var State, pageUrl; | |
if (queue !== false && History.busy()) { | |
History.pushQueue({ | |
scope: History, | |
callback: History.setHash, | |
args: arguments, | |
queue: queue | |
}); | |
return false; | |
} | |
History.busy(true); | |
State = History.extractState(hash, true); | |
if (State && !History.emulated.pushState) { | |
History.pushState(State.data, State.title, State.url, false); | |
} else if (History.getHash() !== hash) { | |
if (History.bugs.setHash) { | |
pageUrl = History.getPageUrl(); | |
History.pushState(null, null, pageUrl + '#' + hash, false); | |
} else { | |
document.location.hash = hash; | |
} | |
} | |
return History; | |
}; | |
History.escapeHash = function (hash) { | |
var result = History.normalizeHash(hash); | |
result = window.encodeURIComponent(result); | |
if (!History.bugs.hashEscape) { | |
result = result | |
.replace(/\%21/g, '!') | |
.replace(/\%26/g, '&') | |
.replace(/\%3D/g, '=') | |
.replace(/\%3F/g, '?'); | |
} | |
return result; | |
}; | |
History.getHashByUrl = function (url) { | |
var hash = String(url) | |
.replace(/([^#]*)#?([^#]*)#?(.*)/, '$2'); | |
hash = History.unescapeHash(hash); | |
return hash; | |
}; | |
History.setTitle = function (newState) { | |
var title = newState.title, | |
firstState; | |
if (!title) { | |
firstState = History.getStateByIndex(0); | |
if (firstState && firstState.url === newState.url) { | |
title = firstState.title || History.options.initialTitle; | |
} | |
} | |
try { | |
document.getElementsByTagName('title')[0].innerHTML = title.replace('<', '<').replace('>', '>').replace(' & ', ' & '); | |
} catch (Exception) {} | |
document.title = title; | |
return History; | |
}; | |
History.queues = []; | |
History.busy = function (value) { | |
if (typeof value !== 'undefined') { | |
History.busy.flag = value; | |
} else if (typeof History.busy.flag === 'undefined') { | |
History.busy.flag = false; | |
} | |
if (!History.busy.flag) { | |
clearTimeout(History.busy.timeout); | |
var fireNext = function () { | |
var i, queue, item; | |
if (History.busy.flag) return; | |
for (i = History.queues.length - 1; i >= 0; --i) { | |
queue = History.queues[i]; | |
if (queue.length === 0) continue; | |
item = queue.shift(); | |
History.fireQueueItem(item); | |
History.busy.timeout = setTimeout(fireNext, History.options.busyDelay); | |
} | |
}; | |
History.busy.timeout = setTimeout(fireNext, History.options.busyDelay); | |
} | |
return History.busy.flag; | |
}; | |
History.busy.flag = false; | |
History.fireQueueItem = function (item) { | |
return item.callback.apply(item.scope || History, item.args || []); | |
}; | |
History.pushQueue = function (item) { | |
History.queues[item.queue || 0] = History.queues[item.queue || 0] || []; | |
History.queues[item.queue || 0].push(item); | |
return History; | |
}; | |
History.queue = function (item, queue) { | |
if (typeof item === 'function') { | |
item = { | |
callback: item | |
}; | |
} | |
if (typeof queue !== 'undefined') { | |
item.queue = queue; | |
} | |
if (History.busy()) { | |
History.pushQueue(item); | |
} else { | |
History.fireQueueItem(item); | |
} | |
return History; | |
}; | |
History.clearQueue = function () { | |
History.busy.flag = false; | |
History.queues = []; | |
return History; | |
}; | |
History.stateChanged = false; | |
History.doubleChecker = false; | |
History.doubleCheckComplete = function () { | |
History.stateChanged = true; | |
History.doubleCheckClear(); | |
return History; | |
}; | |
History.doubleCheckClear = function () { | |
if (History.doubleChecker) { | |
clearTimeout(History.doubleChecker); | |
History.doubleChecker = false; | |
} | |
return History; | |
}; | |
History.doubleCheck = function (tryAgain) { | |
History.stateChanged = false; | |
History.doubleCheckClear(); | |
if (History.bugs.ieDoubleCheck) { | |
History.doubleChecker = setTimeout(function () { | |
History.doubleCheckClear(); | |
if (!History.stateChanged) { | |
tryAgain(); | |
} | |
return true; | |
}, History.options.doubleCheckInterval); | |
} | |
return History; | |
}; | |
History.safariStatePoll = function () { | |
var | |
urlState = History.extractState(History.getLocationHref()), | |
newState; | |
if (!History.isLastSavedState(urlState)) { | |
newState = urlState; | |
} else { | |
return; | |
} | |
if (!newState) { | |
newState = History.createStateObject(); | |
} | |
History.Adapter.trigger(window, 'popstate'); | |
return History; | |
}; | |
History.back = function (queue) { | |
if (queue !== false && History.busy()) { | |
History.pushQueue({ | |
scope: History, | |
callback: History.back, | |
args: arguments, | |
queue: queue | |
}); | |
return false; | |
} | |
History.busy(true); | |
History.doubleCheck(function () { | |
History.back(false); | |
}); | |
history.go(-1); | |
return true; | |
}; | |
History.forward = function (queue) { | |
if (queue !== false && History.busy()) { | |
History.pushQueue({ | |
scope: History, | |
callback: History.forward, | |
args: arguments, | |
queue: queue | |
}); | |
return false; | |
} | |
History.busy(true); | |
History.doubleCheck(function () { | |
History.forward(false); | |
}); | |
history.go(1); | |
return true; | |
}; | |
History.go = function (index, queue) { | |
var i; | |
if (index > 0) { | |
for (i = 1; i <= index; ++i) { | |
History.forward(queue); | |
} | |
} else if (index < 0) { | |
for (i = -1; i >= index; --i) { | |
History.back(queue); | |
} | |
} else { | |
throw new Error('History.go: History.go requires a positive or negative integer passed.'); | |
} | |
return History; | |
}; | |
if (History.emulated.pushState) { | |
var emptyFunction = function () {}; | |
History.pushState = History.pushState || emptyFunction; | |
History.replaceState = History.replaceState || emptyFunction; | |
} else { | |
History.onPopState = function (event, extra) { | |
var stateId = false, | |
newState = false, | |
currentHash, currentState; | |
History.doubleCheckComplete(); | |
currentHash = History.getHash(); | |
if (currentHash) { | |
currentState = History.extractState(currentHash || History.getLocationHref(), true); | |
if (currentState) { | |
History.replaceState(currentState.data, currentState.title, currentState.url, false); | |
} else { | |
History.Adapter.trigger(window, 'anchorchange'); | |
History.busy(false); | |
} | |
History.expectedStateId = false; | |
return false; | |
} | |
stateId = History.Adapter.extractEventData('state', event, extra) || false; | |
if (stateId) { | |
newState = History.getStateById(stateId); | |
} else if (History.expectedStateId) { | |
newState = History.getStateById(History.expectedStateId); | |
} else { | |
newState = History.extractState(History.getLocationHref()); | |
} | |
if (!newState) { | |
newState = History.createStateObject(null, null, History.getLocationHref()); | |
} | |
History.expectedStateId = false; | |
if (History.isLastSavedState(newState)) { | |
History.busy(false); | |
return false; | |
} | |
History.storeState(newState); | |
History.saveState(newState); | |
History.setTitle(newState); | |
History.Adapter.trigger(window, 'statechange'); | |
History.busy(false); | |
return true; | |
}; | |
History.Adapter.bind(window, 'popstate', History.onPopState); | |
History.pushState = function (data, title, url, queue) { | |
if (History.getHashByUrl(url) && History.emulated.pushState) { | |
throw new Error('History.js does not support states with fragement-identifiers (hashes/anchors).'); | |
} | |
if (queue !== false && History.busy()) { | |
History.pushQueue({ | |
scope: History, | |
callback: History.pushState, | |
args: arguments, | |
queue: queue | |
}); | |
return false; | |
} | |
History.busy(true); | |
var newState = History.createStateObject(data, title, url); | |
if (History.isLastSavedState(newState)) { | |
History.busy(false); | |
} else { | |
History.storeState(newState); | |
History.expectedStateId = newState.id; | |
history.pushState(newState.id, newState.title, newState.url); | |
History.Adapter.trigger(window, 'popstate'); | |
} | |
return true; | |
}; | |
History.replaceState = function (data, title, url, queue) { | |
if (History.getHashByUrl(url) && History.emulated.pushState) { | |
throw new Error('History.js does not support states with fragement-identifiers (hashes/anchors).'); | |
} | |
if (queue !== false && History.busy()) { | |
History.pushQueue({ | |
scope: History, | |
callback: History.replaceState, | |
args: arguments, | |
queue: queue | |
}); | |
return false; | |
} | |
History.busy(true); | |
var newState = History.createStateObject(data, title, url); | |
if (History.isLastSavedState(newState)) { | |
History.busy(false); | |
} else { | |
History.storeState(newState); | |
History.expectedStateId = newState.id; | |
history.replaceState(newState.id, newState.title, newState.url); | |
History.Adapter.trigger(window, 'popstate'); | |
} | |
return true; | |
}; | |
} | |
if (sessionStorage) { | |
try { | |
History.store = JSON.parse(sessionStorage.getItem('History.store')) || {}; | |
} catch (err) { | |
History.store = {}; | |
} | |
History.normalizeStore(); | |
} else { | |
History.store = {}; | |
History.normalizeStore(); | |
} | |
History.Adapter.bind(window, "unload", History.clearAllIntervals); | |
History.saveState(History.storeState(History.extractState(History.getLocationHref(), true))); | |
if (sessionStorage) { | |
History.onUnload = function () { | |
var currentStore, item, currentStoreString; | |
try { | |
currentStore = JSON.parse(sessionStorage.getItem('History.store')) || {}; | |
} catch (err) { | |
currentStore = {}; | |
} | |
currentStore.idToState = currentStore.idToState || {}; | |
currentStore.urlToId = currentStore.urlToId || {}; | |
currentStore.stateToId = currentStore.stateToId || {}; | |
for (item in History.idToState) { | |
if (!History.idToState.hasOwnProperty(item)) { | |
continue; | |
} | |
currentStore.idToState[item] = History.idToState[item]; | |
} | |
for (item in History.urlToId) { | |
if (!History.urlToId.hasOwnProperty(item)) { | |
continue; | |
} | |
currentStore.urlToId[item] = History.urlToId[item]; | |
} | |
for (item in History.stateToId) { | |
if (!History.stateToId.hasOwnProperty(item)) { | |
continue; | |
} | |
currentStore.stateToId[item] = History.stateToId[item]; | |
} | |
History.store = currentStore; | |
History.normalizeStore(); | |
currentStoreString = JSON.stringify(currentStore); | |
try { | |
sessionStorage.setItem('History.store', currentStoreString); | |
} catch (e) { | |
if (e.code === DOMException.QUOTA_EXCEEDED_ERR) { | |
if (sessionStorage.length) { | |
sessionStorage.removeItem('History.store'); | |
sessionStorage.setItem('History.store', currentStoreString); | |
} else {} | |
} else { | |
throw e; | |
} | |
} | |
}; | |
History.intervalList.push(setInterval(History.onUnload, History.options.storeInterval)); | |
History.Adapter.bind(window, 'beforeunload', History.onUnload); | |
History.Adapter.bind(window, 'unload', History.onUnload); | |
} | |
if (!History.emulated.pushState) { | |
if (History.bugs.safariPoll) { | |
History.intervalList.push(setInterval(History.safariStatePoll, History.options.safariPollInterval)); | |
} | |
if (navigator.vendor === 'Apple Computer, Inc.' || (navigator.appCodeName || '') === 'Mozilla') { | |
History.Adapter.bind(window, 'hashchange', function () { | |
History.Adapter.trigger(window, 'popstate'); | |
}); | |
if (History.getHash()) { | |
History.Adapter.onDomLoad(function () { | |
History.Adapter.trigger(window, 'hashchange'); | |
}); | |
} | |
} | |
} | |
}; | |
if (!History.options || !History.options.delayInit) { | |
History.init(); | |
} | |
})(window); | |
/* =================================================== | |
* bootstrap-transition.js v2.3.1 | |
* http://twitter.github.com/bootstrap/javascript.html#transitions | |
* =================================================== | |
* Copyright 2012 Twitter, Inc. | |
* | |
* 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 ($) { | |
"use strict"; | |
$(function () { | |
$.support.transition = (function () { | |
var transitionEnd = (function () { | |
var el = document.createElement('bootstrap'), | |
transEndEventNames = { | |
'WebkitTransition': 'webkitTransitionEnd', | |
'MozTransition': 'transitionend', | |
'OTransition': 'oTransitionEnd otransitionend', | |
'transition': 'transitionend' | |
}, | |
name | |
for (name in transEndEventNames) { | |
if (el.style[name] !== undefined) { | |
return transEndEventNames[name] | |
} | |
} | |
}()) | |
return transitionEnd && { | |
end: transitionEnd | |
} | |
})() | |
}) | |
}(window.jQuery); | |
/* ========================================================== | |
* bootstrap-alert.js v2.3.1 | |
* http://twitter.github.com/bootstrap/javascript.html#alerts | |
* ========================================================== | |
* Copyright 2012 Twitter, Inc. | |
* | |
* 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 ($) { | |
"use strict"; | |
var dismiss = '[data-dismiss="alert"]', | |
Alert = function (el) { | |
$(el).on('click', dismiss, this.close) | |
} | |
Alert.prototype.close = function (e) { | |
var $this = $(this), | |
selector = $this.attr('data-target'), | |
$parent | |
if (!selector) { | |
selector = $this.attr('href') | |
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') | |
} | |
$parent = $(selector) | |
e && e.preventDefault() | |
$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) | |
$parent.trigger(e = $.Event('close')) | |
if (e.isDefaultPrevented()) return | |
$parent.removeClass('in') | |
function removeElement() { | |
$parent | |
.trigger('closed') | |
.remove() | |
} | |
$.support.transition && $parent.hasClass('fade') ? $parent.on($.support.transition.end, removeElement) : removeElement() | |
} | |
var old = $.fn.alert | |
$.fn.alert = function (option) { | |
return this.each(function () { | |
var $this = $(this), | |
data = $this.data('alert') | |
if (!data) $this.data('alert', (data = new Alert(this))) | |
if (typeof option == 'string') data[option].call($this) | |
}) | |
} | |
$.fn.alert.Constructor = Alert | |
$.fn.alert.noConflict = function () { | |
$.fn.alert = old | |
return this | |
} | |
$(document).on('click.alert.data-api', dismiss, Alert.prototype.close) | |
}(window.jQuery); | |
/* ============================================================ | |
* bootstrap-button.js v2.3.1 | |
* http://twitter.github.com/bootstrap/javascript.html#buttons | |
* ============================================================ | |
* Copyright 2012 Twitter, Inc. | |
* | |
* 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 ($) { | |
"use strict"; | |
var Button = function (element, options) { | |
this.$element = $(element) | |
this.options = $.extend({}, $.fn.button.defaults, options) | |
} | |
Button.prototype.setState = function (state) { | |
var d = 'disabled', | |
$el = this.$element, | |
data = $el.data(), | |
val = $el.is('input') ? 'val' : 'html' | |
state = state + 'Text' | |
data.resetText || $el.data('resetText', $el[val]()) | |
$el[val](data[state] || this.options[state]) | |
setTimeout(function () { | |
state == 'loadingText' ? $el.addClass(d).attr(d, d) : $el.removeClass(d).removeAttr(d) | |
}, 0) | |
} | |
Button.prototype.toggle = function () { | |
var $parent = this.$element.closest('[data-toggle="buttons-radio"]') | |
$parent && $parent | |
.find('.active') | |
.removeClass('active') | |
this.$element.toggleClass('active') | |
} | |
var old = $.fn.button | |
$.fn.button = function (option) { | |
return this.each(function () { | |
var $this = $(this), | |
data = $this.data('button'), | |
options = typeof option == 'object' && option | |
if (!data) $this.data('button', (data = new Button(this, options))) | |
if (option == 'toggle') data.toggle() | |
else if (option) data.setState(option) | |
}) | |
} | |
$.fn.button.defaults = { | |
loadingText: 'loading...' | |
} | |
$.fn.button.Constructor = Button | |
$.fn.button.noConflict = function () { | |
$.fn.button = old | |
return this | |
} | |
$(document).on('click.button.data-api', '[data-toggle^=button]', function (e) { | |
var $btn = $(e.target) | |
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') | |
$btn.button('toggle') | |
}) | |
}(window.jQuery); | |
/* ========================================================== | |
* bootstrap-carousel.js v2.3.1 | |
* http://twitter.github.com/bootstrap/javascript.html#carousel | |
* ========================================================== | |
* Copyright 2012 Twitter, Inc. | |
* | |
* 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 ($) { | |
"use strict"; | |
var Carousel = function (element, options) { | |
this.$element = $(element) | |
this.$indicators = this.$element.find('.carousel-indicators') | |
this.options = options | |
this.options.pause == 'hover' && this.$element | |
.on('mouseenter', $.proxy(this.pause, this)) | |
.on('mouseleave', $.proxy(this.cycle, this)) | |
} | |
Carousel.prototype = { | |
cycle: function (e) { | |
if (!e) this.paused = false | |
if (this.interval) clearInterval(this.interval); | |
this.options.interval && !this.paused && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) | |
return this | |
}, | |
getActiveIndex: function () { | |
this.$active = this.$element.find('.item.active') | |
this.$items = this.$active.parent().children() | |
return this.$items.index(this.$active) | |
}, | |
to: function (pos) { | |
var activeIndex = this.getActiveIndex(), | |
that = this | |
if (pos > (this.$items.length - 1) || pos < 0) return | |
if (this.sliding) { | |
return this.$element.one('slid', function () { | |
that.to(pos) | |
}) | |
} | |
if (activeIndex == pos) { | |
return this.pause().cycle() | |
} | |
return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) | |
}, | |
pause: function (e) { | |
if (!e) this.paused = true | |
if (this.$element.find('.next, .prev').length && $.support.transition.end) { | |
this.$element.trigger($.support.transition.end) | |
this.cycle(true) | |
} | |
clearInterval(this.interval) | |
this.interval = null | |
return this | |
}, | |
next: function () { | |
if (this.sliding) return | |
return this.slide('next') | |
}, | |
prev: function () { | |
if (this.sliding) return | |
return this.slide('prev') | |
}, | |
slide: function (type, next) { | |
var $active = this.$element.find('.item.active'), | |
$next = next || $active[type](), | |
isCycling = this.interval, | |
direction = type == 'next' ? 'left' : 'right', | |
fallback = type == 'next' ? 'first' : 'last', | |
that = this, | |
e | |
this.sliding = true | |
isCycling && this.pause() | |
$next = $next.length ? $next : this.$element.find('.item')[fallback]() | |
e = $.Event('slide', { | |
relatedTarget: $next[0], | |
direction: direction | |
}) | |
if ($next.hasClass('active')) return | |
if (this.$indicators.length) { | |
this.$indicators.find('.active').removeClass('active') | |
this.$element.one('slid', function () { | |
var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()]) | |
$nextIndicator && $nextIndicator.addClass('active') | |
}) | |
} | |
if ($.support.transition && this.$element.hasClass('slide')) { | |
this.$element.trigger(e) | |
if (e.isDefaultPrevented()) return | |
$next.addClass(type) | |
$next[0].offsetWidth | |
$active.addClass(direction) | |
$next.addClass(direction) | |
this.$element.one($.support.transition.end, function () { | |
$next.removeClass([type, direction].join(' ')).addClass('active') | |
$active.removeClass(['active', direction].join(' ')) | |
that.sliding = false | |
setTimeout(function () { | |
that.$element.trigger('slid') | |
}, 0) | |
}) | |
} else { | |
this.$element.trigger(e) | |
if (e.isDefaultPrevented()) return | |
$active.removeClass('active') | |
$next.addClass('active') | |
this.sliding = false | |
this.$element.trigger('slid') | |
} | |
isCycling && this.cycle() | |
return this | |
} | |
} | |
var old = $.fn.carousel | |
$.fn.carousel = function (option) { | |
return this.each(function () { | |
var $this = $(this), | |
data = $this.data('carousel'), | |
options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option), | |
action = typeof option == 'string' ? option : options.slide | |
if (!data) $this.data('carousel', (data = new Carousel(this, options))) | |
if (typeof option == 'number') data.to(option) | |
else if (action) data[action]() | |
else if (options.interval) data.pause().cycle() | |
}) | |
} | |
$.fn.carousel.defaults = { | |
interval: 5000, | |
pause: 'hover' | |
} | |
$.fn.carousel.Constructor = Carousel | |
$.fn.carousel.noConflict = function () { | |
$.fn.carousel = old | |
return this | |
} | |
$(document).on('click.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { | |
var $this = $(this), | |
href, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')), | |
options = $.extend({}, $target.data(), $this.data()), | |
slideIndex | |
$target.carousel(options) | |
if (slideIndex = $this.attr('data-slide-to')) { | |
$target.data('carousel').pause().to(slideIndex).cycle() | |
} | |
e.preventDefault() | |
}) | |
}(window.jQuery); | |
/* ============================================================= | |
* bootstrap-collapse.js v2.3.1 | |
* http://twitter.github.com/bootstrap/javascript.html#collapse | |
* ============================================================= | |
* Copyright 2012 Twitter, Inc. | |
* | |
* 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 ($) { | |
"use strict"; | |
var Collapse = function (element, options) { | |
this.$element = $(element) | |
this.options = $.extend({}, $.fn.collapse.defaults, options) | |
if (this.options.parent) { | |
this.$parent = $(this.options.parent) | |
} | |
this.options.toggle && this.toggle() | |
} | |
Collapse.prototype = { | |
constructor: Collapse, | |
dimension: function () { | |
var hasWidth = this.$element.hasClass('width') | |
return hasWidth ? 'width' : 'height' | |
}, | |
show: function () { | |
var dimension, scroll, actives, hasData | |
if (this.transitioning || this.$element.hasClass('in')) return | |
dimension = this.dimension() | |
scroll = $.camelCase(['scroll', dimension].join('-')) | |
actives = this.$parent && this.$parent.find('> .accordion-group > .in') | |
if (actives && actives.length) { | |
hasData = actives.data('collapse') | |
if (hasData && hasData.transitioning) return | |
actives.collapse('hide') | |
hasData || actives.data('collapse', null) | |
} | |
this.$element[dimension](0) | |
this.transition('addClass', $.Event('show'), 'shown') | |
$.support.transition && this.$element[dimension](this.$element[0][scroll]) | |
}, | |
hide: function () { | |
var dimension | |
if (this.transitioning || !this.$element.hasClass('in')) return | |
dimension = this.dimension() | |
this.reset(this.$element[dimension]()) | |
this.transition('removeClass', $.Event('hide'), 'hidden') | |
this.$element[dimension](0) | |
}, | |
reset: function (size) { | |
var dimension = this.dimension() | |
this.$element | |
.removeClass('collapse')[dimension](size || 'auto')[0].offsetWidth | |
this.$element[size !== null ? 'addClass' : 'removeClass']('collapse') | |
return this | |
}, | |
transition: function (method, startEvent, completeEvent) { | |
var that = this, | |
complete = function () { | |
if (startEvent.type == 'show') that.reset() | |
that.transitioning = 0 | |
that.$element.trigger(completeEvent) | |
} | |
this.$element.trigger(startEvent) | |
if (startEvent.isDefaultPrevented()) return | |
this.transitioning = 1 | |
this.$element[method]('in') | |
$.support.transition && this.$element.hasClass('collapse') ? this.$element.one($.support.transition.end, complete) : complete() | |
}, | |
toggle: function () { | |
this[this.$element.hasClass('in') ? 'hide' : 'show']() | |
} | |
} | |
var old = $.fn.collapse | |
$.fn.collapse = function (option) { | |
return this.each(function () { | |
var $this = $(this), | |
data = $this.data('collapse'), | |
options = $.extend({}, $.fn.collapse.defaults, $this.data(), typeof option == 'object' && option) | |
if (!data) $this.data('collapse', (data = new Collapse(this, options))) | |
if (typeof option == 'string') data[option]() | |
}) | |
} | |
$.fn.collapse.defaults = { | |
toggle: true | |
} | |
$.fn.collapse.Constructor = Collapse | |
$.fn.collapse.noConflict = function () { | |
$.fn.collapse = old | |
return this | |
} | |
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) { | |
var $this = $(this), | |
href, target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, ''), | |
option = $(target).data('collapse') ? 'toggle' : $this.data() | |
$this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed') | |
$(target).collapse(option) | |
}) | |
}(window.jQuery); | |
/* ============================================================ | |
* bootstrap-dropdown.js v2.3.1 | |
* http://twitter.github.com/bootstrap/javascript.html#dropdowns | |
* ============================================================ | |
* Copyright 2012 Twitter, Inc. | |
* | |
* 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 ($) { | |
"use strict"; | |
var toggle = '[data-toggle=dropdown]', | |
Dropdown = function (element) { | |
var $el = $(element).on('click.dropdown.data-api', this.toggle) | |
$('html').on('click.dropdown.data-api', function () { | |
$el.parent().removeClass('open') | |
}) | |
} | |
Dropdown.prototype = { | |
constructor: Dropdown, | |
toggle: function (e) { | |
var $this = $(this), | |
$parent, isActive | |
if ($this.is('.disabled, :disabled')) return | |
$parent = getParent($this) | |
isActive = $parent.hasClass('open') | |
clearMenus() | |
if (!isActive) { | |
$parent.toggleClass('open') | |
} | |
$this.focus() | |
return false | |
}, | |
keydown: function (e) { | |
var $this, $items, $active, $parent, isActive, index | |
if (!/(38|40|27)/.test(e.keyCode)) return | |
$this = $(this) | |
e.preventDefault() | |
e.stopPropagation() | |
if ($this.is('.disabled, :disabled')) return | |
$parent = getParent($this) | |
isActive = $parent.hasClass('open') | |
if (!isActive || (isActive && e.keyCode == 27)) { | |
if (e.which == 27) $parent.find(toggle).focus() | |
return $this.click() | |
} | |
$items = $('[role=menu] li:not(.divider):visible a', $parent) | |
if (!$items.length) return | |
index = $items.index($items.filter(':focus')) | |
if (e.keyCode == 38 && index > 0) index-- | |
if (e.keyCode == 40 && index < $items.length - 1) index++ | |
if (!~index) index = 0 | |
$items | |
.eq(index) | |
.focus() | |
} | |
} | |
function clearMenus() { | |
$(toggle).each(function () { | |
getParent($(this)).removeClass('open') | |
}) | |
} | |
function getParent($this) { | |
var selector = $this.attr('data-target'), | |
$parent | |
if (!selector) { | |
selector = $this.attr('href') | |
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') | |
} | |
$parent = selector && $(selector) | |
if (!$parent || !$parent.length) $parent = $this.parent() | |
return $parent | |
} | |
var old = $.fn.dropdown | |
$.fn.dropdown = function (option) { | |
return this.each(function () { | |
var $this = $(this), | |
data = $this.data('dropdown') | |
if (!data) $this.data('dropdown', (data = new Dropdown(this))) | |
if (typeof option == 'string') data[option].call($this) | |
}) | |
} | |
$.fn.dropdown.Constructor = Dropdown | |
$.fn.dropdown.noConflict = function () { | |
$.fn.dropdown = old | |
return this | |
} | |
$(document) | |
.on('click.dropdown.data-api', clearMenus) | |
.on('click.dropdown.data-api', '.dropdown form', function (e) { | |
e.stopPropagation() | |
}) | |
.on('click.dropdown-menu', function (e) { | |
e.stopPropagation() | |
}) | |
.on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle) | |
.on('keydown.dropdown.data-api', toggle + ', [role=menu]', Dropdown.prototype.keydown) | |
}(window.jQuery); | |
/* ========================================================= | |
* bootstrap-modal.js v2.3.1 | |
* http://twitter.github.com/bootstrap/javascript.html#modals | |
* ========================================================= | |
* Copyright 2012 Twitter, Inc. | |
* | |
* 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 ($) { | |
"use strict"; | |
var Modal = function (element, options) { | |
this.options = options | |
this.$element = $(element) | |
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) | |
this.options.remote && this.$element.find('.modal-body').load(this.options.remote) | |
} | |
Modal.prototype = { | |
constructor: Modal, | |
toggle: function () { | |
return this[!this.isShown ? 'show' : 'hide']() | |
}, | |
show: function () { | |
var that = this, | |
e = $.Event('show') | |
this.$element.trigger(e) | |
if (this.isShown || e.isDefaultPrevented()) return | |
this.isShown = true | |
this.escape() | |
this.backdrop(function () { | |
var transition = $.support.transition && that.$element.hasClass('fade') | |
if (!that.$element.parent().length) { | |
that.$element.appendTo(document.body) | |
} | |
that.$element.show() | |
if (transition) { | |
that.$element[0].offsetWidth | |
} | |
that.$element | |
.addClass('in') | |
.attr('aria-hidden', false) | |
that.enforceFocus() | |
transition ? that.$element.one($.support.transition.end, function () { | |
that.$element.focus().trigger('shown') | |
}) : that.$element.focus().trigger('shown') | |
}) | |
}, | |
hide: function (e) { | |
e && e.preventDefault() | |
var that = this | |
e = $.Event('hide') | |
this.$element.trigger(e) | |
if (!this.isShown || e.isDefaultPrevented()) return | |
this.isShown = false | |
this.escape() | |
$(document).off('focusin.modal') | |
this.$element | |
.removeClass('in') | |
.attr('aria-hidden', true) | |
$.support.transition && this.$element.hasClass('fade') ? this.hideWithTransition() : this.hideModal() | |
}, | |
enforceFocus: function () { | |
var that = this | |
$(document).on('focusin.modal', function (e) { | |
if (that.$element[0] !== e.target && !that.$element.has(e.target).length) { | |
that.$element.focus() | |
} | |
}) | |
}, | |
escape: function () { | |
var that = this | |
if (this.isShown && this.options.keyboard) { | |
this.$element.on('keyup.dismiss.modal', function (e) { | |
e.which == 27 && that.hide() | |
}) | |
} else if (!this.isShown) { | |
this.$element.off('keyup.dismiss.modal') | |
} | |
}, | |
hideWithTransition: function () { | |
var that = this, | |
timeout = setTimeout(function () { | |
that.$element.off($.support.transition.end) | |
that.hideModal() | |
}, 500) | |
this.$element.one($.support.transition.end, function () { | |
clearTimeout(timeout) | |
that.hideModal() | |
}) | |
}, | |
hideModal: function () { | |
var that = this | |
this.$element.hide() | |
this.backdrop(function () { | |
that.removeBackdrop() | |
that.$element.trigger('hidden') | |
}) | |
}, | |
removeBackdrop: function () { | |
this.$backdrop && this.$backdrop.remove() | |
this.$backdrop = null | |
}, | |
backdrop: function (callback) { | |
var that = this, | |
animate = this.$element.hasClass('fade') ? 'fade' : '' | |
if (this.isShown && this.options.backdrop) { | |
var doAnimate = $.support.transition && animate | |
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') | |
.appendTo(document.body) | |
this.$backdrop.click(this.options.backdrop == 'static' ? $.proxy(this.$element[0].focus, this.$element[0]) : $.proxy(this.hide, this)) | |
if (doAnimate) this.$backdrop[0].offsetWidth | |
this.$backdrop.addClass('in') | |
if (!callback) return | |
doAnimate ? this.$backdrop.one($.support.transition.end, callback) : callback() | |
} else if (!this.isShown && this.$backdrop) { | |
this.$backdrop.removeClass('in') | |
$.support.transition && this.$element.hasClass('fade') ? this.$backdrop.one($.support.transition.end, callback) : callback() | |
} else if (callback) { | |
callback() | |
} | |
} | |
} | |
var old = $.fn.modal | |
$.fn.modal = function (option) { | |
return this.each(function () { | |
var $this = $(this), | |
data = $this.data('modal'), | |
options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option) | |
if (!data) $this.data('modal', (data = new Modal(this, options))) | |
if (typeof option == 'string') data[option]() | |
else if (options.show) data.show() | |
}) | |
} | |
$.fn.modal.defaults = { | |
backdrop: true, | |
keyboard: true, | |
show: true | |
} | |
$.fn.modal.Constructor = Modal | |
$.fn.modal.noConflict = function () { | |
$.fn.modal = old | |
return this | |
} | |
$(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) { | |
var $this = $(this), | |
href = $this.attr('href'), | |
$target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))), | |
option = $target.data('modal') ? 'toggle' : $.extend({ | |
remote: !/#/.test(href) && href | |
}, $target.data(), $this.data()) | |
e.preventDefault() | |
$target | |
.modal(option) | |
.one('hide', function () { | |
$this.focus() | |
}) | |
}) | |
}(window.jQuery); | |
/* =========================================================== | |
* bootstrap-tooltip.js v2.3.1 | |
* http://twitter.github.com/bootstrap/javascript.html#tooltips | |
* Inspired by the original jQuery.tipsy by Jason Frame | |
* =========================================================== | |
* Copyright 2012 Twitter, Inc. | |
* | |
* 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 ($) { | |
"use strict"; | |
var Tooltip = function (element, options) { | |
this.init('tooltip', element, options) | |
} | |
Tooltip.prototype = { | |
constructor: Tooltip, | |
init: function (type, element, options) { | |
var eventIn, eventOut, triggers, trigger, i | |
this.type = type | |
this.$element = $(element) | |
this.options = this.getOptions(options) | |
this.enabled = true | |
triggers = this.options.trigger.split(' ') | |
for (i = triggers.length; i--;) { | |
trigger = triggers[i] | |
if (trigger == 'click') { | |
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) | |
} else if (trigger != 'manual') { | |
eventIn = trigger == 'hover' ? 'mouseenter' : 'focus' | |
eventOut = trigger == 'hover' ? 'mouseleave' : 'blur' | |
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) | |
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) | |
} | |
} | |
this.options.selector ? (this._options = $.extend({}, this.options, { | |
trigger: 'manual', | |
selector: '' | |
})) : this.fixTitle() | |
}, | |
getOptions: function (options) { | |
options = $.extend({}, $.fn[this.type].defaults, this.$element.data(), options) | |
if (options.delay && typeof options.delay == 'number') { | |
options.delay = { | |
show: options.delay, | |
hide: options.delay | |
} | |
} | |
return options | |
}, | |
enter: function (e) { | |
var defaults = $.fn[this.type].defaults, | |
options = {}, | |
self | |
this._options && $.each(this._options, function (key, value) { | |
if (defaults[key] != value) options[key] = value | |
}, this) | |
self = $(e.currentTarget)[this.type](options).data(this.type) | |
if (!self.options.delay || !self.options.delay.show) return self.show() | |
clearTimeout(this.timeout) | |
self.hoverState = 'in' | |
this.timeout = setTimeout(function () { | |
if (self.hoverState == 'in') self.show() | |
}, self.options.delay.show) | |
}, | |
leave: function (e) { | |
var self = $(e.currentTarget)[this.type](this._options).data(this.type) | |
if (this.timeout) clearTimeout(this.timeout) | |
if (!self.options.delay || !self.options.delay.hide) return self.hide() | |
self.hoverState = 'out' | |
this.timeout = setTimeout(function () { | |
if (self.hoverState == 'out') self.hide() | |
}, self.options.delay.hide) | |
}, | |
show: function () { | |
var $tip, pos, actualWidth, actualHeight, placement, tp, e = $.Event('show') | |
if (this.hasContent() && this.enabled) { | |
this.$element.trigger(e) | |
if (e.isDefaultPrevented()) return | |
$tip = this.tip() | |
this.setContent() | |
if (this.options.animation) { | |
$tip.addClass('fade') | |
} | |
placement = typeof this.options.placement == 'function' ? this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement | |
$tip | |
.detach() | |
.css({ | |
top: 0, | |
left: 0, | |
display: 'block' | |
}) | |
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) | |
pos = this.getPosition() | |
actualWidth = $tip[0].offsetWidth | |
actualHeight = $tip[0].offsetHeight | |
switch (placement) { | |
case 'bottom': | |
tp = { | |
top: pos.top + pos.height, | |
left: pos.left + pos.width / 2 - actualWidth / 2 | |
} | |
break | |
case 'top': | |
tp = { | |
top: pos.top - actualHeight, | |
left: pos.left + pos.width / 2 - actualWidth / 2 | |
} | |
break | |
case 'left': | |
tp = { | |
top: pos.top + pos.height / 2 - actualHeight / 2, | |
left: pos.left - actualWidth | |
} | |
break | |
case 'right': | |
tp = { | |
top: pos.top + pos.height / 2 - actualHeight / 2, | |
left: pos.left + pos.width | |
} | |
break | |
} | |
this.applyPlacement(tp, placement) | |
this.$element.trigger('shown') | |
} | |
}, | |
applyPlacement: function (offset, placement) { | |
var $tip = this.tip(), | |
width = $tip[0].offsetWidth, | |
height = $tip[0].offsetHeight, | |
actualWidth, actualHeight, delta, replace | |
$tip | |
.offset(offset) | |
.addClass(placement) | |
.addClass('in') | |
actualWidth = $tip[0].offsetWidth | |
actualHeight = $tip[0].offsetHeight | |
if (placement == 'top' && actualHeight != height) { | |
offset.top = offset.top + height - actualHeight | |
replace = true | |
} | |
if (placement == 'bottom' || placement == 'top') { | |
delta = 0 | |
if (offset.left < 0) { | |
delta = offset.left * -2 | |
offset.left = 0 | |
$tip.offset(offset) | |
actualWidth = $tip[0].offsetWidth | |
actualHeight = $tip[0].offsetHeight | |
} | |
this.replaceArrow(delta - width + actualWidth, actualWidth, 'left') | |
} else { | |
this.replaceArrow(actualHeight - height, actualHeight, 'top') | |
} | |
if (replace) $tip.offset(offset) | |
}, | |
replaceArrow: function (delta, dimension, position) { | |
this | |
.arrow() | |
.css(position, delta ? (50 * (1 - delta / dimension) + "%") : '') | |
}, | |
setContent: function () { | |
var $tip = this.tip(), | |
title = this.getTitle() | |
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) | |
$tip.removeClass('fade in top bottom left right') | |
}, | |
hide: function () { | |
var that = this, | |
$tip = this.tip(), | |
e = $.Event('hide') | |
this.$element.trigger(e) | |
if (e.isDefaultPrevented()) return | |
$tip.removeClass('in') | |
function removeWithAnimation() { | |
var timeout = setTimeout(function () { | |
$tip.off($.support.transition.end).detach() | |
}, 500) | |
$tip.one($.support.transition.end, function () { | |
clearTimeout(timeout) | |
$tip.detach() | |
}) | |
} | |
$.support.transition && this.$tip.hasClass('fade') ? removeWithAnimation() : $tip.detach() | |
this.$element.trigger('hidden') | |
return this | |
}, | |
fixTitle: function () { | |
var $e = this.$element | |
if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') { | |
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '') | |
} | |
}, | |
hasContent: function () { | |
return this.getTitle() | |
}, | |
getPosition: function () { | |
var el = this.$element[0] | |
return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : { | |
width: el.offsetWidth, | |
height: el.offsetHeight | |
}, this.$element.offset()) | |
}, | |
getTitle: function () { | |
var title, $e = this.$element, | |
o = this.options | |
title = $e.attr('data-original-title') || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) | |
return title | |
}, | |
tip: function () { | |
return this.$tip = this.$tip || $(this.options.template) | |
}, | |
arrow: function () { | |
return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow") | |
}, | |
validate: function () { | |
if (!this.$element[0].parentNode) { | |
this.hide() | |
this.$element = null | |
this.options = null | |
} | |
}, | |
enable: function () { | |
this.enabled = true | |
}, | |
disable: function () { | |
this.enabled = false | |
}, | |
toggleEnabled: function () { | |
this.enabled = !this.enabled | |
}, | |
toggle: function (e) { | |
var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this | |
self.tip().hasClass('in') ? self.hide() : self.show() | |
}, | |
destroy: function () { | |
this.hide().$element.off('.' + this.type).removeData(this.type) | |
} | |
} | |
var old = $.fn.tooltip | |
$.fn.tooltip = function (option) { | |
return this.each(function () { | |
var $this = $(this), | |
data = $this.data('tooltip'), | |
options = typeof option == 'object' && option | |
if (!data) $this.data('tooltip', (data = new Tooltip(this, options))) | |
if (typeof option == 'string') data[option]() | |
}) | |
} | |
$.fn.tooltip.Constructor = Tooltip | |
$.fn.tooltip.defaults = { | |
animation: true, | |
placement: 'top', | |
selector: false, | |
template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', | |
trigger: 'hover focus', | |
title: '', | |
delay: 0, | |
html: false, | |
container: false | |
} | |
$.fn.tooltip.noConflict = function () { | |
$.fn.tooltip = old | |
return this | |
} | |
}(window.jQuery); | |
/* =========================================================== | |
* bootstrap-popover.js v2.3.1 | |
* http://twitter.github.com/bootstrap/javascript.html#popovers | |
* =========================================================== | |
* Copyright 2012 Twitter, Inc. | |
* | |
* 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 ($) { | |
"use strict"; | |
var Popover = function (element, options) { | |
this.init('popover', element, options) | |
} | |
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, { | |
constructor: Popover, | |
setContent: function () { | |
var $tip = this.tip(), | |
title = this.getTitle(), | |
content = this.getContent() | |
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) | |
$tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content) | |
$tip.removeClass('fade top bottom left right in') | |
}, | |
hasContent: function () { | |
return this.getTitle() || this.getContent() | |
}, | |
getContent: function () { | |
var content, $e = this.$element, | |
o = this.options | |
content = (typeof o.content == 'function' ? o.content.call($e[0]) : o.content) || $e.attr('data-content') | |
return content | |
}, | |
tip: function () { | |
if (!this.$tip) { | |
this.$tip = $(this.options.template) | |
} | |
return this.$tip | |
}, | |
destroy: function () { | |
this.hide().$element.off('.' + this.type).removeData(this.type) | |
} | |
}) | |
var old = $.fn.popover | |
$.fn.popover = function (option) { | |
return this.each(function () { | |
var $this = $(this), | |
data = $this.data('popover'), | |
options = typeof option == 'object' && option | |
if (!data) $this.data('popover', (data = new Popover(this, options))) | |
if (typeof option == 'string') data[option]() | |
}) | |
} | |
$.fn.popover.Constructor = Popover | |
$.fn.popover.defaults = $.extend({}, $.fn.tooltip.defaults, { | |
placement: 'right', | |
trigger: 'click', | |
content: '', | |
template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' | |
}) | |
$.fn.popover.noConflict = function () { | |
$.fn.popover = old | |
return this | |
} | |
}(window.jQuery); | |
/* ============================================================= | |
* bootstrap-scrollspy.js v2.3.1 | |
* http://twitter.github.com/bootstrap/javascript.html#scrollspy | |
* ============================================================= | |
* Copyright 2012 Twitter, Inc. | |
* | |
* 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 ($) { | |
"use strict"; | |
function ScrollSpy(element, options) { | |
var process = $.proxy(this.process, this), | |
$element = $(element).is('body') ? $(window) : $(element), | |
href | |
this.options = $.extend({}, $.fn.scrollspy.defaults, options) | |
this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process) | |
this.selector = (this.options.target || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) || '') + ' .nav li > a' | |
this.$body = $('body') | |
this.refresh() | |
this.process() | |
} | |
ScrollSpy.prototype = { | |
constructor: ScrollSpy, | |
refresh: function () { | |
var self = this, | |
$targets | |
this.offsets = $([]) | |
this.targets = $([]) | |
$targets = this.$body | |
.find(this.selector) | |
.map(function () { | |
var $el = $(this), | |
href = $el.data('target') || $el.attr('href'), | |
$href = /^#\w/.test(href) && $(href) | |
return ($href && $href.length && [ | |
[$href.position().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href] | |
]) || null | |
}) | |
.sort(function (a, b) { | |
return a[0] - b[0] | |
}) | |
.each(function () { | |
self.offsets.push(this[0]) | |
self.targets.push(this[1]) | |
}) | |
}, | |
process: function () { | |
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset, | |
scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight, | |
maxScroll = scrollHeight - this.$scrollElement.height(), | |
offsets = this.offsets, | |
targets = this.targets, | |
activeTarget = this.activeTarget, | |
i | |
if (scrollTop >= maxScroll) { | |
return activeTarget != (i = targets.last()[0]) && this.activate(i) | |
} | |
for (i = offsets.length; i--;) { | |
activeTarget != targets[i] && scrollTop >= offsets[i] && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) && this.activate(targets[i]) | |
} | |
}, | |
activate: function (target) { | |
var active, selector | |
this.activeTarget = target | |
$(this.selector) | |
.parent('.active') | |
.removeClass('active') | |
selector = this.selector + '[data-target="' + target + '"],' + this.selector + '[href="' + target + '"]' | |
active = $(selector) | |
.parent('li') | |
.addClass('active') | |
if (active.parent('.dropdown-menu').length) { | |
active = active.closest('li.dropdown').addClass('active') | |
} | |
active.trigger('activate') | |
} | |
} | |
var old = $.fn.scrollspy | |
$.fn.scrollspy = function (option) { | |
return this.each(function () { | |
var $this = $(this), | |
data = $this.data('scrollspy'), | |
options = typeof option == 'object' && option | |
if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options))) | |
if (typeof option == 'string') data[option]() | |
}) | |
} | |
$.fn.scrollspy.Constructor = ScrollSpy | |
$.fn.scrollspy.defaults = { | |
offset: 10 | |
} | |
$.fn.scrollspy.noConflict = function () { | |
$.fn.scrollspy = old | |
return this | |
} | |
$(window).on('load', function () { | |
$('[data-spy="scroll"]').each(function () { | |
var $spy = $(this) | |
$spy.scrollspy($spy.data()) | |
}) | |
}) | |
}(window.jQuery); | |
/* ======================================================== | |
* bootstrap-tab.js v2.3.1 | |
* http://twitter.github.com/bootstrap/javascript.html#tabs | |
* ======================================================== | |
* Copyright 2012 Twitter, Inc. | |
* | |
* 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 ($) { | |
"use strict"; | |
var Tab = function (element) { | |
this.element = $(element) | |
} | |
Tab.prototype = { | |
constructor: Tab, | |
show: function () { | |
var $this = this.element, | |
$ul = $this.closest('ul:not(.dropdown-menu)'), | |
selector = $this.attr('data-target'), | |
previous, $target, e | |
if (!selector) { | |
selector = $this.attr('href') | |
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') | |
} | |
if ($this.parent('li').hasClass('active')) return | |
previous = $ul.find('.active:last a')[0] | |
e = $.Event('show', { | |
relatedTarget: previous | |
}) | |
$this.trigger(e) | |
if (e.isDefaultPrevented()) return | |
$target = $(selector) | |
this.activate($this.parent('li'), $ul) | |
this.activate($target, $target.parent(), function () { | |
$this.trigger({ | |
type: 'shown', | |
relatedTarget: previous | |
}) | |
}) | |
}, | |
activate: function (element, container, callback) { | |
var $active = container.find('> .active'), | |
transition = callback && $.support.transition && $active.hasClass('fade') | |
function next() { | |
$active | |
.removeClass('active') | |
.find('> .dropdown-menu > .active') | |
.removeClass('active') | |
element.addClass('active') | |
if (transition) { | |
element[0].offsetWidth | |
element.addClass('in') | |
} else { | |
element.removeClass('fade') | |
} | |
if (element.parent('.dropdown-menu')) { | |
element.closest('li.dropdown').addClass('active') | |
} | |
callback && callback() | |
} | |
transition ? $active.one($.support.transition.end, next) : next() | |
$active.removeClass('in') | |
} | |
} | |
var old = $.fn.tab | |
$.fn.tab = function (option) { | |
return this.each(function () { | |
var $this = $(this), | |
data = $this.data('tab') | |
if (!data) $this.data('tab', (data = new Tab(this))) | |
if (typeof option == 'string') data[option]() | |
}) | |
} | |
$.fn.tab.Constructor = Tab | |
$.fn.tab.noConflict = function () { | |
$.fn.tab = old | |
return this | |
} | |
$(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { | |
e.preventDefault() | |
$(this).tab('show') | |
}) | |
}(window.jQuery); | |
/* ============================================================= | |
* bootstrap-typeahead.js v2.3.1 | |
* http://twitter.github.com/bootstrap/javascript.html#typeahead | |
* ============================================================= | |
* Copyright 2012 Twitter, Inc. | |
* | |
* 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 ($) { | |
"use strict"; | |
var Typeahead = function (element, options) { | |
this.$element = $(element) | |
this.options = $.extend({}, $.fn.typeahead.defaults, options) | |
this.matcher = this.options.matcher || this.matcher | |
this.sorter = this.options.sorter || this.sorter | |
this.highlighter = this.options.highlighter || this.highlighter | |
this.updater = this.options.updater || this.updater | |
this.source = this.options.source | |
this.$menu = $(this.options.menu) | |
this.shown = false | |
this.listen() | |
} | |
Typeahead.prototype = { | |
constructor: Typeahead, | |
select: function () { | |
var val = this.$menu.find('.active').attr('data-value') | |
this.$element | |
.val(this.updater(val)) | |
.change() | |
return this.hide() | |
}, | |
updater: function (item) { | |
return item | |
}, | |
show: function () { | |
var pos = $.extend({}, this.$element.position(), { | |
height: this.$element[0].offsetHeight | |
}) | |
this.$menu | |
.insertAfter(this.$element) | |
.css({ | |
top: pos.top + pos.height, | |
left: pos.left | |
}) | |
.show() | |
this.shown = true | |
return this | |
}, | |
hide: function () { | |
this.$menu.hide() | |
this.shown = false | |
return this | |
}, | |
lookup: function (event) { | |
var items | |
this.query = this.$element.val() | |
if (!this.query || this.query.length < this.options.minLength) { | |
return this.shown ? this.hide() : this | |
} | |
items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source | |
return items ? this.process(items) : this | |
}, | |
process: function (items) { | |
var that = this | |
items = $.grep(items, function (item) { | |
return that.matcher(item) | |
}) | |
items = this.sorter(items) | |
if (!items.length) { | |
return this.shown ? this.hide() : this | |
} | |
return this.render(items.slice(0, this.options.items)).show() | |
}, | |
matcher: function (item) { | |
return~ item.toLowerCase().indexOf(this.query.toLowerCase()) | |
}, | |
sorter: function (items) { | |
var beginswith = [], | |
caseSensitive = [], | |
caseInsensitive = [], | |
item | |
while (item = items.shift()) { | |
if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item) | |
else if (~item.indexOf(this.query)) caseSensitive.push(item) | |
else caseInsensitive.push(item) | |
} | |
return beginswith.concat(caseSensitive, caseInsensitive) | |
}, | |
highlighter: function (item) { | |
var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&') | |
return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) { | |
return '<strong>' + match + '</strong>' | |
}) | |
}, | |
render: function (items) { | |
var that = this | |
items = $(items).map(function (i, item) { | |
i = $(that.options.item).attr('data-value', item) | |
i.find('a').html(that.highlighter(item)) | |
return i[0] | |
}) | |
items.first().addClass('active') | |
this.$menu.html(items) | |
return this | |
}, | |
next: function (event) { | |
var active = this.$menu.find('.active').removeClass('active'), | |
next = active.next() | |
if (!next.length) { | |
next = $(this.$menu.find('li')[0]) | |
} | |
next.addClass('active') | |
}, | |
prev: function (event) { | |
var active = this.$menu.find('.active').removeClass('active'), | |
prev = active.prev() | |
if (!prev.length) { | |
prev = this.$menu.find('li').last() | |
} | |
prev.addClass('active') | |
}, | |
listen: function () { | |
this.$element | |
.on('focus', $.proxy(this.focus, this)) | |
.on('blur', $.proxy(this.blur, this)) | |
.on('keypress', $.proxy(this.keypress, this)) | |
.on('keyup', $.proxy(this.keyup, this)) | |
if (this.eventSupported('keydown')) { | |
this.$element.on('keydown', $.proxy(this.keydown, this)) | |
} | |
this.$menu | |
.on('click', $.proxy(this.click, this)) | |
.on('mouseenter', 'li', $.proxy(this.mouseenter, this)) | |
.on('mouseleave', 'li', $.proxy(this.mouseleave, this)) | |
}, | |
eventSupported: function (eventName) { | |
var isSupported = eventName in this.$element | |
if (!isSupported) { | |
this.$element.setAttribute(eventName, 'return;') | |
isSupported = typeof this.$element[eventName] === 'function' | |
} | |
return isSupported | |
}, | |
move: function (e) { | |
if (!this.shown) return | |
switch (e.keyCode) { | |
case 9: | |
case 13: | |
case 27: | |
e.preventDefault() | |
break | |
case 38: | |
e.preventDefault() | |
this.prev() | |
break | |
case 40: | |
e.preventDefault() | |
this.next() | |
break | |
} | |
e.stopPropagation() | |
}, | |
keydown: function (e) { | |
this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40, 38, 9, 13, 27]) | |
this.move(e) | |
}, | |
keypress: function (e) { | |
if (this.suppressKeyPressRepeat) return | |
this.move(e) | |
}, | |
keyup: function (e) { | |
switch (e.keyCode) { | |
case 40: | |
case 38: | |
case 16: | |
case 17: | |
case 18: | |
break | |
case 9: | |
case 13: | |
if (!this.shown) return | |
this.select() | |
break | |
case 27: | |
if (!this.shown) return | |
this.hide() | |
break | |
default: | |
this.lookup() | |
} | |
e.stopPropagation() | |
e.preventDefault() | |
}, | |
focus: function (e) { | |
this.focused = true | |
}, | |
blur: function (e) { | |
this.focused = false | |
if (!this.mousedover && this.shown) this.hide() | |
}, | |
click: function (e) { | |
e.stopPropagation() | |
e.preventDefault() | |
this.select() | |
this.$element.focus() | |
}, | |
mouseenter: function (e) { | |
this.mousedover = true | |
this.$menu.find('.active').removeClass('active') | |
$(e.currentTarget).addClass('active') | |
}, | |
mouseleave: function (e) { | |
this.mousedover = false | |
if (!this.focused && this.shown) this.hide() | |
} | |
} | |
var old = $.fn.typeahead | |
$.fn.typeahead = function (option) { | |
return this.each(function () { | |
var $this = $(this), | |
data = $this.data('typeahead'), | |
options = typeof option == 'object' && option | |
if (!data) $this.data('typeahead', (data = new Typeahead(this, options))) | |
if (typeof option == 'string') data[option]() | |
}) | |
} | |
$.fn.typeahead.defaults = { | |
source: [], | |
items: 8, | |
menu: '<ul class="typeahead dropdown-menu"></ul>', | |
item: '<li><a href="#"></a></li>', | |
minLength: 1 | |
} | |
$.fn.typeahead.Constructor = Typeahead | |
$.fn.typeahead.noConflict = function () { | |
$.fn.typeahead = old | |
return this | |
} | |
$(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) { | |
var $this = $(this) | |
if ($this.data('typeahead')) return | |
$this.typeahead($this.data()) | |
}) | |
}(window.jQuery); | |
/* ========================================================== | |
* bootstrap-affix.js v2.3.1 | |
* http://twitter.github.com/bootstrap/javascript.html#affix | |
* ========================================================== | |
* Copyright 2012 Twitter, Inc. | |
* | |
* 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 ($) { | |
"use strict"; | |
var Affix = function (element, options) { | |
this.options = $.extend({}, $.fn.affix.defaults, options) | |
this.$window = $(window) | |
.on('scroll.affix.data-api', $.proxy(this.checkPosition, this)) | |
.on('click.affix.data-api', $.proxy(function () { | |
setTimeout($.proxy(this.checkPosition, this), 1) | |
}, this)) | |
this.$element = $(element) | |
this.checkPosition() | |
} | |
Affix.prototype.checkPosition = function () { | |
if (!this.$element.is(':visible')) return | |
var scrollHeight = $(document).height(), | |
scrollTop = this.$window.scrollTop(), | |
position = this.$element.offset(), | |
offset = this.options.offset, | |
offsetBottom = offset.bottom, | |
offsetTop = offset.top, | |
reset = 'affix affix-top affix-bottom', | |
affix | |
if (typeof offset != 'object') offsetBottom = offsetTop = offset | |
if (typeof offsetTop == 'function') offsetTop = offset.top() | |
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom() | |
affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' : offsetTop != null && scrollTop <= offsetTop ? 'top' : false | |
if (this.affixed === affix) return | |
this.affixed = affix | |
this.unpin = affix == 'bottom' ? position.top - scrollTop : null | |
this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : '')) | |
} | |
var old = $.fn.affix | |
$.fn.affix = function (option) { | |
return this.each(function () { | |
var $this = $(this), | |
data = $this.data('affix'), | |
options = typeof option == 'object' && option | |
if (!data) $this.data('affix', (data = new Affix(this, options))) | |
if (typeof option == 'string') data[option]() | |
}) | |
} | |
$.fn.affix.Constructor = Affix | |
$.fn.affix.defaults = { | |
offset: 0 | |
} | |
$.fn.affix.noConflict = function () { | |
$.fn.affix = old | |
return this | |
} | |
$(window).on('load', function () { | |
$('[data-spy="affix"]').each(function () { | |
var $spy = $(this), | |
data = $spy.data() | |
data.offset = data.offset || {} | |
data.offsetBottom && (data.offset.bottom = data.offsetBottom) | |
data.offsetTop && (data.offset.top = data.offsetTop) | |
$spy.affix(data) | |
}) | |
}) | |
}(window.jQuery); | |
window.CTX = window.CTX || {}; | |
(function (CTX) { | |
'use strict'; | |
CTX.data = CTX.data || {}; | |
CTX.constant = {}; | |
CTX.URI = CTX.URI || {}; | |
CTX.request = CTX.request || {}; | |
CTX.stash = CTX.stash || {}; | |
CTX.objStore = CTX.objStore || {}; | |
CTX.ignoreStateChange = []; | |
CTX.newVersionAvailable = false; | |
CTX.notificationHandler; | |
if (undefined === typeof (CTX.debugMode)) { | |
CTX.debugMode = false; | |
} | |
CTX.log = function log(options) { | |
var validLevels = ['debug', 'info', 'notice', 'error', 'warning']; | |
var consoleLevels = { | |
debug: 'debug', | |
info: 'info', | |
notice: 'info', | |
error: 'error', | |
warning: 'warn' | |
}; | |
if (typeof options === 'undefined') { | |
return false; | |
} | |
if (!('level' in options)) { | |
return false; | |
} | |
if (validLevels.indexOf(options.level) === -1) { | |
return false; | |
} | |
if ('message' in options) { | |
if (CTX.debugMode === true) { | |
if (!window.console) { | |
window.console = {}; | |
} | |
var handleMethod = function (message) { | |
CTX.addNotification({ | |
message: message, | |
level: 'info' | |
}); | |
}; | |
for (var method in consoleLevels) { | |
if (consoleLevels.hasOwnProperty(method) && !(consoleLevels[method] in window.console) || 'undefined' === window.console[consoleLevels[method]]) { | |
window.console[consoleLevels[method]] = handleMethod; | |
} | |
} | |
if (typeof options.message === 'string') { | |
options.message = [options.message]; | |
} | |
try { | |
window.console[consoleLevels[options.level]].apply(window.console, options.message); | |
} catch (e) { | |
window.console.log(options.message); | |
} | |
} else { | |
return false; | |
} | |
} | |
}; | |
CTX.debug = function () { | |
var args = []; | |
Array.prototype.push.apply(args, arguments); | |
CTX.log({ | |
level: 'debug', | |
message: args | |
}); | |
}; | |
CTX.info = function () { | |
var args = []; | |
Array.prototype.push.apply(args, arguments); | |
CTX.log({ | |
level: 'info', | |
message: args | |
}); | |
}; | |
CTX.notice = function () { | |
var args = []; | |
Array.prototype.push.apply(args, arguments); | |
CTX.log({ | |
level: 'notice', | |
message: args | |
}); | |
}; | |
CTX.error = function () { | |
var args = []; | |
Array.prototype.push.apply(args, arguments); | |
CTX.log({ | |
level: 'error', | |
message: args | |
}); | |
}; | |
CTX.warning = function () { | |
var args = []; | |
Array.prototype.push.apply(args, arguments); | |
CTX.log({ | |
level: 'warning', | |
message: args | |
}); | |
}; | |
CTX.addNotification = function log(options) { | |
var validLevels = ['info', 'notice', 'error', 'warning']; | |
if (typeof options === 'undefined') { | |
return false; | |
} | |
if (!('level' in options)) { | |
return false; | |
} | |
if (validLevels.indexOf(options.level) === -1) { | |
return false; | |
} | |
options.firedTime = new Date().getTime(); | |
if ('message' in options) { | |
if ('notificationHandler' in CTX && CTX.helpers.typeOf(CTX.notificationHandler) === 'function') { | |
CTX.notificationHandler(options); | |
} else { | |
CTX.defaultNotificationHandler(options); | |
} | |
} | |
}; | |
CTX.addNotificationHandler = function (callback) { | |
CTX.notificationHandler = callback; | |
}; | |
CTX.defaultNotificationHandler = function () { | |
$('.ctx_notification').remove(); | |
$('.ctx_header:first').after(CTX.widgets.notification({ | |
message: options.message, | |
level: options.level | |
}).getDOMElement()); | |
}; | |
CTX.uriFor = function uriFor(options) { | |
var optionsc = CTX.helpers.clone(options); | |
var hostPassed = true; | |
if ('object' !== CTX.helpers.typeOf(optionsc) || 0 === Object.keys(optionsc).length) { | |
CTX.error('CTX.uriFor must have arguments as an object'); | |
return null; | |
} | |
if (Object.keys(optionsc).length === 1 && 'fragment' in optionsc) { | |
return '#' + optionsc.fragment; | |
} | |
if ('ts' in optionsc && 'scheme' in optionsc && optionsc.scheme === 'tel') { | |
if (!(/^\+/.test(optionsc.ts))) { | |
CTX.warning('uriFor received a tel: URI without an international dialing number', optionsc); | |
} | |
return 'tel:' + optionsc.ts; | |
} | |
if ('undefined' === typeof (optionsc.scheme)) { | |
optionsc.scheme = location.protocol; | |
optionsc.scheme = optionsc.scheme.replace(/:$/, ''); | |
} | |
if ('undefined' === typeof (optionsc.host)) { | |
hostPassed = false; | |
optionsc.host = location.host; | |
optionsc.host = optionsc.host.replace(/:[0-9]+$/, ''); | |
} | |
if ('undefined' === typeof (optionsc.port)) { | |
optionsc.port = location.port; | |
} | |
if ('undefined' === typeof (optionsc.path)) { | |
optionsc.path = location.pathname; | |
} | |
if ('undefined' === typeof (optionsc.args)) { | |
optionsc.args = []; | |
} | |
if ('undefined' === typeof (optionsc.params)) { | |
optionsc.params = {}; | |
} | |
if ('undefined' === typeof (optionsc.fragment)) { | |
optionsc.fragment = null; | |
} | |
var action = null; | |
var ctxUriFor = null; | |
if ('undefined' !== typeof (CTX.data) && 'undefined' !== typeof (CTX.data.routing) && 'undefined' !== typeof (CTX.data.routing[optionsc.path])) { | |
action = CTX.data.routing[optionsc.path]; | |
} | |
if (action) { | |
if ('undefined' === typeof (optionsc.captures)) { | |
optionsc.captures = []; | |
} | |
for (var i = 0; action.args.length > i; i += 1) { | |
var argsAreValid = false; | |
var capturesAreValid = false; | |
if (null === action.args[i] || optionsc.args.length === action.args[i]) { | |
argsAreValid = true; | |
} | |
if (optionsc.captures.length === action.captures[i]) { | |
capturesAreValid = true; | |
} | |
if (argsAreValid && capturesAreValid) { | |
if (0 === action.captures[i]) { | |
optionsc.path = '/' + action.path[i].join('/'); | |
ctxUriFor = new CTX.dataStructure.widgets.URI(optionsc); | |
} else { | |
var nextCapture = 0; | |
var path = ''; | |
for (var j = 0; action.path[i].length > j; j += 1) { | |
if ('' === action.path[i][j]) { | |
path += '/' + optionsc.captures[nextCapture]; | |
nextCapture += 1; | |
} else { | |
path += '/' + action.path[i][j]; | |
} | |
} | |
optionsc.path = path; | |
ctxUriFor = new CTX.dataStructure.widgets.URI(optionsc); | |
} | |
i = action.args.length; | |
} | |
} | |
if ('undefined' === typeof (ctxUriFor) || null === ctxUriFor) { | |
CTX.debug('It looks like you have specified the wrong number of arguments and/or captures for this action.', { | |
'options': optionsc, | |
'action': action | |
}); | |
} | |
} else { | |
if (hostPassed) { | |
CTX.debug('It looks like you are using a public path. Please check that there is not private path that you should be using instead.', optionsc); | |
} | |
ctxUriFor = new CTX.dataStructure.widgets.URI(optionsc); | |
} | |
if ('undefined' === typeof (ctxUriFor) || null === ctxUriFor || !ctxUriFor.isValid()) { | |
return null; | |
} | |
return ctxUriFor; | |
}; | |
CTX.widgets = CTX.widgets || {}; | |
CTX.abstract = CTX.abstract || {}; | |
CTX.abstract.widgets = CTX.abstract.widgets || {}; | |
CTX.classType = CTX.classType || {}; | |
CTX.classType.widgets = CTX.classType.widgets || {}; | |
CTX.dataStructure = CTX.dataStructure || {}; | |
CTX.dataStructure.widgets = CTX.dataStructure.widgets || {}; | |
CTX.template = {}; | |
CTX.controller = {}; | |
CTX.model = {}; | |
CTX.widget = {}; | |
}(window.CTX)); | |
(function () { | |
'use strict'; | |
CTX.setJavascriptMode = function setJavascriptMode(mode) { | |
var outputMode = 1; | |
if (mode === false) { | |
outputMode = 0; | |
} | |
CTX.helpers.createCookie('javascriptMode', outputMode); | |
return true; | |
}; | |
CTX.registerObj = function (UUID, obj) { | |
CTX.removeObj(UUID); | |
CTX.objStore[UUID] = obj; | |
}; | |
CTX.getObj = function (UUID) { | |
if (UUID in CTX.objStore) { | |
return CTX.objStore[UUID]; | |
} | |
return null; | |
}; | |
CTX.removeObj = function (UUID) { | |
if (UUID in CTX.objStore) { | |
CTX.objStore[UUID] = undefined; | |
delete CTX.objStore[UUID]; | |
} | |
}; | |
CTX.getWidgetInstance = function (el) { | |
var id = $(el).data('CTXWidget'); | |
if (id) { | |
return CTX.getObj(id); | |
} | |
return null; | |
}; | |
CTX.removeWidgetInstance = function (el) { | |
var instanceCache = []; | |
$(el).find('.ctx_widget').each(function (i, sel) { | |
var instance = CTX.getWidgetInstance(sel); | |
if (instance) { | |
instanceCache.push(instance); | |
} | |
}); | |
var instance = CTX.getWidgetInstance(el); | |
if (instance !== null) { | |
instanceCache.push(instance); | |
} | |
instanceCache.forEach(function (instance) { | |
instance.purgeContents(); | |
}); | |
instanceCache = undefined; | |
el = undefined; | |
return null; | |
}; | |
CTX.loadAllWidgets = function (el) { | |
$(el).find('.ctx_widget').each(function () { | |
var instance = CTX.getWidgetInstance(this); | |
if (instance !== null) { | |
instance.onLoad(); | |
} | |
}); | |
return true; | |
}; | |
CTX.getUsernameLogin = function setUsername() { | |
var jsCookie = CTX.helpers.readCookie('CTX-username'); | |
if (jsCookie === null || jsCookie === '') { | |
return false; | |
} | |
return jsCookie; | |
}; | |
CTX.setUsernameLogin = function setUsernameLogin(username) { | |
CTX.helpers.createCookie('CTX-username', username); | |
return true; | |
}; | |
CTX.getJavascriptMode = function getJavascriptMode() { | |
var jsCookie = CTX.helpers.readCookie('javascriptMode'); | |
if (jsCookie === null) { | |
CTX.setJavascriptMode(true); | |
} | |
if (jsCookie === '0') { | |
return false; | |
} | |
return true; | |
}; | |
CTX.ensurePathInObject = function ensurePathInObject(rootMethodObject, privatePath, action) { | |
var pathArray = CTX.makePathArrayFromPath(privatePath); | |
if (action === true) { | |
pathArray.pop(); | |
} | |
if (typeof privatePath !== 'undefined' && typeof rootMethodObject !== 'undefined') { | |
pathArray.forEach(function (pathSegment) { | |
if (!(pathSegment in rootMethodObject)) { | |
rootMethodObject[pathSegment] = {}; | |
} | |
rootMethodObject = rootMethodObject[pathSegment]; | |
}); | |
if (action === true) { | |
if (!('rootMethod' in rootMethodObject)) { | |
rootMethodObject.rootMethod = {}; | |
} | |
rootMethodObject = rootMethodObject.rootMethod; | |
} | |
return rootMethodObject; | |
} else { | |
CTX.debug('CTX.ensurePathInObject needs both rootMethodObject and privatePath'); | |
return null; | |
} | |
}; | |
CTX.registerControllerFromPrivatePath = function registerControllerFromPrivatePath(rootMethodObject, privatePath, controller) { | |
var object; | |
if (typeof privatePath !== 'undefined' && typeof rootMethodObject !== 'undefined' && typeof controller !== 'undefined') { | |
object = CTX.ensurePathInObject(rootMethodObject, privatePath); | |
object.rootMethod = controller; | |
return true; | |
} else { | |
CTX.debug('CTX.registerControllerFromPrivatePath expects the following arguments: rootMethodObject, privatePath, controller'); | |
return null; | |
} | |
}; | |
CTX.action = function action(options) { | |
return new CTX.abstract.action(options); | |
}; | |
CTX.registerActionFromPrivatePath = function registerActionFromPrivatePath(rootMethodObject, privatePath, action) { | |
var object; | |
var pathArray; | |
var actionName; | |
if (typeof privatePath !== 'undefined' && typeof rootMethodObject !== 'undefined' && typeof action !== 'undefined') { | |
object = CTX.ensurePathInObject(rootMethodObject, privatePath, true); | |
pathArray = CTX.makePathArrayFromPath(privatePath); | |
actionName = pathArray.pop(); | |
object[actionName] = action; | |
return true; | |
} else { | |
return null; | |
} | |
}; | |
CTX.registerTemplate = function registerTemplate(privatePath, templateMethod) { | |
return CTX.registerActionFromPrivatePath(CTX.template, privatePath, templateMethod); | |
}; | |
CTX.registerFragment = CTX.registerTemplate; | |
CTX.registerController = function registerController(privatePath, controller) { | |
return CTX.registerControllerFromPrivatePath(CTX.controller, privatePath, controller); | |
}; | |
CTX.makePathArrayFromPath = function makePathArrayFromPath(privatePath) { | |
var pathArray; | |
if (typeof privatePath !== 'undefined') { | |
pathArray = privatePath.split('/'); | |
pathArray.shift(); | |
return pathArray; | |
} | |
return null; | |
}; | |
CTX.findMethodFromPathArray = function findMethodFromPathArray(rootMethodObject, pathArray) { | |
var part; | |
if (typeof rootMethodObject !== 'undefined' && typeof pathArray !== 'undefined') { | |
if (pathArray.length > 1) { | |
part = pathArray.shift(); | |
if (part in rootMethodObject) { | |
return CTX.findMethodFromPathArray(rootMethodObject[part], pathArray); | |
} else { | |
return null; | |
} | |
} else if (pathArray.length === 1) { | |
if ('rootMethod' in rootMethodObject && pathArray[0] in rootMethodObject.rootMethod) { | |
return rootMethodObject.rootMethod[pathArray[0]]; | |
} else { | |
return null; | |
} | |
} else { | |
CTX.debug('Path provided wasn\'t long enough', rootMethodObject, pathArray); | |
return null; | |
} | |
} | |
CTX.debug('FindMethodFromPathArray requires rootMethodObject and pathArray'); | |
return null; | |
}; | |
CTX.convertPathToTemplate = function convertPathToTemplate(privatePath) { | |
if (typeof privatePath !== 'undefined') { | |
return CTX.findMethodFromPathArray(CTX.template, CTX.makePathArrayFromPath(privatePath)); | |
} else { | |
CTX.debug('No privatePath was passed to convertPathToTemplate'); | |
return null; | |
} | |
}; | |
CTX.convertPathToAction = function convertPathToAction(privatePath) { | |
if (typeof privatePath !== 'undefined') { | |
privatePath = CTX.helpers.underscoreToCamelCase(privatePath); | |
return CTX.findMethodFromPathArray(CTX.controller, CTX.makePathArrayFromPath(privatePath)); | |
} else { | |
CTX.debug('No privatePath was passed to convertPathToAction'); | |
return null; | |
} | |
}; | |
CTX.hasAction = function hasAction(privatePath) { | |
var action = CTX.convertPathToAction(privatePath); | |
if (action === null) { | |
return false; | |
} | |
return true; | |
}; | |
CTX.clearPage = function clearPage() { | |
var $body = $('body'); | |
if ($body.hasClass('tt-mode')) { | |
$body.removeClass('tt-mode'); | |
if (CTX.data.browser.mobile) { | |
$body.addClass('js-mode mobile-only'); | |
} else { | |
$body.addClass('js-mode'); | |
} | |
} | |
CTX.removeWidgetInstance($body); | |
CTX.objStore = {}; | |
$body.html(''); | |
$.cache = {}; | |
CTX.loading.init(); | |
return true; | |
}; | |
CTX.scrollTop = function () { | |
$(document).scrollTop(0); | |
}; | |
CTX.isFirstTemplateLoad = function () { | |
var $body = $('body'); | |
if ($body.hasClass('tt-mode')) { | |
return true; | |
} | |
return false; | |
}; | |
CTX.loadTemplate = function loadTemplate(context, options) { | |
var $body = $('body'); | |
var templateFragment = this.loadFragment(context, options); | |
if (templateFragment !== null) { | |
CTX.scrollTop(); | |
CTX.clearPage(); | |
$body.append(CTX.widgets.pageContainer({ | |
content: templateFragment | |
}).getDOMElement()); | |
$('.ctx_widget').each(function (i, el) { | |
var instance = CTX.getWidgetInstance($(el)); | |
if (instance !== null) { | |
instance.onLoad(); | |
} | |
}); | |
CTX.loading.remove('page'); | |
return true; | |
} | |
}; | |
CTX.loadFragment = function loadFragment(context, options) { | |
var fragmentOptions = {}; | |
var fragment = null; | |
var privatePath; | |
if (typeof context === 'string') { | |
privatePath = context; | |
if (typeof options === 'undefined') { | |
options = {}; | |
} | |
fragmentOptions.stash = options; | |
} else if ('URI' in CTX && 'path' in CTX.URI && 'stash' in CTX) { | |
fragmentOptions.stash = CTX.stash; | |
fragmentOptions.request = CTX.request; | |
privatePath = CTX.URI.path; | |
} else { | |
CTX.debug('LoadFragment expects either a context as the first argument or a string path', context); | |
return null; | |
} | |
if (typeof privatePath !== 'undefined') { | |
fragment = CTX.convertPathToTemplate(privatePath); | |
if (fragment !== null) { | |
return fragment(fragmentOptions.stash); | |
} else { | |
CTX.debug('Could not find fragment', privatePath); | |
} | |
} else { | |
CTX.debug('No privatePath was passed to loadFragment'); | |
} | |
return null; | |
}; | |
CTX.callAction = function callAction(options) { | |
var action = null; | |
if (CTX.getJavascriptMode() === true) { | |
if ('URI' in options && 'path' in options.URI && typeof options.URI.path !== 'undefined') { | |
CTX.debug('Calling Action: ' + options.URI.path, options.URI); | |
action = CTX.convertPathToAction(CTX.helpers.clone(options.URI.path)); | |
if (action !== null) { | |
CTX.setGlobals(options); | |
if (typeof action === 'object') { | |
action.callAction(options); | |
} else { | |
CTX.warning('Legacy action not called anymore, please refactor', options); | |
} | |
return true; | |
} else { | |
CTX.debug('Could not find action', options.URI); | |
} | |
} else { | |
CTX.debug('No URI was passed to callAction'); | |
} | |
} | |
return null; | |
}; | |
CTX.setGlobals = function setGlobals(options) { | |
CTX.stash = options.stash; | |
CTX.URI = CTX.helpers.clone(options.URI); | |
CTX.request = options.request; | |
}; | |
CTX.isSamePageAsCurrentPage = function (action) { | |
if (CTX.uriFor($.extend({}, action.URI)).toString() === window.location.href) { | |
return true; | |
} | |
return false; | |
}; | |
CTX.redirectOnNewVersion = function (options) { | |
var uri = {}; | |
if (CTX.newVersionAvailable === true && options.request.method === 'GET') { | |
CTX.debug('Redirecting as a newer version is available from the server on a GET request: ', options); | |
if ('URI' in options) { | |
uri = options.URI; | |
} | |
return CTX.helpers.redirectWindowToURI(uri); | |
} | |
return false; | |
}; | |
CTX.loadAction = function loadAction(action, forceReload, stash) { | |
var actionMethod = null; | |
var detach = false; | |
CTX.URI = {}; | |
CTX.request = {}; | |
CTX.stash = {}; | |
var options = {}; | |
var loadActionCallback = function () {}; | |
if (CTX.getJavascriptMode() === true) { | |
if ('detach' in action && action.detach === true) { | |
detach = true; | |
} | |
if ('URI' in action && 'path' in action.URI && typeof action.URI.path !== 'undefined') { | |
CTX.debug('Loading Action: ' + action.URI.path, action.URI); | |
action.URI = CTX.helpers.clearURIForWebRequest(action.URI); | |
actionMethod = CTX.convertPathToAction(action.URI.path); | |
if (actionMethod !== null) { | |
loadActionCallback = function () { | |
options.URI = CTX.helpers.clone(action.URI); | |
options.stash = stash || {}; | |
options.request = { | |
args: [], | |
parameters: [], | |
path: options.URI.path, | |
method: 'GET' | |
}; | |
if ('args' in options.URI) { | |
options.request.args = CTX.helpers.clone(options.URI.args); | |
} | |
if ('params' in options.URI) { | |
options.request.parameters = CTX.helpers.clone(options.URI.params); | |
} | |
if ('params' in action) { | |
options.request.postParams = action.params; | |
options.request.parameters = $.extend(options.request.parameters, action.params); | |
} | |
if ('transportMethod' in action) { | |
options.request.method = action.transportMethod; | |
} | |
if (CTX.redirectOnNewVersion(options)) { | |
return false; | |
} | |
if (detach === false) { | |
History.pushState(options, null, CTX.uriFor(CTX.helpers.clone(action.URI)).toString()); | |
} | |
if (detach === true || (forceReload && CTX.isSamePageAsCurrentPage(action))) { | |
CTX.handleAction(options); | |
} | |
}; | |
if (forceReload !== true && CTX.isSamePageAsCurrentPage(action)) { | |
loadActionCallback(); | |
} else { | |
CTX.loading.show('page', { | |
shownCallback: loadActionCallback | |
}); | |
} | |
return true; | |
} else { | |
CTX.debug('Could not find action', action.URI); | |
} | |
} else { | |
CTX.debug('No URI was passed to loadAction'); | |
} | |
} | |
return null; | |
}; | |
CTX.ignoreStateId = function (stateCheck) { | |
var returnVal = null; | |
CTX.ignoreStateChange.forEach(function (state, id) { | |
if (state.path === stateCheck.path) { | |
returnVal = id; | |
} | |
}); | |
return returnVal; | |
}; | |
CTX.handleAction = function handleAction(options) { | |
var ignoreIndex = CTX.ignoreStateId(options.request); | |
if (ignoreIndex !== null) { | |
if (options.request.method === 'GET' || 'posted' in options) { | |
CTX.ignoreStateChange.splice(ignoreIndex, 1); | |
} | |
return; | |
} else { | |
if (options.request.method === 'POST' && 'posted' in options) { | |
if (!(window.confirm('Would you like to repost?'))) { | |
return false; | |
} | |
} | |
CTX.callAction(options); | |
} | |
}; | |
CTX.unwrapMessage = function unwrapMessage(wrapper, data) { | |
var part; | |
var newWrapper = CTX.helpers.clone(wrapper); | |
if ('array' === CTX.helpers.typeOf(newWrapper)) { | |
if (newWrapper.length > 1) { | |
part = newWrapper.shift(); | |
if (part in data) { | |
return CTX.unwrapMessage(newWrapper, data[part]); | |
} | |
} | |
if (newWrapper.length === 1) { | |
newWrapper = newWrapper.shift(); | |
} | |
} | |
if (newWrapper in data) { | |
return data[newWrapper]; | |
} | |
CTX.debug('Could not find wrapped data', newWrapper, data); | |
return null; | |
}; | |
CTX.redirectPathForPathMismatch = function (currentURI, xhrClone, data) { | |
var xlocation; | |
var redirecting = false; | |
if ('x-location' in xhrClone.headers) { | |
xlocation = xhrClone.headers['x-location']; | |
if (/^\s*\{/.test(xlocation)) { | |
xlocation = JSON.parse(xhrClone.headers['x-location']); | |
if ('params' in xlocation && 'content-type' in xlocation.params) { | |
delete xlocation.params['content-type']; | |
} | |
if (xlocation.path !== currentURI.path || !(CTX.helpers.compareObj(currentURI.params, xlocation.params))) { | |
redirecting = true; | |
CTX.jumpToActionFromResponse(xlocation, xhrClone, data); | |
} | |
} | |
} | |
return redirecting; | |
}; | |
CTX.jumpToActionFromResponse = function (URI, xhrClone, data, postParams) { | |
var options = {}; | |
var action; | |
if (CTX.hasAction(URI.path)) { | |
action = CTX.convertPathToAction(CTX.helpers.clone(URI.path)); | |
if (data) { | |
if ('params' in action && 'getStash' in action.params && typeof action.params.getStash === 'object' && 'dataWrapper' in action.params.getStash) { | |
data = CTX.unwrapMessage(action.params.getStash.dataWrapper, data); | |
} | |
CTX.stash = data; | |
} | |
options.URI = CTX.helpers.clone(URI); | |
options.stash = CTX.stash; | |
options.request = CTX.helpers.clone(URI); | |
options.request.parameters = URI.params || {}; | |
if ('object' === CTX.helpers.typeOf(postParams)) { | |
options.request.parameters = options.request.parameters || {}; | |
options.request.postParams = postParams; | |
options.request.parameters = $.extend(options.request.parameters, postParams); | |
} | |
options.request.method = 'GET'; | |
CTX.setGlobals(options); | |
if (xhrClone.status === 400) { | |
xhrClone.status = 200; | |
} | |
action.callResponse(xhrClone.status, data, xhrClone); | |
} else { | |
return CTX.helpers.redirectWindowToURI(URI); | |
} | |
return true; | |
}; | |
CTX.redirectPathForSignupPresented = function (URI, xhrClone, data) { | |
var redirectPath; | |
var loginURI; | |
var currentURL = CTX.uriFor(URI).toString(); | |
if ('signup_presented' in data && Number(data.signup_presented) === 1) { | |
redirectPath = currentURL.match(/^https?\:\/\/[^\/]+(.*)/); | |
if (redirectPath && redirectPath.length > 1) { | |
redirectPath = redirectPath[1]; | |
} | |
loginURI = { | |
path: '/secure', | |
params: { | |
returnto: redirectPath | |
} | |
}; | |
CTX.jumpToActionFromResponse(loginURI, xhrClone); | |
return true; | |
} | |
return false; | |
}; | |
CTX.checkVersion = function (xhrClone) { | |
if ('x-client-version' in xhrClone.headers) { | |
if ('clientVersion' in CTX.data && (xhrClone.headers['x-client-version'] !== CTX.data.clientVersion)) { | |
CTX.newVersionAvailable = true; | |
} | |
} | |
}; | |
CTX.updateXSRF = function () { | |
var xsrfToken = window.cstoken; | |
if (CTX.helpers.readCookie('PSGI-XSRF-Token') !== xsrfToken) { | |
xsrfToken = CTX.helpers.readCookie('PSGI-XSRF-Token'); | |
window.cstoken = xsrfToken; | |
$('meta[name=csrftoken]').attr('content', xsrfToken); | |
$('input[name=X-CSRF-Token]').each(function (i, input) { | |
var instance = CTX.getWidgetInstance(input); | |
instance.setValue(xsrfToken); | |
}); | |
XMLHttpRequest.prototype.onsend = function () { | |
this.setRequestHeader('X-CSRF-Token', xsrfToken); | |
}; | |
} | |
}; | |
CTX.getMessage = function getMessage(options) { | |
var URI; | |
var ajaxContext = { | |
type: 'GET', | |
data: {}, | |
dataType: 'json', | |
cache: false | |
}; | |
var paramsMunge = {}; | |
ajaxContext.complete = function (xhr) { | |
CTX.updateXSRF(); | |
var xhrClone = CTX.helpers.getMutableXHR(xhr); | |
var data = null; | |
var contentType = ''; | |
if ('content-type' in xhrClone.headers) { | |
contentType = xhrClone.headers['content-type']; | |
} | |
if (/\/json/.test(contentType)) { | |
try { | |
data = JSON.parse(xhrClone.responseText); | |
} catch (e) { | |
data = null; | |
} | |
} | |
if (data !== null) { | |
if ('action' in options) { | |
CTX.checkVersion(xhrClone); | |
if (CTX.redirectPathForPathMismatch(CTX.URI, xhrClone, data)) { | |
return false; | |
} | |
if (CTX.redirectPathForSignupPresented(CTX.URI, xhrClone, data)) { | |
return false; | |
} | |
} | |
if ('dataWrapper' in options) { | |
data = CTX.unwrapMessage(options.dataWrapper, data); | |
if (xhrClone.status === 400) { | |
xhrClone.status = 200; | |
} | |
} | |
} else { | |
if (xhrClone.status !== CTX.constant.http.temporaryRedirect()) { | |
xhrClone.status = CTX.constant.http.badData(); | |
} | |
} | |
if (xhrClone.status === 200) { | |
if ('success' in options) { | |
options.success(data); | |
} | |
} else { | |
CTX.warning('Error sending AJAX message to server: ' + JSON.stringify(ajaxContext)); | |
CTX.warning('Received: ', xhrClone.responseText); | |
CTX.warning('Parsed clone: ' + JSON.stringify(xhrClone)); | |
if ('error' in options) { | |
options.error(data); | |
} | |
} | |
if ('complete' in options) { | |
options.complete(data, xhrClone); | |
} | |
if ('action' in options) { | |
options.action.callResponse(xhrClone.status, data, xhrClone); | |
} | |
}; | |
if ('sync' in options && options.sync) { | |
ajaxContext.async = false; | |
} | |
if ('data' in options) { | |
ajaxContext.data = options.data; | |
} | |
if ('method' in options) { | |
ajaxContext.type = options.method; | |
} | |
if ('sendRawData' in options && true === options.sendRawData) { | |
ajaxContext.data = JSON.stringify(ajaxContext.data); | |
ajaxContext.contentType = 'application/json; charset=UTF-8'; | |
} | |
if ('URI' in options) { | |
URI = CTX.helpers.clone(options.URI); | |
if ('params' in options.URI) { | |
URI.params = $.extend(options.URI.params, paramsMunge); | |
} else { | |
URI.params = paramsMunge; | |
} | |
ajaxContext.url = CTX.uriFor(CTX.helpers.clone(URI)).toString(); | |
$.ajax(ajaxContext); | |
} | |
return false; | |
}; | |
CTX.getStash = function (options) { | |
var message = { | |
method: 'GET' | |
}; | |
var state = History.getState(); | |
if ('stash' in CTX && 'URI' in CTX) { | |
message.URI = CTX.helpers.clone(CTX.URI); | |
if ('method' in CTX.request && CTX.request.method === 'POST') { | |
message.method = 'POST'; | |
if ('postParams' in CTX.request) { | |
message.data = CTX.request.postParams; | |
} | |
} | |
if (typeof options !== 'undefined' && 'dataWrapper' in options) { | |
message.dataWrapper = options.dataWrapper; | |
} | |
message.success = function (data) { | |
CTX.stash = $.extend(CTX.stash, data); | |
}; | |
message.action = options.action; | |
CTX.getMessage(message); | |
if (message.method === 'POST' && !('posted' in state.data)) { | |
CTX.ignoreStateChange.push(state.data.request); | |
state.data.posted = true; | |
History.replaceState(state.data, null, state.url); | |
} | |
return true; | |
} | |
CTX.debug('Stash or URI was not found in getStash', this); | |
return false; | |
}; | |
}()); | |
(function (CTX, $) { | |
'use strict'; | |
CTX.event = CTX.event || {}; | |
CTX.event.fire = function (eventName) { | |
CTX.info('Fire event for: ', eventName); | |
$(window).trigger(eventName); | |
return true; | |
}; | |
CTX.event.listen = function (eventName, callback) { | |
$(window).on(eventName, callback); | |
return true; | |
}; | |
}(window.CTX, window.jQuery)); | |
(function () { | |
'use strict'; | |
CTX.loading = CTX.loading || {}; | |
CTX.loading.DOMElement = null; | |
CTX.loading.store = {}; | |
CTX.loading.removeListeners = []; | |
CTX.loading.init = function () { | |
CTX.loading.DOMElement = null; | |
if (CTX.loading.hasLoading()) { | |
CTX.loading.showLoadingDOM(); | |
} | |
return true; | |
}; | |
CTX.loading.show = function (name, options) { | |
var shownCallback = null; | |
if ('string' !== CTX.helpers.typeOf(name)) { | |
return false; | |
} | |
if ('object' === CTX.helpers.typeOf(options)) { | |
if ('shownCallback' in options) { | |
shownCallback = options.shownCallback; | |
} | |
if ('removedCallback' in options) { | |
CTX.loading.removeListeners.push(options.removedCallback); | |
} | |
} | |
CTX.loading.showLoadingDOM(shownCallback); | |
CTX.loading.store[name] = null; | |
return true; | |
}; | |
CTX.loading.remove = function (name) { | |
if ('string' === CTX.helpers.typeOf(name)) { | |
delete CTX.loading.store[name]; | |
} | |
if (Object.keys(CTX.loading.store).length <= 0) { | |
CTX.loading.removeLoadingDOM(); | |
CTX.loading.removeListeners.forEach(function (removeCallback) { | |
if ('function' === CTX.helpers.typeOf(removeCallback)) { | |
removeCallback(); | |
} | |
}); | |
CTX.loading.removeListeners = []; | |
} | |
return true; | |
}; | |
CTX.loading.hasLoading = function () { | |
if (Object.keys(CTX.loading.store).length <= 0) { | |
return false; | |
} | |
return true; | |
}; | |
CTX.loading.hasLoadingDOM = function () { | |
if (null !== CTX.loading.DOMElement) { | |
return true; | |
} | |
return false; | |
}; | |
CTX.loading.showLoadingDOM = function (shownCallback) { | |
if (!(CTX.loading.hasLoadingDOM())) { | |
CTX.loading.createAndAttachLoadingDOM(); | |
} | |
if ('function' === CTX.helpers.typeOf(shownCallback)) { | |
CTX.helpers.checkIfInDOMListener(CTX.loading.DOMElement, shownCallback); | |
} | |
}; | |
CTX.loading.createAndAttachLoadingDOM = function () { | |
var loadingModal = CTX.widgets.modal({ | |
bodyContent: [CTX.widgets.loading({})], | |
className: 'ctx_modal_loading' | |
}).getDOMElement(); | |
$('body').append(loadingModal); | |
CTX.loading.DOMElement = loadingModal; | |
return true; | |
}; | |
CTX.loading.removeLoadingDOM = function () { | |
$(CTX.loading.DOMElement).remove(); | |
$('ctx_modal_loading').remove(); | |
CTX.loading.DOMElement = null; | |
return true; | |
}; | |
}()); | |
(function (CTX) { | |
'use strict'; | |
CTX.basket = CTX.basket || {}; | |
CTX.basket.data = {}; | |
CTX.basket.callbacks = []; | |
CTX.basket.visibleItems = []; | |
CTX.basket.loadEvent = function () { | |
CTX.basket.clearUpdateCallbacks(); | |
}; | |
CTX.event.listen('action.callResponse', CTX.basket.loadEvent); | |
CTX.basket.loadItems = function (forceCheck) { | |
var that = this; | |
forceCheck = forceCheck || false; | |
if (CTX.basket.hasData() && false === forceCheck) { | |
return true; | |
} | |
CTX.getMessage({ | |
URI: { | |
path: '/order/basket/' | |
}, | |
success: function (data) { | |
if ('username' in data) { | |
CTX.setUsernameLogin(data.username); | |
} | |
if (data.basket) { | |
CTX.basket.data = CTX.helpers.objUnderscoreToCamelCase(data.basket); | |
that.fireUpdateCallbacks(); | |
} | |
}, | |
error: function () { | |
CTX.warning('failed to load items'); | |
} | |
}); | |
}; | |
CTX.basket.hasData = function () { | |
if ('currencySymbol' in CTX.basket.data) { | |
return true; | |
} | |
return false; | |
}; | |
CTX.basket.add = function (productOptions, success) { | |
var that = this; | |
var paramOptions = { | |
product: [] | |
}; | |
var allowedOptions = ['product', 'hostname', 'extension', 'years', 'parent']; | |
if ('array' !== CTX.helpers.typeOf(productOptions)) { | |
productOptions = [productOptions]; | |
} | |
productOptions.forEach(function (product, productId) { | |
for (var key in product) { | |
if (product.hasOwnProperty(key)) { | |
if (allowedOptions.indexOf(key) !== -1) { | |
paramOptions.product[productId] = paramOptions.product[productId] || {}; | |
paramOptions.product[productId][key] = product[key]; | |
} | |
} | |
} | |
}); | |
CTX.getMessage({ | |
URI: { | |
path: '/order/basket/add', | |
params: paramOptions | |
}, | |
success: function (data) { | |
data = CTX.helpers.objUnderscoreToCamelCase(data); | |
CTX.basket.data = data.addProductForm.item; | |
that.fireUpdateCallbacks(); | |
if (typeof success === 'function') { | |
success(); | |
} | |
}, | |
error: function (data) { | |
var errors = []; | |
data = CTX.helpers.objUnderscoreToCamelCase(data); | |
if ('errors' in data.addProductForm) { | |
Object.keys(data.addProductForm.errors).forEach(function (errorKey) { | |
var error = data.addProductForm.errors[errorKey]; | |
errors = errors.concat(error); | |
}); | |
} | |
if (errors.length > 0) { | |
CTX.addNotification({ | |
level: 'error', | |
message: errors.join('\n') | |
}); | |
} | |
} | |
}); | |
CTX.tracking.addToBasket(productOptions); | |
}; | |
CTX.basket.remove = function (productId) { | |
var that = this; | |
if ('loading' in CTX) { | |
CTX.loading.show('basket'); | |
} | |
CTX.getMessage({ | |
URI: { | |
path: '/op/order/basket/remove/', | |
args: [productId] | |
}, | |
method: 'POST', | |
success: function (data) { | |
CTX.basket.data = CTX.helpers.objUnderscoreToCamelCase(data.basket); | |
that.fireUpdateCallbacks(); | |
CTX.addNotification({ | |
message: 'Basket item successfully removed', | |
level: 'info' | |
}); | |
}, | |
error: function () { | |
CTX.addNotification({ | |
message: 'Failed to remove basket item', | |
level: 'error' | |
}); | |
}, | |
complete: function () { | |
if ('loading' in CTX) { | |
CTX.loading.remove('basket'); | |
} | |
} | |
}); | |
}; | |
CTX.basket.fireUpdateCallbacks = function () { | |
CTX.basket.callbacks.forEach(function (callback) { | |
callback(); | |
}); | |
}; | |
CTX.basket.registerUpdateCallback = function (callback) { | |
if (typeof callback === 'function') { | |
CTX.basket.callbacks.push(callback); | |
if (CTX.basket.hasData()) { | |
callback(); | |
} | |
} | |
}; | |
CTX.basket.clearUpdateCallbacks = function () { | |
CTX.basket.callbacks = []; | |
}; | |
CTX.basket.count = function () { | |
return this.getVisibleItems().length; | |
}; | |
CTX.basket.getItems = function () { | |
return this.getVisibleItems(); | |
}; | |
CTX.basket.getPrices = function () { | |
var prices = { | |
grossPrice: CTX.basket.data.grossPrice || null, | |
grossSaving: CTX.basket.data.grossSaving || null, | |
netDiscount: CTX.basket.data.netDiscount || null, | |
netPrice: CTX.basket.data.netPrice || null, | |
netSaving: CTX.basket.data.netSaving || null, | |
vatSum: CTX.basket.data.vatSum || null | |
}; | |
return prices; | |
}; | |
CTX.basket.currencySymbol = function () { | |
return CTX.basket.data.currencySymbol || String.fromCharCode(163); | |
}; | |
CTX.basket.getVisibleItems = function () { | |
CTX.basket.visibleItems = []; | |
if (!CTX.basket.hasData()) { | |
return []; | |
} | |
CTX.basket.data.activeItems.forEach(function (basketItem) { | |
if (CTX.basket.data.visibleItems.indexOf(basketItem.id) !== -1) { | |
CTX.basket.visibleItems.push(basketItem); | |
} | |
}); | |
return CTX.basket.visibleItems; | |
}; | |
CTX.basket.getChildItems = function (parentId) { | |
var childItems = []; | |
CTX.basket.visibleItems.forEach(function (basketItem) { | |
if (basketItem.parentId === parentId) { | |
childItems.push(basketItem); | |
} | |
}); | |
return childItems; | |
}; | |
CTX.basket.validateVoucher = function (vCode) { | |
var that = this; | |
CTX.basket.validVoucher = true; | |
CTX.getMessage({ | |
URI: { | |
path: '/order/basket/voucher/', | |
params: { | |
voucher: vCode | |
} | |
}, | |
method: 'POST', | |
success: function (data) { | |
data = CTX.helpers.objUnderscoreToCamelCase(data); | |
CTX.basket.data = data.basket; | |
if (null === data.addVoucherForm.data.voucher) { | |
CTX.basket.validVoucher = false; | |
} | |
}, | |
error: function (data) { | |
CTX.basket.data = CTX.helpers.objUnderscoreToCamelCase(data.basket); | |
CTX.basket.validVoucher = false; | |
}, | |
complete: function () { | |
that.fireUpdateCallbacks(); | |
} | |
}); | |
}; | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.constant = CTX.constant || {}; | |
CTX.constant.http = {}; | |
CTX.constant.http.temporaryRedirect = function () { | |
return 302; | |
}; | |
CTX.constant.http.badData = function () { | |
return 500; | |
}; | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.helpers = CTX.helpers || {}; | |
CTX.helpers.ucfirst = function ucfirst(string) { | |
return string.slice(0, 1).toUpperCase() + string.slice(1); | |
}; | |
CTX.helpers.clone = function clone(data) { | |
var newData; | |
if (typeof data === 'string') { | |
newData = data + ''; | |
} else if (typeof data === 'number') { | |
newData = data + 0; | |
} else if ('array' === CTX.helpers.typeOf(data)) { | |
newData = $.extend([], data); | |
} else { | |
newData = $.extend(true, {}, data); | |
} | |
return newData; | |
}; | |
CTX.helpers.UUID = function UUID() { | |
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { | |
var r = Math.random() * 16 | 0, | |
v = c === 'x' ? r : (r & 0x3 | 0x8); | |
return v.toString(16); | |
}); | |
}; | |
CTX.helpers.stripHTML = function stripHTML(htmlString) { | |
return htmlString.replace(/<[^>]+>/ig, ''); | |
}; | |
CTX.helpers.extend = function extend(childObject, parentObject) { | |
for (var key in parentObject.prototype) { | |
if (parentObject.prototype.hasOwnProperty(key) && !childObject.prototype.hasOwnProperty(key)) { | |
childObject.prototype[key] = parentObject.prototype[key]; | |
} | |
} | |
childObject.prototype.superClass = parentObject.prototype; | |
}; | |
CTX.helpers.objUnderscoreToCamelCase = function (object) { | |
var i; | |
var key; | |
var newKey; | |
if ('object' === CTX.helpers.typeOf(object)) { | |
for (key in object) { | |
if (object.hasOwnProperty(key)) { | |
if (key.indexOf('_') > -1) { | |
newKey = CTX.helpers.underscoreToCamelCase(key); | |
object[newKey] = object[key]; | |
delete object[key]; | |
key = newKey; | |
} | |
if ('object' === CTX.helpers.typeOf(object[key]) || 'array' === CTX.helpers.typeOf(object[key])) { | |
object[key] = CTX.helpers.objUnderscoreToCamelCase(object[key]); | |
} | |
} | |
} | |
return object; | |
} else if ('array' === CTX.helpers.typeOf(object)) { | |
for (i = 0; i < object.length; i = i + 1) { | |
object[i] = CTX.helpers.objUnderscoreToCamelCase(object[i]); | |
} | |
return object; | |
} else { | |
return object; | |
} | |
}; | |
CTX.helpers.underscoreToCamelCase = function (string) { | |
if ('string' === CTX.helpers.typeOf(string)) { | |
return string.replace(/\_([^\_])/ig, function (g) { | |
return g[1].toUpperCase(); | |
}); | |
} | |
CTX.warning('Non string passed to underscoreToCamelCase'); | |
return null; | |
}; | |
CTX.helpers.createCookie = function createCookie(name, value, days) { | |
var expires = ''; | |
if (days) { | |
var date = new Date(); | |
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); | |
expires = '; expires=' + date.toGMTString(); | |
} | |
document.cookie = name + '=' + value + expires + '; path=/'; | |
}; | |
CTX.helpers.readCookie = function readCookie(name) { | |
var nameEQ = name + '='; | |
var ca = document.cookie.split(';'); | |
for (var i = 0; i < ca.length; i += 1) { | |
var c = ca[i]; | |
while (c.charAt(0) === ' ') { | |
c = c.substring(1, c.length); | |
} | |
if (c.indexOf(nameEQ) === 0) { | |
return c.substring(nameEQ.length, c.length); | |
} | |
} | |
return null; | |
}; | |
CTX.helpers.eraseCookie = function eraseCookie(name) { | |
CTX.helpers.createCookie(name, '', -1); | |
}; | |
CTX.helpers.shouldTargetBlankForUri = function shouldTargetBlankForUri(URI) { | |
if (!URI || typeof URI === 'string' || !('data' in URI) || !('path' in URI.data)) { | |
return false; | |
} | |
var linkString = URI.data.path; | |
if (CTX.hasAction(linkString)) { | |
return false; | |
} | |
if (/^\/secure\/logout/.test(linkString)) { | |
return false; | |
} | |
if (!(/2\.0\.1/.test(linkString)) && /^\/secure/.test(linkString)) { | |
return true; | |
} | |
return false; | |
}; | |
CTX.helpers.domainToURI = function (domain) { | |
var matches = domain.match(/((https?):\/\/)?(.*)\.(.*)/i); | |
if ('array' === CTX.helpers.typeOf(matches)) { | |
if ('undefined' === CTX.helpers.typeOf(matches[2])) { | |
domain = 'http://' + domain; | |
} | |
return CTX.helpers.URIToObject(domain); | |
} | |
return null; | |
}; | |
CTX.helpers.URIToObject = function (URI) { | |
var regex = /^(https?):\/\/([^:\/]+)(:([0-9]{1,5}))?\/?([^?]*)(\?([^#]*))?(#.*)?$/i; | |
var matches = URI.match(regex); | |
var paramStrings; | |
var output = { | |
scheme: null, | |
host: null, | |
port: null, | |
path: null, | |
args: [], | |
params: {}, | |
fragment: null | |
}; | |
output.scheme = matches[1]; | |
output.host = matches[2]; | |
if (typeof matches[4] !== 'undefined') { | |
output.port = matches[4]; | |
} | |
if (typeof matches[5] !== 'undefined') { | |
output.path = '/' + matches[5]; | |
} | |
if (typeof matches[7] !== 'undefined') { | |
paramStrings = matches[7].split('&'); | |
paramStrings.forEach(function (string) { | |
var parts = string.match(/([^=]+)=(.*)/); | |
if (typeof parts === 'object' && parts !== null && parts.length > 1) { | |
output.params[parts[1]] = parts[2]; | |
} | |
}); | |
} | |
if (typeof matches[8] !== 'undefined') { | |
output.fragment = matches[8]; | |
} | |
return output; | |
}; | |
CTX.helpers.relativeURIString = function (URI) { | |
var uri = CTX.uriFor(URI).toString(); | |
var uriMatcher = /(.*:)?\/\/([^\/]+)\/(.*)/; | |
var matches = uri.match(uriMatcher); | |
if ('array' === CTX.helpers.typeOf(matches) && matches.length > 3) { | |
return '/' + matches[3]; | |
} | |
return; | |
}; | |
CTX.helpers.getISODate = function getISODate(dateString) { | |
var date; | |
var hours; | |
var minutes; | |
var matches = dateString.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})+:([0-9]{2})(\+|\-)([0-9]{2}):?([0-9]{2})$/); | |
date = new Date(Date.UTC(matches[1], matches[2] - 1, matches[3], matches[4], matches[5], matches[6])); | |
hours = date.getUTCHours(); | |
minutes = date.getUTCMinutes(); | |
if ('+' === matches[7]) { | |
hours -= matches[8]; | |
minutes -= matches[9]; | |
} else { | |
hours += matches[8]; | |
minutes += matches[9]; | |
} | |
date.setUTCHours(hours); | |
date.setUTCMinutes(minutes); | |
return date; | |
}; | |
CTX.helpers.outputShortDate = function (date) { | |
function pad(n) { | |
return n < 10 ? '0' + n : n; | |
} | |
return pad(date.getDate() + 1) + '-' + pad(date.getMonth() + 1) + '-' + date.getFullYear(); | |
}; | |
CTX.helpers.pluralise = function pluralise(count, singular, plural) { | |
if (parseInt(count, 10) === 1) { | |
return singular; | |
} | |
return plural; | |
}; | |
CTX.helpers.getFieldDataStructureInstance = function (field, value) { | |
var returnClass = 'SingleField'; | |
if ('fields' in field) { | |
returnClass = 'CompoundField'; | |
if ('isRepeatable' in field && field.isRepeatable === true) { | |
returnClass = 'RepeatableField'; | |
} | |
} | |
return new CTX.dataStructure.widgets[returnClass](field, value); | |
}; | |
CTX.helpers.getMutableXHR = function (xhr) { | |
var xhrClone = {}; | |
var headers = {}; | |
for (var key in xhr) { | |
if (xhr.hasOwnProperty(key) && (typeof xhr[key] === 'number' || typeof xhr[key] === 'string')) { | |
xhrClone[key] = CTX.helpers.clone(xhr[key]); | |
} | |
} | |
CTX.helpers.clone(xhr.getAllResponseHeaders()).split('\n').forEach(function (string) { | |
var header; | |
if (string !== '') { | |
header = string.match(/^([^:]*)\: (.*)/); | |
if (header !== null && header.length === 3) { | |
headers[header[1].toLowerCase()] = header[2].trim(); | |
} | |
} | |
}); | |
xhrClone.headers = headers; | |
return xhrClone; | |
}; | |
CTX.helpers.compareObj = function compareObj(object1, object2) { | |
var returnVal = true; | |
var keys1; | |
var keys2; | |
if (CTX.helpers.typeOf(keys1) !== 'object' && CTX.helpers.typeOf(keys2) !== 'object') { | |
return false; | |
} | |
keys1 = Object.keys(object1); | |
keys2 = Object.keys(object2); | |
if (keys1.length !== keys2.length) { | |
return false; | |
} | |
keys1.forEach(function (key1) { | |
if (!(key1 in object2)) { | |
returnVal = false; | |
return; | |
} | |
if (CTX.helpers.typeOf(object1[key1]) !== CTX.helpers.typeOf(object2[key1])) { | |
returnVal = false; | |
return; | |
} | |
if ('string' === CTX.helpers.typeOf(object1[key1]) || 'number' === CTX.helpers.typeOf(object1[key1])) { | |
if (object1[key1] !== object2[key1]) { | |
returnVal = false; | |
return; | |
} | |
} | |
}); | |
return returnVal; | |
}; | |
CTX.helpers.typeOf = function typeOf(value) { | |
var s = typeof value; | |
if (s === 'object') { | |
if (value) { | |
if (Object.prototype.toString.call(value) === '[object Array]') { | |
s = 'array'; | |
} | |
} else { | |
s = 'null'; | |
} | |
} | |
return s; | |
}; | |
CTX.helpers.getIconGlyph = function getIconGlyph(icon) { | |
var icons = { | |
'chevron-right': 61524, | |
'search': 61442 | |
}; | |
if (icon in icons) { | |
return String.fromCharCode(icons[icon]); | |
} | |
return ''; | |
}; | |
CTX.helpers.clearURIForWebRequest = function clearURIForWebRequest(URI) { | |
var uriClone = CTX.helpers.clone(URI); | |
if ('params' in uriClone && 'array' === CTX.helpers.typeOf(uriClone.params)) { | |
delete uriClone.params['content-type']; | |
} | |
return uriClone; | |
}; | |
CTX.helpers.redirectWindowToURI = function (URI) { | |
var redirect = {}; | |
if ('object' === CTX.helpers.typeOf(URI)) { | |
redirect = CTX.helpers.clearURIForWebRequest(URI); | |
} | |
window.location.href = CTX.uriFor(redirect).toString(); | |
return true; | |
}; | |
CTX.helpers.isInDOM = function (DOMElement) { | |
var presence = $.contains($('body').get(0), DOMElement); | |
if (true === presence) { | |
return true; | |
} | |
return false; | |
}; | |
CTX.helpers.checkIfInDOMListener = function (DOMElement, callback, startTime) { | |
var msDelay = 500; | |
var msLimit = 15000; | |
var nowTime = new Date().getTime(); | |
startTime = startTime || new Date().getTime(); | |
if (DOMElement instanceof jQuery) { | |
DOMElement = DOMElement.get(0); | |
} | |
if (CTX.helpers.isInDOM(DOMElement)) { | |
callback(DOMElement); | |
} else { | |
if ((nowTime - startTime > msLimit)) { | |
CTX.warning('checkIfInDOMListener reached end of msLimit'); | |
return false; | |
} | |
setTimeout(function () { | |
CTX.helpers.checkIfInDOMListener(DOMElement, callback, startTime); | |
}, msDelay); | |
} | |
}; | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.helpers.domain = CTX.helpers.domain || {}; | |
var extensions = { | |
1: '.co.uk', | |
2: '.org.uk', | |
3: '.me.uk', | |
4: '.ltd.uk', | |
5: '.plc.uk', | |
6: '.net.uk', | |
7: '.sch.uk', | |
8: '.com', | |
9: '.net', | |
10: '.org', | |
11: '.biz', | |
12: '.info', | |
13: '.eu', | |
14: '.cc', | |
15: '.tv', | |
16: '.mobi', | |
17: '.name', | |
18: '.uk.com', | |
19: '.gb.com', | |
20: '.eu.com', | |
21: '.de.com', | |
22: '.jpn.com', | |
23: '.us.com', | |
24: '.qc.com', | |
25: '.cn.com', | |
26: '.za.com', | |
27: '.se.com', | |
28: '.sa.com', | |
29: '.kr.com', | |
30: '.ru.com', | |
31: '.hu.com', | |
32: '.no.com', | |
33: '.uy.com', | |
34: '.br.com', | |
35: '.uk.net', | |
36: '.gb.net', | |
37: '.se.net', | |
38: '.ae.org', | |
39: '.cn', | |
40: '.be', | |
41: '.es', | |
42: '.ch', | |
43: '.dk', | |
44: '.at', | |
45: '.it', | |
46: '.me', | |
47: '.us', | |
48: '.tel', | |
49: '.nhs.uk', | |
50: '.gov.uk', | |
51: '.ac.uk', | |
52: '.pl', | |
53: '.mx', | |
54: '.in', | |
55: '.nl', | |
56: '.im', | |
57: '.co.nz', | |
58: '.de', | |
59: '.nu', | |
60: '.co', | |
61: '.com.mx', | |
62: '.ph', | |
63: '.asia', | |
64: '.com.br', | |
65: '.net.br', | |
66: '.com.es', | |
67: '.org.es', | |
68: '.fm', | |
69: '.pe', | |
70: '.co.za', | |
71: '.jp', | |
72: '.ws', | |
73: '.gov.je', | |
74: '.co.il', | |
75: '.ae', | |
76: '.cx', | |
77: '.so', | |
78: '.gr.com', | |
79: '.gg', | |
80: '.com.au', | |
81: '.is', | |
82: '.ro', | |
83: '.xxx', | |
84: '.xxxlandrush', | |
85: '.xxxsunriseat', | |
86: '.xxxsunribead', | |
87: '.xxxsunriseb', | |
88: '.am', | |
89: '.co.im', | |
90: '.pro', | |
91: '.ie', | |
92: '.sx', | |
93: '.pm', | |
94: '.pw', | |
95: '.tk', | |
96: '.la', | |
97: '.int', | |
98: '.fr', | |
99: '.io', | |
115: '.academy', | |
229: '.berlin', | |
236: '.bike', | |
277: '.builders', | |
283: '.cab', | |
290: '.camera', | |
291: '.camp', | |
303: '.careers', | |
323: '.ceo', | |
322: '.center', | |
361: '.clothing', | |
367: '.coffee', | |
373: '.company', | |
375: '.computer', | |
379: '.construction', | |
382: '.contractors', | |
432: '.diamonds', | |
437: '.directory', | |
450: '.domains', | |
471: '.education', | |
472: '.email', | |
478: '.enterprises', | |
481: '.equipment', | |
486: '.estate', | |
532: '.florist', | |
562: '.gallery', | |
586: '.glass', | |
610: '.graphics', | |
624: '.guru', | |
649: '.holdings', | |
668: '.house', | |
700: '.international', | |
696: '.institute', | |
751: '.kitchen', | |
773: '.land', | |
795: '.lighting', | |
799: '.limo', | |
836: '.management', | |
860: '.menu', | |
1002: '.photography', | |
1003: '.photos', | |
1020: '.plumbing', | |
1057: '.recipes', | |
1070: '.repair', | |
1079: '.rich', | |
1096: '.ruhr', | |
1146: '.sexy', | |
1154: '.shoes', | |
1164: '.singles', | |
1181: '.solar', | |
1182: '.solutions', | |
1216: '.support', | |
1226: '.systems', | |
1235: '.tattoo', | |
1242: '.technology', | |
1259: '.tips', | |
1266: '.today', | |
1281: '.training', | |
1304: '.uno', | |
1312: '.ventures', | |
1340: '.voyage', | |
1498: '.uk', | |
1499: '.co.com' | |
}; | |
CTX.helpers.domain.getAllExtensions = function () { | |
return extensions; | |
}; | |
CTX.helpers.domain.getExtensionId = function (extensionName) { | |
var returnVal = null; | |
Object.keys(extensions).forEach(function (extensionId) { | |
if (extensionName === extensions[extensionId]) { | |
returnVal = extensionId; | |
} | |
}); | |
if (null === returnVal) { | |
CTX.warning('helper.domain: Could not find extension name', extensionName); | |
} | |
return returnVal; | |
}; | |
CTX.helpers.domain.getExtensionName = function (extensionId) { | |
if (extensionId in extensions) { | |
return extensions[extensionId]; | |
} | |
CTX.warning('helper.domain: Could not find extension id', extensionId); | |
return null; | |
}; | |
CTX.helpers.domain.truncateHostname = function (hostname, maxLength) { | |
maxLength = maxLength || 18; | |
var showLength = Math.floor(maxLength / 2) - 2; | |
if (hostname.length > maxLength) { | |
hostname = hostname.substr(0, showLength) + '...' + hostname.substr(hostname.length - showLength); | |
} | |
return hostname; | |
}; | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.productPrice = CTX.productPrice || {}; | |
CTX.productPrice.currencySymbol = function () { | |
if ('basket' in CTX) { | |
return CTX.basket.currencySymbol(); | |
} | |
return String.fromCharCode(163); | |
}; | |
CTX.productPrice.getPriceString = function (value) { | |
return CTX.productPrice.currencySymbol() + Number(value).toFixed(2); | |
}; | |
CTX.productPrice.getProductIdFromName = function (productName) { | |
if ('ExtraUtils' in window && 'products' in window.ExtraUtils && productName in window.ExtraUtils.products) { | |
return parseInt(window.ExtraUtils.products[productName], 10); | |
} | |
return null; | |
}; | |
CTX.productPrice.getPriceObject = function (productId, extensionId) { | |
if (typeof extensionId === 'undefined') { | |
extensionId = 0; | |
} | |
if ('prices' in window.ExtraUtils && 1 in window.ExtraUtils.prices && extensionId in window.ExtraUtils.prices[1] && productId in window.ExtraUtils.prices[1][extensionId]) { | |
return window.ExtraUtils.prices[1][extensionId][productId]; | |
} | |
return null; | |
}; | |
CTX.productPrice.getAvailablePeriods = function (productId, extensionId) { | |
var priceObject = this.getPriceObject(productId, extensionId); | |
var periods = []; | |
if (null !== priceObject && 'prices' in priceObject) { | |
for (var period in priceObject.prices) { | |
if (!(isNaN(period))) { | |
periods.push(period); | |
} | |
} | |
return periods.sort(function (a, b) { | |
return a - b; | |
}); | |
} | |
return null; | |
}; | |
CTX.productPrice.getPrice = function (productId, extensionId, period, quantity) { | |
var priceObject = this.getPriceObject(productId, extensionId); | |
var sum = 0; | |
var pricePeriodObject; | |
var quantities = []; | |
var closest = 1; | |
if (typeof quantity === 'undefined') { | |
quantity = 1; | |
} | |
quantities.forEach(function (quantity) { | |
if (quantity > closest && quantity <= quantity) { | |
closest = quantity; | |
} | |
}); | |
if (null !== priceObject && 'prices' in priceObject && period in priceObject.prices) { | |
pricePeriodObject = priceObject.prices[period]; | |
quantities = Object.keys(pricePeriodObject); | |
sum = pricePeriodObject[closest] * quantity; | |
return Number((Math.round(sum * 100) / 100).toFixed(2)); | |
} | |
return null; | |
}; | |
CTX.productPrice.getPremium = function (premiumCategory) { | |
var premiumAmount = 0; | |
if ('string' === CTX.helpers.typeOf(premiumCategory) || 'number' === CTX.helpers.typeOf(premiumCategory)) { | |
premiumCategory = premiumCategory.toString(); | |
if (premiumCategory in window.ExtraUtils.categoryPremiums) { | |
premiumAmount = Number(window.ExtraUtils.categoryPremiums[premiumCategory]); | |
} | |
} | |
return premiumAmount; | |
}; | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.traverseObject = CTX.traverseObject || {}; | |
CTX.traverseObject.updateField = function (parent, index, changeObject) { | |
if ('updates' in changeObject) { | |
for (var prop in changeObject.updates) { | |
if (changeObject.updates.hasOwnProperty(prop)) { | |
parent.fields[index].data[prop] = changeObject.updates[prop]; | |
} | |
} | |
return true; | |
} | |
}; | |
CTX.traverseObject.appendField = function (parent, index, changeObject) { | |
var newField; | |
if ('fields' in parent) { | |
newField = new CTX.dataStructure.widgets[changeObject.dataType](changeObject.data); | |
if (changeObject.append) { | |
if (index === (parent.fields.length - 1)) { | |
parent.fields.push(newField); | |
} else { | |
parent.fields.splice(index + 1, 0, newField); | |
} | |
} else { | |
if (index === 0) { | |
parent.fields.unshift(newField); | |
} else { | |
parent.fields.splice(index, 0, newField); | |
} | |
} | |
return true; | |
} | |
}; | |
CTX.traverseObject.removeField = function (parent, index) { | |
if ('fields' in parent) { | |
if (index === 0) { | |
parent.fields.shift(); | |
} else if (index === (parent.fields.length - 1)) { | |
parent.fields.pop(); | |
} else { | |
parent.fields.splice(index, 1); | |
} | |
return true; | |
} | |
}; | |
CTX.traverseObject.loopFormObject = function (fieldContainer, index, changes, callback, parent) { | |
var i; | |
var fieldLength; | |
var res; | |
if (parent === null) { | |
parent = fieldContainer; | |
} | |
if (('fullName' in fieldContainer.data) && fieldContainer.data.fullName === changes.fieldName) { | |
return callback(parent, index, CTX.helpers.clone(changes)); | |
} else if ('fields' in fieldContainer) { | |
fieldLength = fieldContainer.fields.length; | |
for (i = 0; i < fieldLength; i = i + 1) { | |
res = false; | |
res = CTX.traverseObject.loopFormObject(fieldContainer.fields[i], i, CTX.helpers.clone(changes), callback, fieldContainer); | |
if (true === res) { | |
return res; | |
} | |
} | |
} else { | |
return false; | |
} | |
}; | |
CTX.traverseObject.formatForm = function (formStructure, structureChanges) { | |
var that = this; | |
if ('remove' in structureChanges) { | |
structureChanges.remove.forEach(function (changeObj, i) { | |
that.loopFormObject(formStructure, i, changeObj, that.removeField, null); | |
}); | |
} | |
if ('append' in structureChanges) { | |
structureChanges.append.forEach(function (changeObj, i) { | |
that.loopFormObject(formStructure, i, changeObj, that.appendField, null); | |
}); | |
} | |
if ('update' in structureChanges) { | |
structureChanges.update.forEach(function (changeObj, i) { | |
that.loopFormObject(formStructure, i, changeObj, that.updateField, null); | |
}); | |
} | |
}; | |
}(window.CTX)); | |
(function (CTX, window) { | |
'use strict'; | |
CTX.tracking = CTX.tracking || {}; | |
CTX.tracking.addToBasket = function (products) { | |
var index; | |
window._gaq = window._gaq || []; | |
for (index = 0; index < products.length; ++index) { | |
if (products[index].product === "Domain") { | |
var productName = products[index].product + " " + products[index].extension; | |
window._gaq.push(['_trackEvent', 'addtobasket', productName, location.pathname]); | |
} else { | |
window._gaq.push(['_trackEvent', 'addtobasket', products[index].product, location.pathname]); | |
} | |
} | |
}; | |
CTX.tracking.pageView = function (URI) { | |
CTX.debug('Tracking page', CTX.URI); | |
window._gaq = window._gaq || []; | |
if ('object' === CTX.helpers.typeOf(URI)) { | |
window._gaq.push(['_trackPageview', CTX.helpers.relativeURIString(URI)]); | |
} else { | |
window._gaq.push(['_trackPageview']); | |
} | |
return true; | |
}; | |
CTX.tracking.purchase = function (basket) { | |
var productKeys; | |
var googleProducts = {}; | |
if ('object' === CTX.helpers.typeOf(basket)) { | |
basket = CTX.helpers.objUnderscoreToCamelCase(basket); | |
Object.keys(basket.activeItems).forEach(function (itemId) { | |
var item = basket.activeItems[itemId]; | |
var sku; | |
if ('hostname' in item && 'extension' in item) { | |
sku = 'Domain_' + item.extension + '_' + item.years; | |
if (item.netPrice === '0.00') { | |
sku += '_FREE'; | |
} | |
if (sku in googleProducts) { | |
googleProducts[sku].quantity = googleProducts[sku].quantity + item.quantity; | |
} else { | |
googleProducts[sku] = { | |
name: item.extension + ' [' + item.years + ' year(s)]', | |
category: 'Domain', | |
price: item.netPrice, | |
quantity: item.quantity | |
}; | |
} | |
} else { | |
sku = item.product_id; | |
if (sku in googleProducts) { | |
googleProducts[sku].quantity = googleProducts[item.id].quantity + item.quantity; | |
} else { | |
googleProducts[sku] = { | |
name: item.product, | |
category: 'other', | |
price: item.netPrice, | |
quantity: item.quantity | |
}; | |
} | |
} | |
}); | |
productKeys = Object.keys(googleProducts); | |
if (productKeys.length > 0) { | |
CTX.debug('Tracking payment', basket); | |
window._gaq = window._gaq || []; | |
window._gaq.push(['_addTrans', basket.id, '', basket.grossPrice, '', '', '', '', '']); | |
productKeys.forEach(function (productKey) { | |
var product = googleProducts[productKey]; | |
window._gaq.push(['_addItem', basket.id, productKey, product.name, product.category, product.price, product.quantity]); | |
}); | |
window._gaq.push(['_trackTrans']); | |
return true; | |
} | |
} | |
return false; | |
}; | |
CTX.tracking.conversion = function (basket) { | |
var url; | |
if ('object' === CTX.helpers.typeOf(basket)) { | |
basket = CTX.helpers.objUnderscoreToCamelCase(basket); | |
if ('grossPrice' in basket) { | |
url = 'https://www.googleadservices.com/pagead/conversion/1070508194/?value=' + basket.grossPrice + '&label=IjXYCPr-2wEQotG6_gM&guid=ON&script=0'; | |
$('body').append('<img height="1" width="1" style="border-style:none;" alt="" src="' + url + '"/>'); | |
return true; | |
} | |
} | |
return false; | |
}; | |
}(window.CTX, window)); | |
if ('undefined' === typeof (CTX.data)) { | |
CTX.data = {}; | |
} | |
CTX.data.routing = { | |
'/affiliate/addproduct/affiliate_add_product': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['affiliate/verisign/add-product'] | |
] | |
}, | |
'/base/default': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['base'] | |
] | |
}, | |
'/christmasgame/delete_entry': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['delete_entry'] | |
] | |
}, | |
'/christmasgame/get_best_scores': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['get_best_scores'] | |
] | |
}, | |
'/christmasgame/get_today_scores': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['get_today_scores'] | |
] | |
}, | |
'/christmasgame/get_voucher': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['get_voucher'] | |
] | |
}, | |
'/christmasgame/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['christmasgame'] | |
] | |
}, | |
'/christmasgame/new_game': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['new_game'] | |
] | |
}, | |
'/christmasgame/new_level': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['new_level'] | |
] | |
}, | |
'/christmasgame/new_score': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['new_score'] | |
] | |
}, | |
'/christmasgame/voucher_code': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['voucher_code'] | |
] | |
}, | |
'/cp/cloudservers/api/backups': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/backups'] | |
] | |
}, | |
'/cp/cloudservers/api/bm_tools': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/bm_tools'] | |
] | |
}, | |
'/cp/cloudservers/api/boot_order': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/boot_order'] | |
] | |
}, | |
'/cp/cloudservers/api/change_billing': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/change_billing'] | |
] | |
}, | |
'/cp/cloudservers/api/feedback': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/feedback'] | |
] | |
}, | |
'/cp/cloudservers/api/ip': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/ip'] | |
] | |
}, | |
'/cp/cloudservers/api/iso': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/iso'] | |
] | |
}, | |
'/cp/cloudservers/api/job': { | |
'args': [2], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/job'] | |
] | |
}, | |
'/cp/cloudservers/api/jobs': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/jobs'] | |
] | |
}, | |
'/cp/cloudservers/api/monitor_contact': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/monitor_contact'] | |
] | |
}, | |
'/cp/cloudservers/api/monitoring': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/monitoring'] | |
] | |
}, | |
'/cp/cloudservers/api/monitoring_services': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/monitoring_services'] | |
] | |
}, | |
'/cp/cloudservers/api/plesk_password': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/plesk_password'] | |
] | |
}, | |
'/cp/cloudservers/api/poll_status': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/poll_status'] | |
] | |
}, | |
'/cp/cloudservers/api/power': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/power'] | |
] | |
}, | |
'/cp/cloudservers/api/ptr': { | |
'args': [2], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/ptr'] | |
] | |
}, | |
'/cp/cloudservers/api/rescue_mode': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/rescue_mode'] | |
] | |
}, | |
'/cp/cloudservers/api/resend_welcome': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/resend_welcome'] | |
] | |
}, | |
'/cp/cloudservers/api/root_password': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/root_password'] | |
] | |
}, | |
'/cp/cloudservers/api/server_description': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/server_description'] | |
] | |
}, | |
'/cp/cloudservers/api/server_hostname': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/server_hostname'] | |
] | |
}, | |
'/cp/cloudservers/api/server_name': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/server_name'] | |
] | |
}, | |
'/cp/cloudservers/api/server_reinstall': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/server_reinstall'] | |
] | |
}, | |
'/cp/cloudservers/api/snapshot': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/snapshot'] | |
] | |
}, | |
'/cp/cloudservers/api/snapshot_slot': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/snapshot_slot'] | |
] | |
}, | |
'/cp/cloudservers/api/traffic': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/traffic'] | |
] | |
}, | |
'/cp/cloudservers/api/upgrade': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/upgrade'] | |
] | |
}, | |
'/cp/cloudservers/api/vnc': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/vnc'] | |
] | |
}, | |
'/cp/cloudservers/api/vnc_password': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/api/vnc_password'] | |
] | |
}, | |
'/cp/cloudservers/apitester': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/apitester'] | |
] | |
}, | |
'/cp/cloudservers/error': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/error'] | |
] | |
}, | |
'/cp/cloudservers/index': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers'] | |
] | |
}, | |
'/cp/cloudservers/manage': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/manage'] | |
] | |
}, | |
'/cp/cloudservers/monitor/alert': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/monitor/alert'] | |
] | |
}, | |
'/cp/cloudservers/renew': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/renew'] | |
] | |
}, | |
'/cp/cloudservers/upgrade': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/upgrade'] | |
] | |
}, | |
'/cp/cloudservers/upgrade_acknowledge': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/upgrade_acknowledge'] | |
] | |
}, | |
'/cp/cloudservers/upgrade_package': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/cloudservers/upgrade_package'] | |
] | |
}, | |
'/cp/customer/country': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/customer/country'] | |
] | |
}, | |
'/cp/customer/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['cp/customer'] | |
] | |
}, | |
'/cp/customer/states': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['cp/customer/states'] | |
] | |
}, | |
'/cp/domain/contact/index': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/domain/contact'] | |
] | |
}, | |
'/cp/domain/contact/security_questions': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/domain/contact/security_questions'] | |
] | |
}, | |
'/cp/domain/ipstag/index': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/domain/ipstag'] | |
] | |
}, | |
'/cp/domain/locking/index': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/domain/locking'] | |
] | |
}, | |
'/cp/domain/nameservers/create': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/domain/nameservers/create'] | |
] | |
}, | |
'/cp/domain/nameservers/index': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/domain/nameservers'] | |
] | |
}, | |
'/cp/domain/whoisprivacy/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['cp/domain/whoisprivacy'] | |
] | |
}, | |
'/cp/invoice/email': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/invoice/email'] | |
] | |
}, | |
'/cp/invoice/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['cp/invoice'] | |
] | |
}, | |
'/cp/invoice/list': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['cp/invoice/list'] | |
] | |
}, | |
'/cp/invoice/print/index': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/invoice/print'] | |
] | |
}, | |
'/cp/invoice/view': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['cp/invoice/view'] | |
] | |
}, | |
'/developer/js/test/index': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['developer/js/test'] | |
] | |
}, | |
'/developer/js/test/test_all_widgets_js': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['developer/js/test/test_all_widgets_js'] | |
] | |
}, | |
'/developer/js/test/unit_tests': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['developer/js/test/unit_tests'] | |
] | |
}, | |
'/developer/table/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['developer/table'] | |
] | |
}, | |
'/developer/tt/test/index': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['developer/tt/test'] | |
] | |
}, | |
'/developer/tt/test/test_all_widgets_tt': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['developer/tt/test/test_all_widgets_tt'] | |
] | |
}, | |
'/dns/google/dnsrecords': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['dns/google/dnsrecords'] | |
] | |
}, | |
'/dns/google/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['dns/google'] | |
] | |
}, | |
'/domain/add_extra_domain': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['domain/add_extra_domain'] | |
] | |
}, | |
'/domain/bulk_orders': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['domain/bulk_orders'] | |
] | |
}, | |
'/domain/bulk_overview': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['domain/bulk_overview'] | |
] | |
}, | |
'/domain/overview': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['domain/overview'] | |
] | |
}, | |
'/domain/renewals2auto': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['domain/renewals2auto'] | |
] | |
}, | |
'/domain/renewals2auto2': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['domain/renewals2auto2'] | |
] | |
}, | |
'/domain/tel_credentials': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['domain/tel_credentials'] | |
] | |
}, | |
'/domain/xxx_edit': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['domain/xxx_edit'] | |
] | |
}, | |
'/domain/xxx_overview': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['domain/xxx_overview'] | |
] | |
}, | |
'/ecommerce-products/epages/add_and_go_to_basket': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['ecommerce-products/epages/add_and_go_to_basket'] | |
] | |
}, | |
'/ecommerce-products/epages/default': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['ecommerce-products/epages'] | |
] | |
}, | |
'/ecommerce-products/epages/display_packages': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['ecommerce-products/epages/display_packages'] | |
] | |
}, | |
'/ecommerce-products/epages/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['ecommerce-products/epages'] | |
] | |
}, | |
'/ecommerce-products/epages/order': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['ecommerce-products/epages/order'] | |
] | |
}, | |
'/ecommerce-products/epages/select_billing': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['ecommerce-products/epages/select_billing'] | |
] | |
}, | |
'/instantsite-products/instantsite/order/add_and_go_to_basket': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['instantsite-products/instantsite/order/add_and_go_to_basket'] | |
] | |
}, | |
'/instantsite-products/instantsite/order/select_billing': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['instantsite-products/instantsite/order/select_billing'] | |
] | |
}, | |
'/instanttraffic/default': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['instanttraffic'] | |
] | |
}, | |
'/instanttraffic/order/default': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['instanttraffic/order'] | |
] | |
}, | |
'/instanttraffic/order/order': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['products/instanttraffic/order'] | |
] | |
}, | |
'/javascript/categories': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['data/categories'] | |
] | |
}, | |
'/javascript/extensions': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['data/extensions'] | |
] | |
}, | |
'/javascript/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['data/data'] | |
] | |
}, | |
'/javascript/pricing': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['data/pricing'] | |
] | |
}, | |
'/legacyuris/cj_redirect_in_dot_cgi': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['cj_redirect_in.cgi'] | |
] | |
}, | |
'/login/check': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['login/check'] | |
] | |
}, | |
'/login/login': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['login'] | |
] | |
}, | |
'/lost-login/check_email': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['lost-login/check_email'] | |
] | |
}, | |
'/lost-login/check_security': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['lost-login/check_security'] | |
] | |
}, | |
'/lost-login/confirm_reset': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['lost-login/confirm_reset'] | |
] | |
}, | |
'/lost-login/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['lost-login'] | |
] | |
}, | |
'/manage-dns/add_dns_record': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['manage-dns/add_dns_record'] | |
] | |
}, | |
'/manage-dns/add_zone': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['manage-dns/add_zone'] | |
] | |
}, | |
'/manage-dns/edit_dns_record': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['manage-dns/edit_dns_record'] | |
] | |
}, | |
'/manage-dns/get_dns': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['manage-dns/get_dns'] | |
] | |
}, | |
'/manage-dns/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['manage-dns'] | |
] | |
}, | |
'/manage-dns/point_domain': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['manage-dns/point_domain'] | |
] | |
}, | |
'/manage-dns/point_email': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['manage-dns/point_email'] | |
] | |
}, | |
'/manage-dns/remove_dns_record': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['manage-dns/remove_dns_record'] | |
] | |
}, | |
'/manage-dns/reset_dns': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['manage-dns/reset_dns'] | |
] | |
}, | |
'/manage-dns/set_dns': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['manage-dns/set_dns'] | |
] | |
}, | |
'/mobile/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['mobile/index'] | |
] | |
}, | |
'/mobile/order/basket/basket': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['mobile/order/basket'] | |
] | |
}, | |
'/mobile/order/domainresults/results_page': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['mobile/order/domainresults'] | |
] | |
}, | |
'/mobile/order/whoisprivacy/offer_whois_privacy': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['mobile/order/whoisprivacy'] | |
] | |
}, | |
'/mobile/secure/log_in': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['mobile/secure/log_in'] | |
] | |
}, | |
'/mobile/secure/order/checkout/checkout': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['mobile/secure/order/checkout'] | |
] | |
}, | |
'/mobile/secure/order/checkout/return_from_card_security': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['mobile/secure/order/checkout/return_from_card_security'] | |
] | |
}, | |
'/mobile/secure/order/checkout/return_from_paypal': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['mobile/secure/order/checkout/return_from_paypal'] | |
] | |
}, | |
'/mobile/secure/order/confirmation/order_success': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['mobile/secure/order/confirmation'] | |
] | |
}, | |
'/mobile/secure/order/registrantdetails/register': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['mobile/secure/order/registrantdetails'] | |
] | |
}, | |
'/mobile/secure/order/trademarkclaim/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['mobile/secure/order/trademarkclaim/index'] | |
] | |
}, | |
'/mobile/support/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['mobile/support/index'] | |
] | |
}, | |
'/mobile/utils/loading': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['mobile/utils/loading'] | |
] | |
}, | |
'/modal': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['bootstrap/order/include/modals'] | |
] | |
}, | |
'/oauth/authorize': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['oauth//authorize'] | |
] | |
}, | |
'/oauth/token': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['oauth//token'] | |
] | |
}, | |
'/op/order/_3dsredirect/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['op/order/_3dsredirect'] | |
] | |
}, | |
'/op/order/backorder/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/confirm-domain-backorders'] | |
] | |
}, | |
'/op/order/basket/addproduct/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/basket/add'] | |
] | |
}, | |
'/op/order/basket/ajax_basket': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['ajax-basket'] | |
] | |
}, | |
'/op/order/basket/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/basket'] | |
] | |
}, | |
'/op/order/basket/referralid/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/basket/referral-id'] | |
] | |
}, | |
'/op/order/basket/remove': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['op/order/basket/remove'] | |
] | |
}, | |
'/op/order/basket/remove_bulk_group': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['op/order/basket/remove_bulk_group'] | |
] | |
}, | |
'/op/order/basket/remove_for_mobile_trademark_page': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['mobile/secure/order/trademarkclaim/delete'] | |
] | |
}, | |
'/op/order/basket/remove_for_trademark_page': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['order/confirm-trademark-claim/delete'] | |
] | |
}, | |
'/op/order/basket/remove_using_full_id': { | |
'args': [8], | |
'captures': [0], | |
'path': [ | |
['op/order/basket/remove'] | |
] | |
}, | |
'/op/order/basket/updateproduct/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/basket/update'] | |
] | |
}, | |
'/op/order/basket/voucher/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/basket/voucher'] | |
] | |
}, | |
'/op/order/confirmation/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/confirmation'] | |
] | |
}, | |
'/op/order/confirmationafter3dsecure/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['op/order/confirmationafter3dsecure'] | |
] | |
}, | |
'/op/order/confirmtransfers/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/confirm-domain-transfers'] | |
] | |
}, | |
'/op/order/domainresults/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/domain'] | |
] | |
}, | |
'/op/order/errorpressedback/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['op/order/errorpressedback'] | |
] | |
}, | |
'/op/order/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order'] | |
] | |
}, | |
'/op/order/login/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/login'] | |
] | |
}, | |
'/op/order/logout/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/logout'] | |
] | |
}, | |
'/op/order/payment/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['op/order/payment'] | |
] | |
}, | |
'/op/order/secure/checkout/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/checkout'] | |
] | |
}, | |
'/op/order/secure/checkout/return_from_3dsecure': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['op/order/return_from_3dsecure'] | |
] | |
}, | |
'/op/order/secure/checkout/return_from_paypal': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['op/order/return_from_paypal'] | |
] | |
}, | |
'/op/order/secure/manageextras/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/manageextras'] | |
] | |
}, | |
'/op/order/secure/registrantdetails/get_all_registrant_details': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/registrant-details/registrant-types'] | |
] | |
}, | |
'/op/order/secure/registrantdetails/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/registrant-details'] | |
] | |
}, | |
'/op/order/secure/websitepassport/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/website-passport'] | |
] | |
}, | |
'/op/order/secure_index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/order'] | |
] | |
}, | |
'/op/order/sitesealsearch/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/siteseal'] | |
] | |
}, | |
'/op/order/sslbasicinfo/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['op/order/sslbasicinfo'] | |
] | |
}, | |
'/op/order/ssldelivery/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['op/order/ssldelivery'] | |
] | |
}, | |
'/op/order/sslextended/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['op/order/sslextended'] | |
] | |
}, | |
'/op/order/sslorganisation/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['op/order/sslorganisation'] | |
] | |
}, | |
'/op/order/sslsummary/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['op/order/sslsummary'] | |
] | |
}, | |
'/op/order/ssltype/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['op/order/ssltype'] | |
] | |
}, | |
'/op/order/trademarkclaim/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/confirm-trademark-claim'] | |
] | |
}, | |
'/op/order/vpsconfig/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/vps'] | |
] | |
}, | |
'/op/order/whois/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/whois'] | |
] | |
}, | |
'/op/order/whoisprivacy/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['order/whois-privacy'] | |
] | |
}, | |
'/op/order/xxxconfirm/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['op/order/xxxconfirm'] | |
] | |
}, | |
'/openxchange/add_and_go_to_basket': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['openxchange/add_and_go_to_basket'] | |
] | |
}, | |
'/openxchange/configure_email': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['openxchange/configure_email'] | |
] | |
}, | |
'/order/basket/recover': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['order/basket/recover'] | |
] | |
}, | |
'/order/product/website_builder': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['order/product/website_builder'] | |
] | |
}, | |
'/public/api/default': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['public/api'] | |
] | |
}, | |
'/public/cloudservers/monitor/alert': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['public/cloudservers/monitor/alert'] | |
] | |
}, | |
'/public/cloudservers/upgrade/acknowledge': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['public/cloudservers/upgrade/acknowledge'] | |
] | |
}, | |
'/public/cloudservers/upgrade/complete': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['public/cloudservers/upgrade/complete'] | |
] | |
}, | |
'/public/domains/contacts/contacts_id': { | |
'args': [1], | |
'captures': [1], | |
'path': [ | |
['public/domains', '', 'contacts'] | |
] | |
}, | |
'/public/domains/contacts/contacts_list': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['public/domains', '', 'contacts'] | |
] | |
}, | |
'/public/domains/expiring/backorder': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['public/domains/expiring/backorder'] | |
] | |
}, | |
'/public/domains/expiring/csv/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['public/domains/expiring/csv'] | |
] | |
}, | |
'/public/domains/expiring/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['public/domains/expiring'] | |
] | |
}, | |
'/public/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['public'] | |
] | |
}, | |
'/public/javascript/set_javascript_mode': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['setJavascriptMode'] | |
] | |
}, | |
'/public/javascript/set_javascript_mode_default': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['setJavascriptMode'] | |
] | |
}, | |
'/public/javascript/set_javascript_mode_off': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['turn-off-javascript'] | |
] | |
}, | |
'/public/javascript/set_javascript_mode_on': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['turn-on-javascript'] | |
] | |
}, | |
'/public/lost-login/check_email': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['public/lost-login/check_email'] | |
] | |
}, | |
'/public/lost-login/check_security': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['public/lost-login/check_security'] | |
] | |
}, | |
'/public/lost-login/confirm_reset': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['public/lost-login/confirm_reset'] | |
] | |
}, | |
'/public/lost-login/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['public/lost-login'] | |
] | |
}, | |
'/public/lostlogin/resetpassword/resetpassword_pl': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['lost-login/resetpassword.pl'] | |
] | |
}, | |
'/public/marketingevents/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['public/marketingevents'] | |
] | |
}, | |
'/public/oauth/domainbox/contacts/contacts_id': { | |
'args': [1], | |
'captures': [1], | |
'path': [ | |
['public/oauth/domainbox', '', 'contacts'] | |
] | |
}, | |
'/public/oauth/domainbox/contacts/contacts_list': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['public/oauth/domainbox', '', 'contacts'] | |
] | |
}, | |
'/public/oauth/domainbox/order/cancel': { | |
'args': [0], | |
'captures': [2], | |
'path': [ | |
['public/oauth/domainbox/user', '', 'order', '', 'cancel'] | |
] | |
}, | |
'/public/oauth/domainbox/order/charge': { | |
'args': [0], | |
'captures': [2], | |
'path': [ | |
['public/oauth/domainbox/user', '', 'order', '', 'charge'] | |
] | |
}, | |
'/public/oauth/domainbox/order/new_order': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['public/oauth/domainbox/user', '', 'order'] | |
] | |
}, | |
'/public/oauth/domainbox/order/preauth': { | |
'args': [0], | |
'captures': [2], | |
'path': [ | |
['public/oauth/domainbox/user', '', 'order', '', 'preauth'] | |
] | |
}, | |
'/public/oauth/domainbox/order/refund': { | |
'args': [0], | |
'captures': [2], | |
'path': [ | |
['public/oauth/domainbox/user', '', 'order', '', 'refund'] | |
] | |
}, | |
'/public/oauth/domainbox/order/release': { | |
'args': [0], | |
'captures': [2], | |
'path': [ | |
['public/oauth/domainbox/user', '', 'order', '', 'release'] | |
] | |
}, | |
'/public/oauth/domainbox/user/user': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['public/oauth/domainbox/user'] | |
] | |
}, | |
'/public/postcode/afnic': { | |
'args': [2], | |
'captures': [0], | |
'path': [ | |
['public/postcode/afnic'] | |
] | |
}, | |
'/public/postcode/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['public/postcode'] | |
] | |
}, | |
'/public/user/index': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['public/user'] | |
] | |
}, | |
'/secure/cpanel/account/change_password': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/account/change_password'] | |
] | |
}, | |
'/secure/cpanel/account/change_security_details': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/account/change_security_details'] | |
] | |
}, | |
'/secure/cpanel/account/change_subscriptions': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/account/change_subscriptions'] | |
] | |
}, | |
'/secure/cpanel/account/check_security_details': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/account/check_security_details'] | |
] | |
}, | |
'/secure/cpanel/account/edit': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/account/edit'] | |
] | |
}, | |
'/secure/cpanel/account/edit_security_details': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/account/edit_security_details'] | |
] | |
}, | |
'/secure/cpanel/account/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/account'] | |
] | |
}, | |
'/secure/cpanel/account/information': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/account/information'] | |
] | |
}, | |
'/secure/cpanel/account/update': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/account/update'] | |
] | |
}, | |
'/secure/cpanel/account/update_security_details': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/account/update_security_details'] | |
] | |
}, | |
'/secure/cpanel/affiliate/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/affiliate/index'] | |
] | |
}, | |
'/secure/cpanel/api/add_dns_record': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/add_dns_record'] | |
] | |
}, | |
'/secure/cpanel/api/add_to_basket': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/add_to_basket'] | |
] | |
}, | |
'/secure/cpanel/api/can_upsell_mailbox': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/can_upsell_mailbox'] | |
] | |
}, | |
'/secure/cpanel/api/check_email_and_username': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/check_email_and_username'] | |
] | |
}, | |
'/secure/cpanel/api/check_security_questions': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/check_security_questions'] | |
] | |
}, | |
'/secure/cpanel/api/check_updates': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/check_updates'] | |
] | |
}, | |
'/secure/cpanel/api/create_customer': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/create_customer'] | |
] | |
}, | |
'/secure/cpanel/api/create_support_ticket': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/create_support_ticket'] | |
] | |
}, | |
'/secure/cpanel/api/default': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api'] | |
] | |
}, | |
'/secure/cpanel/api/edit_dns_record': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/edit_dns_record'] | |
] | |
}, | |
'/secure/cpanel/api/get_all_countries': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/get_all_countries'] | |
] | |
}, | |
'/secure/cpanel/api/get_all_memorable_date_questions': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/get_all_memorable_date_questions'] | |
] | |
}, | |
'/secure/cpanel/api/get_all_product_prices': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/get_all_product_prices'] | |
] | |
}, | |
'/secure/cpanel/api/get_all_security_questions': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/get_all_security_questions'] | |
] | |
}, | |
'/secure/cpanel/api/get_customer': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/get_customer'] | |
] | |
}, | |
'/secure/cpanel/api/get_customer_domains': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/get_customer_domains'] | |
] | |
}, | |
'/secure/cpanel/api/get_dns': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/get_dns'] | |
] | |
}, | |
'/secure/cpanel/api/get_domain_categories': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/get_domain_categories'] | |
] | |
}, | |
'/secure/cpanel/api/get_extensions': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/get_extensions'] | |
] | |
}, | |
'/secure/cpanel/api/get_invoices': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/get_invoices'] | |
] | |
}, | |
'/secure/cpanel/api/get_products': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/get_products'] | |
] | |
}, | |
'/secure/cpanel/api/get_question_and_memorable_date': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/get_question_and_memorable_date'] | |
] | |
}, | |
'/secure/cpanel/api/get_support_ticket_status': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/get_support_ticket_status'] | |
] | |
}, | |
'/secure/cpanel/api/get_whois': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/get_whois'] | |
] | |
}, | |
'/secure/cpanel/api/hello_world': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/hello_world'] | |
] | |
}, | |
'/secure/cpanel/api/is_username_available': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/is_username_available'] | |
] | |
}, | |
'/secure/cpanel/api/login_customer': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/login_customer'] | |
] | |
}, | |
'/secure/cpanel/api/logout_customer': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/logout_customer'] | |
] | |
}, | |
'/secure/cpanel/api/pay_for_basket': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/pay_for_basket'] | |
] | |
}, | |
'/secure/cpanel/api/point_domain': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/point_domain'] | |
] | |
}, | |
'/secure/cpanel/api/point_email': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/point_email'] | |
] | |
}, | |
'/secure/cpanel/api/remove_dns_record': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/remove_dns_record'] | |
] | |
}, | |
'/secure/cpanel/api/reset_dns': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/reset_dns'] | |
] | |
}, | |
'/secure/cpanel/api/session_get': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/session_get'] | |
] | |
}, | |
'/secure/cpanel/api/session_set': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/session_set'] | |
] | |
}, | |
'/secure/cpanel/api/set_dns': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/set_dns'] | |
] | |
}, | |
'/secure/cpanel/api/set_nameservers': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/set_nameservers'] | |
] | |
}, | |
'/secure/cpanel/api/set_xxx_info': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/set_xxx_info'] | |
] | |
}, | |
'/secure/cpanel/api/store_basket_session': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/store_basket_session'] | |
] | |
}, | |
'/secure/cpanel/api/update_customer': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/update_customer'] | |
] | |
}, | |
'/secure/cpanel/api/verify_credit_card': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/api/verify_credit_card'] | |
] | |
}, | |
'/secure/cpanel/backorder/cancel_backorder': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/backorder/cancel_backorder'] | |
] | |
}, | |
'/secure/cpanel/backorder/cancel_backorders': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/backorder/cancel_backorders'] | |
] | |
}, | |
'/secure/cpanel/backorder/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/backorder'] | |
] | |
}, | |
'/secure/cpanel/backorder/purchase': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/backorder/purchase'] | |
] | |
}, | |
'/secure/cpanel/backorder/unpaid_fulfilled': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/backorder/unpaid_fulfilled'] | |
] | |
}, | |
'/secure/cpanel/cp/transfers/cancellation_survey': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/cp/transfers/cancellation_survey'] | |
] | |
}, | |
'/secure/cpanel/cp/transfers/inbound': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/cp/transfers'] | |
] | |
}, | |
'/secure/cpanel/cp/transfers/internal': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/cp/transfers/internal'] | |
] | |
}, | |
'/secure/cpanel/cp/transfers/internal_update': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/cp/transfers/internal/update'] | |
] | |
}, | |
'/secure/cpanel/cp/transfers/outbound': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/cp/transfers/outbound'] | |
] | |
}, | |
'/secure/cpanel/cp/transfers/outbound_ipstag': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/cp/transfers/outbound/ipstag'] | |
] | |
}, | |
'/secure/cpanel/cp/transfers/outbound_request': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/cp/transfers/outbound/request'] | |
] | |
}, | |
'/secure/cpanel/cp/transfers/outbound_unlock': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/cp/transfers/outbound/unlock'] | |
] | |
}, | |
'/secure/cpanel/cp/transfers/update': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/cp/transfers/update'] | |
] | |
}, | |
'/secure/cpanel/cp/transfers/update_survey_results': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/cp/transfers/update_survey_results'] | |
] | |
}, | |
'/secure/cpanel/dashboard': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1'] | |
] | |
}, | |
'/secure/cpanel/domain/add_extra_domain': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/add_extra_domain'] | |
] | |
}, | |
'/secure/cpanel/domain/bulk_orders': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/bulk_orders'] | |
] | |
}, | |
'/secure/cpanel/domain/bulk_overview': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/bulk_overview'] | |
] | |
}, | |
'/secure/cpanel/domain/contact/index': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/contact'] | |
] | |
}, | |
'/secure/cpanel/domain/dns/advanced': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/dns/advanced'] | |
] | |
}, | |
'/secure/cpanel/domain/dns/delete_all': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/dns/delete/all'] | |
] | |
}, | |
'/secure/cpanel/domain/dns/delete_single': { | |
'args': [2], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/dns/delete'] | |
] | |
}, | |
'/secure/cpanel/domain/dns/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/dns'] | |
] | |
}, | |
'/secure/cpanel/domain/dns/manage': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/dns'] | |
] | |
}, | |
'/secure/cpanel/domain/dns/manage_basic': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/dns/basic'] | |
] | |
}, | |
'/secure/cpanel/domain/dns/reset': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/dns/reset'] | |
] | |
}, | |
'/secure/cpanel/domain/forwarding/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/forwarding'] | |
] | |
}, | |
'/secure/cpanel/domain/forwarding/manage': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/forwarding'] | |
] | |
}, | |
'/secure/cpanel/domain/forwarding/remove': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/forwarding/remove'] | |
] | |
}, | |
'/secure/cpanel/domain/icann_verification': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/icann_verification'] | |
] | |
}, | |
'/secure/cpanel/domain/icann_verification_resend': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/icann_verification_resend'] | |
] | |
}, | |
'/secure/cpanel/domain/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/index'] | |
] | |
}, | |
'/secure/cpanel/domain/locking/index': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/locking'] | |
] | |
}, | |
'/secure/cpanel/domain/locking/lock': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/locking/lock'] | |
] | |
}, | |
'/secure/cpanel/domain/locking/unlock': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/locking/unlock'] | |
] | |
}, | |
'/secure/cpanel/domain/manage': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain'] | |
] | |
}, | |
'/secure/cpanel/domain/nameservers/create': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/nameservers/create'] | |
] | |
}, | |
'/secure/cpanel/domain/nameservers/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/nameservers'] | |
] | |
}, | |
'/secure/cpanel/domain/nameservers/manage': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/nameservers'] | |
] | |
}, | |
'/secure/cpanel/domain/nameservers/set_default': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/nameservers/set_default'] | |
] | |
}, | |
'/secure/cpanel/domain/nominet_domain_quality_registration_update': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/nominet_domain_quality_registration_update'] | |
] | |
}, | |
'/secure/cpanel/domain/overview': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/overview'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/account': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium/account'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/api/cancel_domain': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium/api/cancel_domain'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/api/create_update_account': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium/api/create_update_account'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/api/default': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium/api'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/api/get_category_groups': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium/api/get_category_groups'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/api/get_customer_domains': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium/api/get_customer_domains'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/api/get_domain_data': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium/api/get_domain_data'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/api/get_domain_status': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium/api/get_domain_status'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/api/list_update_domain': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium/api/list_update_domain'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/api/skip_account_details': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium/api/skip_account_details'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/api/verify_vat_number': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium/api/verify_vat_number'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/default': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/edit': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium/edit'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/staff/default': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium/staff'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/staff/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium/staff'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/staff/list_sold': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium/staff/list_sold'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/staff/mark_as_paid': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium/staff/mark_as_paid'] | |
] | |
}, | |
'/secure/cpanel/domain/premium/staff/view_bank_details': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/premium/staff/view_bank_details'] | |
] | |
}, | |
'/secure/cpanel/domain/preorders/add_to_basket': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/preorders'] | |
] | |
}, | |
'/secure/cpanel/domain/preorders/do_refund': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/preorders/do_refund'] | |
] | |
}, | |
'/secure/cpanel/domain/preorders/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/preorders'] | |
] | |
}, | |
'/secure/cpanel/domain/preorders/refund': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/preorders/refund'] | |
] | |
}, | |
'/secure/cpanel/domain/privacy/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/privacy'] | |
] | |
}, | |
'/secure/cpanel/domain/privacy/manage': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/privacy'] | |
] | |
}, | |
'/secure/cpanel/domain/privacy/optout': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/privacy/optout'] | |
] | |
}, | |
'/secure/cpanel/domain/privacy/renew': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/privacy/renew'] | |
] | |
}, | |
'/secure/cpanel/domain/renewal/bulk': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/renewal/bulk'] | |
] | |
}, | |
'/secure/cpanel/domain/renewal/cancel/bulk': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/renewal/cancel/bulk'] | |
] | |
}, | |
'/secure/cpanel/domain/renewal/cancel/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/renewal/cancel'] | |
] | |
}, | |
'/secure/cpanel/domain/renewal/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/renewal'] | |
] | |
}, | |
'/secure/cpanel/domain/renewal/manage': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/renewal'] | |
] | |
}, | |
'/secure/cpanel/domain/renewal/manual': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/renewal/manual'] | |
] | |
}, | |
'/secure/cpanel/domain/renewals/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/renew.cgi'] | |
] | |
}, | |
'/secure/cpanel/domain/renewals/renew': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/renewals/renew'] | |
] | |
}, | |
'/secure/cpanel/domain/renewals/select_period': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/renewals/select_period'] | |
] | |
}, | |
'/secure/cpanel/domain/renewals2auto': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/renewals2auto'] | |
] | |
}, | |
'/secure/cpanel/domain/renewals2auto2': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/renewals2auto2'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/add_domain': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff/add_domain'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/add_domain_ajax': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff/add_domain_ajax'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/change_settings': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff/change_settings'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/contact_email_check': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff/contact_email_check'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/contact_email_resend': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff/contact_email_resend'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/contact_email_verification': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff/contact_email_verification'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/do_unrenew_domain': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff/do_unrenew_domain'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/failed_domains': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff/failed_domains'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/fix_srs_domain': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff/fix_srs_domain'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/insert_domain': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff/insert_domain'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/name_servers': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff/name_servers'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/remove_domain': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff/remove_domain'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/reset_attempts': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff/reset_attempts'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/unrenew_domain': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff/unrenew_domain'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/update_registrant': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff/update_registrant'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/view_failed_domain': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff/view_failed_domain'] | |
] | |
}, | |
'/secure/cpanel/domain/staff/view_settings': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/staff/view_settings'] | |
] | |
}, | |
'/secure/cpanel/domain/tel_credentials': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/tel_credentials'] | |
] | |
}, | |
'/secure/cpanel/domain/transfer/accept': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/transfer/accept'] | |
] | |
}, | |
'/secure/cpanel/domain/transfer/authcode/de_contact_form': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/transfer/authcode/contact'] | |
] | |
}, | |
'/secure/cpanel/domain/transfer/authcode/index': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/transfer/authcode'] | |
] | |
}, | |
'/secure/cpanel/domain/transfer/cancel': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/transfer/cancel'] | |
] | |
}, | |
'/secure/cpanel/domain/transfer/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/transfer'] | |
] | |
}, | |
'/secure/cpanel/domain/transfer/internal/index': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/transfer/internal'] | |
] | |
}, | |
'/secure/cpanel/domain/transfer/ipstag/index': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/transfer/ipstag'] | |
] | |
}, | |
'/secure/cpanel/domain/transfer/manage': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/transfer/manage'] | |
] | |
}, | |
'/secure/cpanel/domain/transfer/retry': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/transfer/retry'] | |
] | |
}, | |
'/secure/cpanel/domain/transfer/send_admin_email': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/domain/transfer/send_admin_email'] | |
] | |
}, | |
'/secure/cpanel/domain/xxx_edit': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/xxx_edit'] | |
] | |
}, | |
'/secure/cpanel/domain/xxx_overview': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/domain/xxx_overview'] | |
] | |
}, | |
'/secure/cpanel/epages/assign_domain': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/epages/manage/id', '', 'assign_domain'] | |
] | |
}, | |
'/secure/cpanel/epages/change_domain': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/epages/manage/id', '', 'change_domain'] | |
] | |
}, | |
'/secure/cpanel/epages/claim_free_ssl': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/epages/manage/id', '', 'claim_free_ssl'] | |
] | |
}, | |
'/secure/cpanel/epages/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/epages/manage'] | |
] | |
}, | |
'/secure/cpanel/epages/login': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/epages/manage/id', '', 'login'] | |
] | |
}, | |
'/secure/cpanel/epages/renew': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/epages/manage/id', '', 'renew'] | |
] | |
}, | |
'/secure/cpanel/epages/set_billing': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/epages/manage/id', '', 'set_billing'] | |
] | |
}, | |
'/secure/cpanel/epages/set_renew': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/epages/manage/id', '', 'set_renew'] | |
] | |
}, | |
'/secure/cpanel/epages/shop': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/epages/manage/id', '', 'shop'] | |
] | |
}, | |
'/secure/cpanel/epages/staff/cancel': { | |
'args': [0, null], | |
'captures': [1, 0], | |
'path': [ | |
['secure/cpanel/epages/staff/id', '', 'cancel'], | |
['secure/cpanel/epages/staff/cancel'] | |
] | |
}, | |
'/secure/cpanel/epages/staff/change_domain': { | |
'args': [0, null], | |
'captures': [1, 0], | |
'path': [ | |
['secure/cpanel/epages/staff/id', '', 'change_domain'], | |
['secure/cpanel/epages/staff/change_domain'] | |
] | |
}, | |
'/secure/cpanel/epages/staff/change_expiry': { | |
'args': [0, null], | |
'captures': [1, 0], | |
'path': [ | |
['secure/cpanel/epages/staff/id', '', 'change_expiry'], | |
['secure/cpanel/epages/staff/change_expiry'] | |
] | |
}, | |
'/secure/cpanel/epages/staff/change_subdomain': { | |
'args': [0, null], | |
'captures': [1, 0], | |
'path': [ | |
['secure/cpanel/epages/staff/id', '', 'change_subdomain'], | |
['secure/cpanel/epages/staff/change_subdomain'] | |
] | |
}, | |
'/secure/cpanel/epages/staff/change_username': { | |
'args': [0, null], | |
'captures': [1, 0], | |
'path': [ | |
['secure/cpanel/epages/staff/id', '', 'change_username'], | |
['secure/cpanel/epages/staff/change_username'] | |
] | |
}, | |
'/secure/cpanel/epages/staff/edit_ssl_flag': { | |
'args': [0, null], | |
'captures': [1, 0], | |
'path': [ | |
['secure/cpanel/epages/staff/id', '', 'edit_ssl_flag'], | |
['secure/cpanel/epages/staff/edit_ssl_flag'] | |
] | |
}, | |
'/secure/cpanel/epages/staff/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/epages/staff'] | |
] | |
}, | |
'/secure/cpanel/epages/staff/login': { | |
'args': [0, null], | |
'captures': [1, 0], | |
'path': [ | |
['secure/cpanel/epages/staff/id', '', 'login'], | |
['secure/cpanel/epages/staff/login'] | |
] | |
}, | |
'/secure/cpanel/epages/staff/manage': { | |
'args': [0, null], | |
'captures': [1, 0], | |
'path': [ | |
['secure/cpanel/epages/staff/id', '', 'manage'], | |
['secure/cpanel/epages/staff/manage'] | |
] | |
}, | |
'/secure/cpanel/epages/staff/query_epages_api': { | |
'args': [0, null], | |
'captures': [1, 0], | |
'path': [ | |
['secure/cpanel/epages/staff/id', '', 'query_epages_api'], | |
['secure/cpanel/epages/staff/query_epages_api'] | |
] | |
}, | |
'/secure/cpanel/epages/staff/renew': { | |
'args': [0, null], | |
'captures': [1, 0], | |
'path': [ | |
['secure/cpanel/epages/staff/id', '', 'renew'], | |
['secure/cpanel/epages/staff/renew'] | |
] | |
}, | |
'/secure/cpanel/epages/staff/uncancel': { | |
'args': [0, null], | |
'captures': [1, 0], | |
'path': [ | |
['secure/cpanel/epages/staff/id', '', 'uncancel'], | |
['secure/cpanel/epages/staff/uncancel'] | |
] | |
}, | |
'/secure/cpanel/epages/update_domain': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/epages/manage/id', '', 'update_domain'] | |
] | |
}, | |
'/secure/cpanel/epages/upgrade': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/epages/manage/id', '', 'upgrade'] | |
] | |
}, | |
'/secure/cpanel/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure'] | |
] | |
}, | |
'/secure/cpanel/instantsite/manage/change_domain': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instantsite/manage/change_domain'] | |
] | |
}, | |
'/secure/cpanel/instantsite/manage/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instantsite/manage'] | |
] | |
}, | |
'/secure/cpanel/instantsite/manage/list': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instantsite/manage/list'] | |
] | |
}, | |
'/secure/cpanel/instantsite/manage/manage_legacy': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instantsite/manage/manage_legacy'] | |
] | |
}, | |
'/secure/cpanel/instantsite/manage/package': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instantsite/manage/package'] | |
] | |
}, | |
'/secure/cpanel/instantsite/manage/point_domain': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instantsite/manage/point_domain'] | |
] | |
}, | |
'/secure/cpanel/instantsite/manage/provision_free_plan_for_domain': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instantsite/manage/provision_free_plan_for_domain'] | |
] | |
}, | |
'/secure/cpanel/instantsite/manage/take_offline': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instantsite/manage/take_offline'] | |
] | |
}, | |
'/secure/cpanel/instantsite/manage/to_renew': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instantsite/manage/to_renew'] | |
] | |
}, | |
'/secure/cpanel/instantsite/manage/upgrade': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instantsite/manage/upgrade'] | |
] | |
}, | |
'/secure/cpanel/instantsite/order/add_domain': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instantsite/order/add_domain'] | |
] | |
}, | |
'/secure/cpanel/instantsite/order/add_to_basket': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instantsite/order/add_to_basket'] | |
] | |
}, | |
'/secure/cpanel/instantsite/order/add_upgrade_to_basket': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instantsite/order/add_upgrade_to_basket'] | |
] | |
}, | |
'/secure/cpanel/instantsite/order/choose_product': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instantsite/order/choose_product'] | |
] | |
}, | |
'/secure/cpanel/instantsite/order/order': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instantsite/order/order'] | |
] | |
}, | |
'/secure/cpanel/instantsite/order/renew': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instantsite/order/renew'] | |
] | |
}, | |
'/secure/cpanel/instantsite/order/select_billing': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instantsite/order/select_billing'] | |
] | |
}, | |
'/secure/cpanel/instanttraffic/controlpanel/buy': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instanttraffic/buy'] | |
] | |
}, | |
'/secure/cpanel/instanttraffic/controlpanel/default': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instanttraffic/controlpanel'] | |
] | |
}, | |
'/secure/cpanel/instanttraffic/controlpanel/manage': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instanttraffic/manage'] | |
] | |
}, | |
'/secure/cpanel/instanttraffic/controlpanel/manage_package': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instanttraffic/manage_package'] | |
] | |
}, | |
'/secure/cpanel/instanttraffic/controlpanel/pay': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instanttraffic/pay'] | |
] | |
}, | |
'/secure/cpanel/instanttraffic/controlpanel/upgrade': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/instanttraffic/upgrade'] | |
] | |
}, | |
'/secure/cpanel/json/hosting/add_mapping': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/json/hosting/add_mapping'] | |
] | |
}, | |
'/secure/cpanel/json/hosting/domain': { | |
'args': [2], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/json/hosting/domain'] | |
] | |
}, | |
'/secure/cpanel/json/hosting/edit_mapping': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/json/hosting/edit_mapping'] | |
] | |
}, | |
'/secure/cpanel/json/hosting/get_all_domain_info_for_customer': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/json/hosting/get_all_domain_info_for_customer'] | |
] | |
}, | |
'/secure/cpanel/json/hosting/get_all_domains_for_customer': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/json/hosting/get_all_domains_for_customer'] | |
] | |
}, | |
'/secure/cpanel/json/hosting/get_all_external_domains_for_customer': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/json/hosting/get_all_external_domains_for_customer'] | |
] | |
}, | |
'/secure/cpanel/json/hosting/get_all_subdomains_for_customer': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/json/hosting/get_all_subdomains_for_customer'] | |
] | |
}, | |
'/secure/cpanel/json/hosting/get_hosting_folders': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/json/hosting/get_hosting_folders'] | |
] | |
}, | |
'/secure/cpanel/json/hosting/list_mapping': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/json/hosting/list_mapping'] | |
] | |
}, | |
'/secure/cpanel/json/hosting/remove_external_domain': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/json/hosting/remove_external_domain'] | |
] | |
}, | |
'/secure/cpanel/json/hosting/remove_mapping': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/json/hosting/remove_mapping'] | |
] | |
}, | |
'/secure/cpanel/json/hosting/renew': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/json/hosting/renew'] | |
] | |
}, | |
'/secure/cpanel/json/hosting/send_dns_details': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/json/hosting/send_dns_details'] | |
] | |
}, | |
'/secure/cpanel/json/hosting/store_external_domain': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/json/hosting/store_external_domain'] | |
] | |
}, | |
'/secure/cpanel/json/hosting/upgrade': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/json/hosting/upgrade'] | |
] | |
}, | |
'/secure/cpanel/mailbox/add_addresses_to_catchall': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/mailbox/add_addresses_to_catchall'] | |
] | |
}, | |
'/secure/cpanel/mailbox/add_forward': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/mailbox/add_forward'] | |
] | |
}, | |
'/secure/cpanel/mailbox/buy_mailboxes': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/mailbox/buy_mailboxes'] | |
] | |
}, | |
'/secure/cpanel/mailbox/change_password': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/mailbox/change_password'] | |
] | |
}, | |
'/secure/cpanel/mailbox/create': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/mailbox/create'] | |
] | |
}, | |
'/secure/cpanel/mailbox/create_catchall': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/mailbox/create_catchall'] | |
] | |
}, | |
'/secure/cpanel/mailbox/delete': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/mailbox/delete'] | |
] | |
}, | |
'/secure/cpanel/mailbox/delete_catchall': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/mailbox/delete_catchall'] | |
] | |
}, | |
'/secure/cpanel/mailbox/delete_forward': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/mailbox/delete_forward'] | |
] | |
}, | |
'/secure/cpanel/mailbox/delete_mailboxes': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/mailbox/delete_mailboxes'] | |
] | |
}, | |
'/secure/cpanel/mailbox/remove_email_from_forward': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/mailbox/remove_email_from_forward'] | |
] | |
}, | |
'/secure/cpanel/mailbox/set_autoresponder': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/mailbox/set_autoresponder'] | |
] | |
}, | |
'/secure/cpanel/mailbox/update_catchall': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/mailbox/update_catchall'] | |
] | |
}, | |
'/secure/cpanel/mailbox/update_package': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/mailbox/update_package'] | |
] | |
}, | |
'/secure/cpanel/payment/apply_voucher_code': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/payment/apply_voucher_code'] | |
] | |
}, | |
'/secure/cpanel/payment/get_products_with_prices': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/payment/get_products_with_prices'] | |
] | |
}, | |
'/secure/cpanel/payment/payment_success': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/payment/payment_success'] | |
] | |
}, | |
'/secure/cpanel/payment/return_3ds': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/payment/return_3ds'] | |
] | |
}, | |
'/secure/cpanel/payment/return_paypal': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/payment/return_paypal'] | |
] | |
}, | |
'/secure/cpanel/payment/show_basket': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/payment/show_basket'] | |
] | |
}, | |
'/secure/cpanel/payment/show_payment': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/payment/show_payment'] | |
] | |
}, | |
'/secure/cpanel/payment/take_credit_payment': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/payment/take_credit_payment'] | |
] | |
}, | |
'/secure/cpanel/payment/take_payment': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/payment/take_payment'] | |
] | |
}, | |
'/secure/cpanel/payment/verify_customer_card': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/payment/verify_customer_card'] | |
] | |
}, | |
'/secure/cpanel/payment/verify_payment_method': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/payment/verify_payment_method'] | |
] | |
}, | |
'/secure/cpanel/referrals/commissions': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/referrals/commissions'] | |
] | |
}, | |
'/secure/cpanel/referrals/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/referrals'] | |
] | |
}, | |
'/secure/cpanel/referrals/inviteafriend': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/referrals/inviteafriend'] | |
] | |
}, | |
'/secure/cpanel/service/feedback': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/service/feedback'] | |
] | |
}, | |
'/secure/cpanel/service/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/service'] | |
] | |
}, | |
'/secure/cpanel/service/send_welcome_email': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/service/send_welcome_email'] | |
] | |
}, | |
'/secure/cpanel/service/specific_tab': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/service'] | |
] | |
}, | |
'/secure/cpanel/service/stats': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/2.0.1/service/stats'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/api/create_update_account': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/api/create_update_account'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/api/default': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/api'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/api/disable_account': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/api/disable_account'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/api/enable_account': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/api/enable_account'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/api/get_cancel_reasons': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/api/get_cancel_reasons'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/api/get_quota': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/api/get_quota'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/api/get_report': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/api/get_report'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/api/get_status': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/api/get_status'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/api/remove_account': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/api/remove_account'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/api/set_token_to_expire': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/api/set_token_to_expire'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/api/update_email_frequency': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/api/update_email_frequency'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/api/update_recipients': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/api/update_recipients'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/api/update_scan_frequency': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/api/update_scan_frequency'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/controlpanel/default': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/controlpanel'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/controlpanel/detail': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/detail'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/controlpanel/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/controlpanel'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/controlpanel/list_renewals': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/list_renewals'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/controlpanel/renew': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/renew'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/controlpanel/rep_sources': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/rep_sources'] | |
] | |
}, | |
'/secure/cpanel/sitescanner/controlpanel/upgrade': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/sitescanner/upgrade'] | |
] | |
}, | |
'/secure/cpanel/ssl/assign': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/ssl/assign'] | |
] | |
}, | |
'/secure/cpanel/ssl/csr/generate': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/ssl/generate-csr'] | |
] | |
}, | |
'/secure/cpanel/ssl/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/ssl'] | |
] | |
}, | |
'/secure/cpanel/staff/blacklist/blacklisted': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['staff/blacklisted'] | |
] | |
}, | |
'/secure/cpanel/staff/cardtool/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/cardtool'] | |
] | |
}, | |
'/secure/cpanel/staff/cloudserver/get_api_log_message': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/cloudserver/get_api_log_message'] | |
] | |
}, | |
'/secure/cpanel/staff/cloudserver/get_api_logs': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/cloudserver/get_api_logs'] | |
] | |
}, | |
'/secure/cpanel/staff/cloudserver/get_job_details': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/cloudserver/get_job_details'] | |
] | |
}, | |
'/secure/cpanel/staff/cloudserver/get_server_jobs': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/cloudserver/get_server_jobs'] | |
] | |
}, | |
'/secure/cpanel/staff/cloudserver/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/cloudserver'] | |
] | |
}, | |
'/secure/cpanel/staff/cloudserver/list': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/cloudserver/list'] | |
] | |
}, | |
'/secure/cpanel/staff/cloudserver/manage': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/cloudserver/manage'] | |
] | |
}, | |
'/secure/cpanel/staff/cloudserver/mark_active': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/cloudserver/mark_active'] | |
] | |
}, | |
'/secure/cpanel/staff/cloudserver/search': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/cloudserver/search'] | |
] | |
}, | |
'/secure/cpanel/staff/cloudserver/unprocessed': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/cloudserver/unprocessed'] | |
] | |
}, | |
'/secure/cpanel/staff/cloudserver/unsuspend': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/cloudserver/unsuspend'] | |
] | |
}, | |
'/secure/cpanel/staff/cloudserver/upgrade_request': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/cloudserver/upgrade_request'] | |
] | |
}, | |
'/secure/cpanel/staff/customerattributes/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/customerattributes'] | |
] | |
}, | |
'/secure/cpanel/staff/customerattributes/set_attribute': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/customerattributes/set_attribute'] | |
] | |
}, | |
'/secure/cpanel/staff/dns/add_bulk_a_records': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/dns/add_bulk_a_records'] | |
] | |
}, | |
'/secure/cpanel/staff/dns/add_bulk_mx_records': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/dns/add_bulk_mx_records'] | |
] | |
}, | |
'/secure/cpanel/staff/dns/bulk': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/dns/bulk'] | |
] | |
}, | |
'/secure/cpanel/staff/dns/edit': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/dns/edit'] | |
] | |
}, | |
'/secure/cpanel/staff/dns/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/dns'] | |
] | |
}, | |
'/secure/cpanel/staff/domain/bulk_contact_details_change': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/domain/bulk_contact_details_change'] | |
] | |
}, | |
'/secure/cpanel/staff/domain/bulk_nameserver_change': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/domain/bulk_nameserver_change'] | |
] | |
}, | |
'/secure/cpanel/staff/domain/extensionattributes/ch': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/domain/extensionattributes/ch'] | |
] | |
}, | |
'/secure/cpanel/staff/domain/extensionattributes/extension': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/domain/extensionattributes'] | |
] | |
}, | |
'/secure/cpanel/staff/domain/extensionattributes/list': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/domain/extensionattributes/list'] | |
] | |
}, | |
'/secure/cpanel/staff/domain/extensionattributes/main': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/domain/extensionattributes'] | |
] | |
}, | |
'/secure/cpanel/staff/domain/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/domain'] | |
] | |
}, | |
'/secure/cpanel/staff/domain/list': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/domain/list'] | |
] | |
}, | |
'/secure/cpanel/staff/domain/search': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/domain/search'] | |
] | |
}, | |
'/secure/cpanel/staff/domain/update_contacts': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/domain/update_contacts'] | |
] | |
}, | |
'/secure/cpanel/staff/domain/update_nameservers': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/domain/update_nameservers'] | |
] | |
}, | |
'/secure/cpanel/staff/gtld/get_api_log_message': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/gtld/get_api_log_message'] | |
] | |
}, | |
'/secure/cpanel/staff/gtld/get_api_logs': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/gtld/get_api_logs'] | |
] | |
}, | |
'/secure/cpanel/staff/gtld/get_job_details': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/gtld/get_job_details'] | |
] | |
}, | |
'/secure/cpanel/staff/gtld/get_server_jobs': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/gtld/get_server_jobs'] | |
] | |
}, | |
'/secure/cpanel/staff/gtld/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/gtld'] | |
] | |
}, | |
'/secure/cpanel/staff/premiumdomains/check': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/premiumdomains/check'] | |
] | |
}, | |
'/secure/cpanel/staff/premiumdomains/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/premiumdomains'] | |
] | |
}, | |
'/secure/cpanel/staff/premiumdomains/purchase': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/premiumdomains/purchase'] | |
] | |
}, | |
'/secure/cpanel/staff/premiumdomains/release': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/premiumdomains/release'] | |
] | |
}, | |
'/secure/cpanel/staff/premiumdomains/send_email': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/premiumdomains/send_email'] | |
] | |
}, | |
'/secure/cpanel/staff/services/cancel': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/services/cancel'] | |
] | |
}, | |
'/secure/cpanel/staff/services/get_cancel_reasons': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/services/get_cancel_reasons'] | |
] | |
}, | |
'/secure/cpanel/staff/services/get_log': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/services/get_log'] | |
] | |
}, | |
'/secure/cpanel/staff/services/get_product_groups': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/services/get_product_groups'] | |
] | |
}, | |
'/secure/cpanel/staff/services/get_services': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/services/get_services'] | |
] | |
}, | |
'/secure/cpanel/staff/services/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/services'] | |
] | |
}, | |
'/secure/cpanel/staff/services/renew': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/services/renew'] | |
] | |
}, | |
'/secure/cpanel/staff/services/services_base': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/services'] | |
] | |
}, | |
'/secure/cpanel/staff/services/suspend': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/services/suspend'] | |
] | |
}, | |
'/secure/cpanel/staff/services/update_product': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/services/update_product'] | |
] | |
}, | |
'/secure/cpanel/staff/services/update_renewal_status': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/services/update_renewal_status'] | |
] | |
}, | |
'/secure/cpanel/staff/transfers/create_secondary_transfer_reason': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/transfers/create_secondary_transfer_reason'] | |
] | |
}, | |
'/secure/cpanel/staff/transfers/create_transfer_reason': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/transfers/create_transfer_reason'] | |
] | |
}, | |
'/secure/cpanel/staff/transfers/delete_transfer_reason': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/transfers/delete_transfer_reason'] | |
] | |
}, | |
'/secure/cpanel/staff/transfers/edit_transfer_reason': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/transfers/edit_transfer_reason'] | |
] | |
}, | |
'/secure/cpanel/staff/transfers/export_transfer_data': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/transfers/export_transfer_data'] | |
] | |
}, | |
'/secure/cpanel/staff/transfers/output_transfer_data': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/transfers/output_transfer_data'] | |
] | |
}, | |
'/secure/cpanel/staff/transfers/transfer_reasons': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/transfers/transfer_reasons'] | |
] | |
}, | |
'/secure/cpanel/staff/transfers/update_transfer_reason': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/staff/transfers/update_transfer_reason'] | |
] | |
}, | |
'/secure/cpanel/tag': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/tag'] | |
] | |
}, | |
'/secure/cpanel/vps/api/assign_ip': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/assign_ip'] | |
] | |
}, | |
'/secure/cpanel/vps/api/cancel_downgrades': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/cancel_downgrades'] | |
] | |
}, | |
'/secure/cpanel/vps/api/cancel_ftp': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/cancel_ftp'] | |
] | |
}, | |
'/secure/cpanel/vps/api/change_billing': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/change_billing'] | |
] | |
}, | |
'/secure/cpanel/vps/api/change_password': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/change_password'] | |
] | |
}, | |
'/secure/cpanel/vps/api/change_state': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/change_state'] | |
] | |
}, | |
'/secure/cpanel/vps/api/create_ftp_account': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/create_ftp_account'] | |
] | |
}, | |
'/secure/cpanel/vps/api/edit_ip_domain': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/edit_ip_domain'] | |
] | |
}, | |
'/secure/cpanel/vps/api/get_scripts': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/get_scripts'] | |
] | |
}, | |
'/secure/cpanel/vps/api/get_vps': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/get_vps'] | |
] | |
}, | |
'/secure/cpanel/vps/api/get_vps_GET': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/get_vps_GET'] | |
] | |
}, | |
'/secure/cpanel/vps/api/install_script': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/install_script'] | |
] | |
}, | |
'/secure/cpanel/vps/api/modify': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/modify'] | |
] | |
}, | |
'/secure/cpanel/vps/api/name_available': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/name_available'] | |
] | |
}, | |
'/secure/cpanel/vps/api/poll_ftp_status': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/poll_ftp_status'] | |
] | |
}, | |
'/secure/cpanel/vps/api/poll_status': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/poll_status'] | |
] | |
}, | |
'/secure/cpanel/vps/api/rebuild': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/rebuild'] | |
] | |
}, | |
'/secure/cpanel/vps/api/remove_addon': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/remove_addon'] | |
] | |
}, | |
'/secure/cpanel/vps/api/remove_ftp_account': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/remove_ftp_account'] | |
] | |
}, | |
'/secure/cpanel/vps/api/remove_ip': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/remove_ip'] | |
] | |
}, | |
'/secure/cpanel/vps/api/resend_welcome': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/resend_welcome'] | |
] | |
}, | |
'/secure/cpanel/vps/api/send_feedback': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/send_feedback'] | |
] | |
}, | |
'/secure/cpanel/vps/api/set_autorenew': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/set_autorenew'] | |
] | |
}, | |
'/secure/cpanel/vps/api/set_ptr': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/set_ptr'] | |
] | |
}, | |
'/secure/cpanel/vps/api/update_ftp_account': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/api/update_ftp_account'] | |
] | |
}, | |
'/secure/cpanel/vps/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps'] | |
] | |
}, | |
'/secure/cpanel/vps/manage/change_password': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/manage/change_password'] | |
] | |
}, | |
'/secure/cpanel/vps/manage/change_state': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/manage/change_state'] | |
] | |
}, | |
'/secure/cpanel/vps/manage/get_vps': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/manage/get_vps'] | |
] | |
}, | |
'/secure/cpanel/vps/manage/index': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/manage'] | |
] | |
}, | |
'/secure/cpanel/vps/manage/modify': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/manage/modify'] | |
] | |
}, | |
'/secure/cpanel/vps/manage/name_available': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/manage/name_available'] | |
] | |
}, | |
'/secure/cpanel/vps/manage/poll_status': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/manage/poll_status'] | |
] | |
}, | |
'/secure/cpanel/vps/manage/rebuild': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/manage/rebuild'] | |
] | |
}, | |
'/secure/cpanel/vps/manage/set_autorenew': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/manage/set_autorenew'] | |
] | |
}, | |
'/secure/cpanel/vps/order/add_ftp_backup': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/order/add_ftp_backup'] | |
] | |
}, | |
'/secure/cpanel/vps/order/add_to_basket': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/order/add_to_basket'] | |
] | |
}, | |
'/secure/cpanel/vps/order/add_upgrade_to_basket': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/order/add_upgrade_to_basket'] | |
] | |
}, | |
'/secure/cpanel/vps/order/basket': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/order/basket'] | |
] | |
}, | |
'/secure/cpanel/vps/order/change_cp': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/order/change_cp'] | |
] | |
}, | |
'/secure/cpanel/vps/order/change_os': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/order/change_os'] | |
] | |
}, | |
'/secure/cpanel/vps/order/downgrade_confirm': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/order/downgrade_confirm'] | |
] | |
}, | |
'/secure/cpanel/vps/order/error': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/order/error'] | |
] | |
}, | |
'/secure/cpanel/vps/order/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/order'] | |
] | |
}, | |
'/secure/cpanel/vps/order/name_available': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/order/name_available'] | |
] | |
}, | |
'/secure/cpanel/vps/order/renew': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/order/renew'] | |
] | |
}, | |
'/secure/cpanel/vps/order/upgrade': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/order/upgrade'] | |
] | |
}, | |
'/secure/cpanel/vps/staff/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/staff'] | |
] | |
}, | |
'/secure/cpanel/vps/staff/list': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/staff/list'] | |
] | |
}, | |
'/secure/cpanel/vps/staff/manage': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/staff/manage'] | |
] | |
}, | |
'/secure/cpanel/vps/staff/search': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/vps/staff/search'] | |
] | |
}, | |
'/secure/cpanel/website-builder/change_domain': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/website-builder/id', '', 'change_domain'] | |
] | |
}, | |
'/secure/cpanel/website-builder/choose_product': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/website-builder/id', '', 'choose_product'] | |
] | |
}, | |
'/secure/cpanel/website-builder/clean_site': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/website-builder/id', '', 'clean_site'] | |
] | |
}, | |
'/secure/cpanel/website-builder/convert_to': { | |
'args': [1], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/website-builder/id', '', 'convert_to'] | |
] | |
}, | |
'/secure/cpanel/website-builder/free': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/website-builder/domain', '', 'free'] | |
] | |
}, | |
'/secure/cpanel/website-builder/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['website-builder-products'] | |
] | |
}, | |
'/secure/cpanel/website-builder/login': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/website-builder/id', '', 'login'] | |
] | |
}, | |
'/secure/cpanel/website-builder/manage': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/website-builder/id', '', 'manage'] | |
] | |
}, | |
'/secure/cpanel/website-builder/reinstate': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/website-builder/id', '', 'reinstate'] | |
] | |
}, | |
'/secure/cpanel/website-builder/renew': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/website-builder/renew'] | |
] | |
}, | |
'/secure/cpanel/website-builder/set_billing': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/website-builder/id', '', 'set_billing'] | |
] | |
}, | |
'/secure/cpanel/website-builder/set_renew': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/website-builder/id', '', 'set_renew'] | |
] | |
}, | |
'/secure/cpanel/website-builder/staff/change_expiry': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/website-builder/staff/change_expiry'] | |
] | |
}, | |
'/secure/cpanel/website-builder/staff/delete_package': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/website-builder/staff/delete_package'] | |
] | |
}, | |
'/secure/cpanel/website-builder/staff/index': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/website-builder/staff'] | |
] | |
}, | |
'/secure/cpanel/website-builder/staff/search': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/website-builder/staff/search'] | |
] | |
}, | |
'/secure/cpanel/website-builder/staff/suspend_package': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/website-builder/staff/suspend_package'] | |
] | |
}, | |
'/secure/cpanel/website-builder/staff/undelete_package': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['secure/cpanel/website-builder/staff/undelete_package'] | |
] | |
}, | |
'/secure/cpanel/website-builder/suspend': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/website-builder/id', '', 'suspend'] | |
] | |
}, | |
'/secure/cpanel/website-builder/upgrade': { | |
'args': [0], | |
'captures': [1], | |
'path': [ | |
['secure/cpanel/website-builder/id', '', 'upgrade'] | |
] | |
}, | |
'/secure/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['newuser.cgi'] | |
] | |
}, | |
'/secure/logout': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['mobile/logout'] | |
] | |
}, | |
'/secure/logout_cgi': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/logout.cgi'] | |
] | |
}, | |
'/secure/r_pl': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['secure/r.pl'] | |
] | |
}, | |
'/sitescanner/default': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['sitescanner'] | |
] | |
}, | |
'/sitescanner/orderprocess/add_to_basket': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['sitescanner/orderprocess/add_to_basket'] | |
] | |
}, | |
'/sitescanner/orderprocess/default': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['sitescanner/orderprocess'] | |
] | |
}, | |
'/sitescanner/orderprocess/get_package_details': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['sitescanner/orderprocess/get_package_details'] | |
] | |
}, | |
'/staff/customer/free_uk_service': { | |
'args': [1], | |
'captures': [0], | |
'path': [ | |
['staff/customer/free_uk_service'] | |
] | |
}, | |
'/staff/dns/bulk': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['staff/dns/bulk'] | |
] | |
}, | |
'/staff/dns/domain': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['staff/dns/domain'] | |
] | |
}, | |
'/staff/dns/index': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['staff/dns/index'] | |
] | |
}, | |
'/systemstatus/status': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['status.pl'] | |
] | |
}, | |
'/validate/credit_card': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['validate/creditcard'] | |
] | |
}, | |
'/webhosting-products/add_and_go_to_basket': { | |
'args': [null], | |
'captures': [0], | |
'path': [ | |
['webhosting-products/add_and_go_to_basket'] | |
] | |
}, | |
'/webhosting-products/configure_hosting': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['webhosting-products/configure_hosting'] | |
] | |
}, | |
'/webhosting-products/index': { | |
'args': [0], | |
'captures': [0], | |
'path': [ | |
['webhosting-products'] | |
] | |
} | |
}; | |
(function (CTX) { | |
'use strict'; | |
CTX.dataStructure.widgets.RepeatableField = function RepeatableField(data) { | |
this.data = data; | |
if (typeof this.data === 'object' && !('fullName' in this.data)) { | |
this.data.fullName = this.data.name; | |
} | |
this.data.value = this.data.value || []; | |
this.fields = []; | |
this.processed = false; | |
this.widgetLabel = 'None'; | |
}; | |
CTX.dataStructure.widgets.RepeatableField.prototype = { | |
isValid: function isValid() { | |
if ('object' !== CTX.helpers.typeOf(this.data)) { | |
CTX.debug('Data passed to repeatableField was not an object', this.data); | |
return false; | |
} | |
if (!('type' in this.data) || !('fields' in this.data)) { | |
CTX.debug('Data passed to repeatableField should have keys type and fields', this.data); | |
return false; | |
} | |
if ('array' !== CTX.helpers.typeOf(this.data.fields)) { | |
CTX.debug('Data value fields passed to repeatableField should be an Array', this.data); | |
return false; | |
} | |
if (this.data.fields.length === 1 && typeof this.data.fields[0] !== 'object' && 'fields' in this.data.fields[0]) { | |
CTX.debug('Currently we only handle one repeatable instance in fields', this.data); | |
return false; | |
} | |
if (!('isRepeatable' in this.data) || this.data.isRepeatable !== true) { | |
CTX.debug('Data passed to repeatableField should have isRepeatable', this.data); | |
return false; | |
} | |
return true; | |
}, | |
processRepeatInstance: function (field, repeatValue, index) { | |
var compoundInstance; | |
var item = CTX.helpers.clone(field); | |
item.fullName = this.data.fullName + '.' + index; | |
item.name = index; | |
item.value = repeatValue; | |
item.errors = []; | |
if ('errors' in this.data && this.data.errors !== null && index in this.data.errors) { | |
item.errors = this.data.errors[index]; | |
} | |
compoundInstance = new CTX.dataStructure.widgets.CompoundField(item); | |
if (compoundInstance.isValid() === false) { | |
return false; | |
} | |
compoundInstance.process(); | |
this.fields.push(compoundInstance); | |
return true; | |
}, | |
process: function () { | |
var that = this; | |
this.fields = []; | |
var returnVal = true; | |
var extraFields = 0; | |
var currentIndex = 0; | |
var extraFieldsType = that.data.fields[0]; | |
var instanceReturn = true; | |
this.data.value.forEach(function (repeatValue) { | |
var instanceReturn = that.processRepeatInstance(that.data.fields[0], repeatValue, currentIndex); | |
if (instanceReturn === false) { | |
returnVal = false; | |
} else { | |
currentIndex += 1; | |
} | |
}); | |
if (this.data.value.length > 0) { | |
extraFields = this.data.numExtra; | |
} else { | |
extraFields = this.data.numWhenEmpty; | |
} | |
if ('numField' in this.data) { | |
extraFieldsType = this.data.numField; | |
} | |
for (var i = 0; i < extraFields; i += 1) { | |
instanceReturn = that.processRepeatInstance(extraFieldsType, {}, currentIndex); | |
if (instanceReturn !== false) { | |
currentIndex += 1; | |
} | |
} | |
this.processed = true; | |
return returnVal; | |
}, | |
output: function () { | |
if (this.processed === false) { | |
this.process(); | |
} | |
var output = []; | |
if (this.data.type === '+OTTCatalyst::Form::Field::GroupOfCloneHooks') { | |
this.widgetLabel = 'Simple'; | |
} | |
if (this.widgetLabel !== 'None' && 'label' in this.data) { | |
output.push(CTX.widgets.label({ | |
text: this.data.label, | |
className: 'ctx_label_control-label' | |
})); | |
} | |
this.fields.forEach(function (item) { | |
output.push(item.output()); | |
}); | |
output = this.wrapOutput(output); | |
return output; | |
}, | |
wrapOutput: function (widgetOutput) { | |
var wrapperType = 'div'; | |
var wrapperClass = ['ctx_block_repeatable']; | |
if (this.data.widgetWrapper === 'OTTTable') { | |
widgetOutput = this.wrapOutputTableHeader(widgetOutput); | |
wrapperType = 'table'; | |
} | |
if ('wrapperAttributes' in this.data && 'class' in this.data.wrapperAttributes) { | |
wrapperClass = wrapperClass.concat(this.data.wrapperAttributes['class']); | |
} | |
return CTX.widgets.block({ | |
subType: wrapperType, | |
className: wrapperClass, | |
content: widgetOutput | |
}); | |
}, | |
wrapOutputTableHeader: function (widgetOutput) { | |
var cells = []; | |
if ('fields' in this.data && this.data.fields.length > 0 && 'fields' in this.data.fields[0]) { | |
this.data.fields[0].fields.forEach(function (field) { | |
if ('type' in field && field.type !== 'Hidden' && 'label' in field) { | |
cells.push(CTX.widgets.block({ | |
content: field.label, | |
subType: 'th' | |
})); | |
} | |
}); | |
} | |
widgetOutput = [CTX.widgets.block({ | |
subType: 'tr', | |
content: cells | |
}), widgetOutput]; | |
return widgetOutput; | |
} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.dataStructure.widgets.CompoundField = function CompoundField(data) { | |
this.data = data; | |
this.data.value = this.data.value || {}; | |
if (typeof this.data === 'object' && !('fullName' in this.data)) { | |
this.data.fullName = this.data.name; | |
} | |
this.processed = false; | |
}; | |
CTX.dataStructure.widgets.CompoundField.prototype = { | |
isValid: function isValid() { | |
var returnVal = true; | |
if ('object' !== CTX.helpers.typeOf(this.data)) { | |
return false; | |
} | |
if (!('fields' in this.data)) { | |
return false; | |
} | |
if ('array' !== CTX.helpers.typeOf(this.data.fields)) { | |
return false; | |
} | |
this.data.fields.forEach(function (subField) { | |
subField.value = ''; | |
var fieldInstance = CTX.helpers.getFieldDataStructureInstance(subField); | |
if (!(fieldInstance.isValid())) { | |
returnVal = false; | |
} | |
}); | |
return returnVal; | |
}, | |
process: function () { | |
var that = this; | |
this.fields = []; | |
var returnVal = true; | |
this.data.fields.forEach(function (item) { | |
var fieldInstance = null; | |
item.value = null; | |
if ('widgetWrapper' in that.data && that.data.widgetWrapper === 'OTTTableRow') { | |
item.widgetWrapper = 'OTTTableCell'; | |
item.widgetLabel = 'None'; | |
} | |
if (item.name in that.data.value) { | |
item.value = that.data.value[item.name]; | |
} | |
if ('errors' in that.data && that.data.errors !== null && item.name in that.data.errors) { | |
item.errors = that.data.errors[item.name]; | |
} | |
item.fullName = that.data.fullName + '.' + item.name; | |
fieldInstance = CTX.helpers.getFieldDataStructureInstance(item); | |
if (fieldInstance.isValid() === false) { | |
returnVal = false; | |
return; | |
} | |
fieldInstance.process(); | |
that.fields.push(fieldInstance); | |
}); | |
this.processed = true; | |
return returnVal; | |
}, | |
output: function output() { | |
var widgetOutput = []; | |
if (this.processed === false) { | |
this.process(); | |
} | |
this.fields.forEach(function (item) { | |
widgetOutput.push(item.output()); | |
}); | |
widgetOutput = this.wrapOutput(widgetOutput); | |
return widgetOutput; | |
}, | |
wrapOutput: function (widgetOutput) { | |
var matches; | |
var widgetClassName = null; | |
var wrapperWidget = null; | |
var wrapperObject = {}; | |
var wrapperAttributes = {}; | |
var wrapperClasses = ['ctx_block_compound-group', 'clearfix']; | |
var blocks = { | |
OTTTableRow: { | |
subType: 'tr', | |
wrapperClasses: ['ctx_block_compound-group'] | |
}, | |
Simple: { | |
subType: 'div', | |
wrapperClasses: ['ctx_block_compound-group', 'clearfix'] | |
} | |
}; | |
if (!('widgetWrapper' in this.data)) { | |
return widgetOutput; | |
} | |
matches = this.data.widgetWrapper.match(/^\+OTT::Form::Widget::Wrapper::Fieldset::([A-Z][A-Za-z0-9]+)(::([A-Za-z0-9\:]+))?/); | |
if (matches === null || matches.length < 1) { | |
if (this.data.widgetWrapper in blocks) { | |
return CTX.widgets.block({ | |
subType: blocks[this.data.widgetWrapper].subType, | |
content: widgetOutput, | |
className: blocks[this.data.widgetWrapper].wrapperClasses | |
}); | |
} | |
return widgetOutput; | |
} | |
if ('wrapperAttributes' in this.data) { | |
if ('class' in this.data.wrapperAttributes) { | |
wrapperClasses = this.data.wrapperAttributes['class']; | |
delete this.data.wrapperAttributes['class']; | |
} | |
wrapperAttributes = this.data.wrapperAttributes; | |
} | |
widgetClassName = matches[1].toLowerCase(); | |
if (widgetClassName !== null && widgetClassName in CTX.widgets) { | |
wrapperWidget = CTX.widgets[widgetClassName](wrapperObject); | |
if (wrapperWidget.isFormWrapper()) { | |
wrapperWidget.setLegend(this.data.label); | |
wrapperWidget.setContent(widgetOutput); | |
wrapperWidget.addClass(wrapperClasses); | |
wrapperWidget.setDOMAttrs(wrapperAttributes); | |
return wrapperWidget; | |
} | |
} | |
} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.dataStructure.widgets.Action = function Action(data) { | |
this.data = data; | |
}; | |
CTX.dataStructure.widgets.Action.prototype = { | |
isValid: function isValid() { | |
var validKeys = ['URI', 'callback', 'data', 'transportMethod']; | |
if ('object' === CTX.helpers.typeOf(this.data)) { | |
if (Object.keys(this.data).length === 0) { | |
return false; | |
} | |
for (var key in this.data) { | |
if (this.data.hasOwnProperty(key)) { | |
if (validKeys.indexOf(key) === -1) { | |
return false; | |
} | |
} | |
} | |
if ('URI' in this.data) { | |
var URIObj = new CTX.dataStructure.widgets.URI(this.data.URI); | |
if (!(URIObj.isValid())) { | |
return false; | |
} | |
} | |
return true; | |
} | |
return false; | |
} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.dataStructure.widgets.TableRow = function TableRow(data) { | |
this.data = data; | |
}; | |
CTX.dataStructure.widgets.TableRow.prototype = { | |
isValid: function isValid() { | |
var returnVal; | |
var tableCellData; | |
if ('object' === CTX.helpers.typeOf(this.data)) { | |
if ('cells' in this.data) { | |
if ('array' === CTX.helpers.typeOf(this.data.cells)) { | |
returnVal = true; | |
this.data.cells.forEach(function (cell) { | |
tableCellData = new CTX.dataStructure.widgets.TableCell(cell); | |
if (!tableCellData.isValid()) { | |
CTX.debug('False cell passed to TableRow', cell); | |
returnVal = false; | |
return false; | |
} | |
}); | |
return returnVal; | |
} | |
} | |
return false; | |
} | |
return false; | |
} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.dataStructure.widgets.Data = function Data(data) { | |
this.data = data; | |
}; | |
CTX.dataStructure.widgets.Data.prototype = { | |
isValid: function isValid() { | |
if (typeof this.data === 'string') { | |
return false; | |
} else if ('object' === CTX.helpers.typeOf(this.data)) { | |
return true; | |
} | |
return false; | |
} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.dataStructure.widgets.TableCell = function TableCell(data) { | |
this.data = data; | |
}; | |
CTX.dataStructure.widgets.TableCell.prototype = { | |
isValid: function isValid() { | |
var contentData; | |
if ('object' === CTX.helpers.typeOf(this.data)) { | |
if ('content' in this.data) { | |
contentData = new CTX.dataStructure.widgets.Content(this.data.content); | |
return contentData.isValid(); | |
} | |
return false; | |
} | |
return false; | |
} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.dataStructure.widgets.FormHandler = function FormHandler(data) { | |
this.data = data; | |
this.options = {}; | |
this.fields = []; | |
this.processed = false; | |
}; | |
CTX.dataStructure.widgets.FormHandler.prototype = { | |
isValid: function isValid() { | |
var returnVal = true; | |
if (typeof this.data !== 'object' || !('fields' in this.data)) { | |
return false; | |
} | |
if ('array' === CTX.helpers.typeOf(this.data.fields)) { | |
this.data.fields.forEach(function (field) { | |
var fieldInstance = null; | |
field.value = ''; | |
if ('object' !== CTX.helpers.typeOf(field)) { | |
returnVal = false; | |
} | |
if (!('type' in field)) { | |
returnVal = false; | |
} | |
fieldInstance = CTX.helpers.getFieldDataStructureInstance(field); | |
if (!(fieldInstance.isValid())) { | |
returnVal = false; | |
} | |
}); | |
return returnVal; | |
} | |
return false; | |
}, | |
process: function process(options) { | |
var that = this; | |
this.fields = []; | |
var returnVal = true; | |
this.options = options || {}; | |
if (!this.data) { | |
return false; | |
} | |
this.data.fields.forEach(function (item) { | |
var fieldInstance = null; | |
item.value = null; | |
item.errors = null; | |
if (item.name in that.data.value) { | |
item.value = that.data.value[item.name]; | |
} else if ('parameters' in CTX.request && item.name in CTX.request.parameters) { | |
item.value = CTX.request.parameters[item.name]; | |
} | |
if (('errors' in that.data) && ('fields' in that.data.errors) && (item.name in that.data.errors.fields)) { | |
item.errors = that.data.errors.fields[item.name]; | |
} | |
fieldInstance = CTX.helpers.getFieldDataStructureInstance(item); | |
if (fieldInstance.isValid() === false) { | |
returnVal = false; | |
return; | |
} | |
fieldInstance.process(); | |
that.fields.push(fieldInstance); | |
}); | |
this.processed = true; | |
return returnVal; | |
}, | |
output: function output() { | |
var formWidgetOptions = this.options; | |
formWidgetOptions.content = []; | |
formWidgetOptions.className = 'ctx_form_generated'; | |
if (this.processed === false) { | |
this.process(); | |
} | |
if (('errors' in this.data) && ('form' in this.data.errors) && this.data.errors.form.length > 0) { | |
formWidgetOptions.content.push(CTX.widgets.notification({ | |
message: this.data.errors.form.join(), | |
level: 'error' | |
})); | |
} | |
if ('success' in this.data) { | |
formWidgetOptions.content.push(CTX.widgets.notification({ | |
message: this.data.success, | |
level: 'success' | |
})); | |
} | |
this.fields.forEach(function (item) { | |
formWidgetOptions.content.push(item.output()); | |
}); | |
return CTX.widgets.form(formWidgetOptions); | |
}, | |
render: function () { | |
return this.output(); | |
} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.dataStructure.widgets.URI = function URI(data) { | |
this.data = data; | |
}; | |
CTX.dataStructure.widgets.URI.prototype = { | |
validityTests: { | |
scheme: function (toTest) { | |
if ('string' !== typeof (toTest)) { | |
return false; | |
} | |
return toTest.match(/^[a-z0-9]+$/i); | |
}, | |
host: function (toTest) { | |
if ('string' !== typeof (toTest)) { | |
return false; | |
} | |
return toTest.match(/^[a-z0-9_\-.]+$/i); | |
}, | |
port: function (toTest) { | |
if (toTest === null || toTest === '') { | |
return true; | |
} | |
if (!('string' === typeof (toTest) || 'number' === typeof (toTest))) { | |
return false; | |
} | |
if (0 < toTest && 65536 > toTest) { | |
return true; | |
} | |
return false; | |
}, | |
path: function (toTest) { | |
if ('string' !== typeof (toTest)) { | |
return false; | |
} | |
return toTest.match(/^(\/[^\/\?]*)+$/); | |
}, | |
captures: function () { | |
return true; | |
}, | |
args: function () { | |
return true; | |
}, | |
params: function () { | |
return true; | |
}, | |
fragment: function () { | |
return true; | |
} | |
}, | |
isValid: function isValid() { | |
var validKeys = ['scheme', 'host', 'port', 'path', 'captures', 'args', 'params', 'fragment']; | |
if (typeof this.data === 'string') { | |
return true; | |
} else if ('object' === CTX.helpers.typeOf(this.data)) { | |
if (Object.keys(this.data).length === 0) { | |
CTX.debug('URI isValid check failded only objects are allowed'); | |
return false; | |
} | |
if (-1 === Object.keys(this.data).indexOf('path') || 'string' !== typeof (this.data.path)) { | |
CTX.debug('URI isValid check failed path invalid'); | |
return false; | |
} | |
for (var key in this.data) { | |
if (this.data.hasOwnProperty(key)) { | |
if (validKeys.indexOf(key) === -1) { | |
CTX.debug('URI isValid check failed invalid key passed into data: ', key); | |
return false; | |
} | |
if (!this.validityTests[key](this.data[key])) { | |
CTX.debug('URI isValid check failed validity check failed'); | |
return false; | |
} | |
} | |
} | |
return true; | |
} | |
return false; | |
}, | |
toString: function toString() { | |
var thisToString = this.data.scheme + '://'; | |
thisToString += this.data.host; | |
if (this.data.port) { | |
thisToString += ':' + this.data.port; | |
} | |
thisToString += this.data.path; | |
if (this.data.args.length) { | |
if (!(/\/$/.test(this.data.path))) { | |
thisToString += '/'; | |
} | |
thisToString += this.data.args.join('/'); | |
} | |
if (Object.keys(this.data.params).length) { | |
thisToString += '?' + jQuery.param(this.data.params); | |
} | |
if ('fragment' in this.data && this.data.fragment !== null) { | |
thisToString += '#' + this.data.fragment; | |
} | |
return thisToString; | |
} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.dataStructure.widgets.Content = function Content(data) { | |
this.data = data; | |
}; | |
CTX.dataStructure.widgets.Content.prototype = { | |
isValid: function isValid() { | |
var returnVal; | |
var htmlStringError = 'Content contained HTML string: '; | |
if (typeof this.data === 'string') { | |
if (CTX.helpers.stripHTML(this.data) === this.data) { | |
return true; | |
} | |
CTX.debug(htmlStringError + this.data); | |
return false; | |
} else if ('array' === CTX.helpers.typeOf(this.data)) { | |
returnVal = true; | |
this.data.forEach(function (value) { | |
if (typeof value === 'string') { | |
if (CTX.helpers.stripHTML(value) !== value) { | |
returnVal = false; | |
CTX.debug(htmlStringError + value); | |
return false; | |
} | |
} | |
}); | |
return returnVal; | |
} | |
return false; | |
}, | |
outputStructure: function outputStructure(structure) { | |
var newData = []; | |
if ('array' === CTX.helpers.typeOf(structure)) { | |
structure.forEach(function (item) { | |
if ('array' === CTX.helpers.typeOf(item)) { | |
newData = newData.concat(outputStructure(item)); | |
} else if (typeof structure !== 'number' && typeof item !== 'string' && typeof (item) !== 'undefined') { | |
if ('object' === CTX.helpers.typeOf(item) && 'getDOMElement' in item) { | |
newData.push(item.getDOMElement()); | |
} else { | |
CTX.warning('Irregular data found in Content data structure', item, structure); | |
} | |
} else { | |
newData.push(item); | |
} | |
}); | |
} else { | |
if (typeof structure !== 'string' && typeof structure !== 'number') { | |
if (typeof (structure) !== 'undefined') { | |
if (!('getDOMElement' in structure)) { | |
CTX.error('Content section does not look like a widget', structure); | |
} | |
newData = structure.getDOMElement(); | |
} | |
} else { | |
newData = structure; | |
} | |
} | |
return newData; | |
}, | |
output: function output() { | |
return this.outputStructure(this.data); | |
}, | |
toString: function toString() { | |
var fragment = document.createElement('div'); | |
var outputArray = this.output(); | |
var arrayIterate = function (outputArray) { | |
outputArray.forEach(function (item) { | |
if ('array' === CTX.helpers.typeOf(item)) { | |
arrayIterate(item); | |
} else { | |
fragment.appendChild(item); | |
} | |
}); | |
}; | |
arrayIterate(outputArray); | |
return fragment.innerHTML; | |
} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.dataStructure.widgets.TableContainer = function TableContainer(data) { | |
this.data = data; | |
}; | |
CTX.dataStructure.widgets.TableContainer.prototype = { | |
isValid: function isValid() { | |
var returnVal; | |
var tableRowData; | |
if ('object' === CTX.helpers.typeOf(this.data)) { | |
if ('rows' in this.data) { | |
if ('array' === CTX.helpers.typeOf(this.data.rows)) { | |
if (!('subType' in this.data)) { | |
CTX.debug('TableContainer requires subType to be passed', this.data); | |
return false; | |
} | |
if (['head', 'foot', 'body'].indexOf(this.data.subType) === -1) { | |
CTX.debug('TableContainer requires subType to be passed with a valid value', this.data); | |
return false; | |
} | |
returnVal = true; | |
this.data.rows.forEach(function (row) { | |
tableRowData = new CTX.dataStructure.widgets.TableRow(row); | |
if (!tableRowData.isValid()) { | |
CTX.debug('False row passed to table container', row); | |
returnVal = false; | |
return false; | |
} | |
}); | |
return returnVal; | |
} | |
} | |
CTX.debug('TableContainer requires rows to be passed', this.data); | |
return false; | |
} | |
CTX.debug('TableContainer requires a data object to be passed', this.data); | |
return false; | |
} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.dataStructure.widgets.SingleField = function SingleField(data) { | |
this.data = data; | |
if (typeof this.data === 'object' && !('fullName' in this.data)) { | |
this.data.fullName = this.data.name; | |
} | |
this.data.id = this.data.id || CTX.helpers.UUID(); | |
this.data.value = this.data.value || ''; | |
this.data.widgetLabel = this.data.widgetLabel || 'Simple'; | |
this.data.widgetWrapper = this.data.widgetWrapper || 'Simple'; | |
}; | |
CTX.dataStructure.widgets.SingleField.prototype = { | |
isValid: function isValid() { | |
if ('object' === CTX.helpers.typeOf(this.data)) { | |
if ('type' in this.data && 'name' in this.data) { | |
return true; | |
} else { | |
CTX.debug('SingleField requires type and name passed', this.data); | |
} | |
} | |
CTX.debug('SingleField requires an object'); | |
return false; | |
}, | |
process: function () {}, | |
output: function output() { | |
var widgetOutput = []; | |
if (this.data.widget === 'NoRender') { | |
return widgetOutput; | |
} | |
if ('widgetWrapper' in this.data) { | |
this.widgetWrapper = this.data.widgetWrapper; | |
} | |
if ('widgetLabel' in this.data) { | |
this.widgetLabel = this.data.widgetLabel; | |
} | |
if (this.data.type === 'Hidden' || this.data.type === '+OTTCatalyst::Form::Field::CloneHook') { | |
this.widgetLabel = 'None'; | |
this.widgetWrapper = 'None'; | |
} else if (this.data.type === 'Submit') { | |
this.widgetLabel = 'Spacer'; | |
this.widgetWrapper = 'Simple'; | |
} | |
widgetOutput = widgetOutput.concat(this.returnLabel()); | |
widgetOutput = widgetOutput.concat(this.returnInput()); | |
widgetOutput = widgetOutput.concat(this.returnError()); | |
widgetOutput = this.wrapOutput(widgetOutput); | |
return widgetOutput; | |
}, | |
wrapOutput: function (widgetOutput) { | |
var wrapperType = 'div'; | |
var wrapperClass = ['ctx_block_control-group']; | |
if (this.widgetWrapper === 'None') { | |
return widgetOutput; | |
} | |
if (this.data.widgetWrapper === 'OTTTableCell') { | |
wrapperType = 'td'; | |
} | |
if ('wrapperAttributes' in this.data && 'class' in this.data.wrapperAttributes) { | |
if ('array' === CTX.helpers.typeOf(this.data.wrapperAttributes['class'])) { | |
this.data.wrapperAttributes['class'].forEach(function (className) { | |
wrapperClass.push(className); | |
}); | |
} else { | |
wrapperClass.push(this.data.wrapperAttributes['class']); | |
} | |
} | |
return CTX.widgets.block({ | |
subType: wrapperType, | |
content: widgetOutput, | |
className: wrapperClass | |
}); | |
}, | |
getValue: function getValue() { | |
var value = ''; | |
if ('checkboxValue' in this.data) { | |
value = this.data.checkboxValue; | |
} | |
if (this.data.value) { | |
value = this.data.value; | |
} | |
if (this.data.fullName in CTX.request.parameters) { | |
value = CTX.request.parameters[this.data.fullName]; | |
} | |
return value; | |
}, | |
determineRenderingWidget: function determineRenderingWidget() { | |
var fieldWidget = 'input'; | |
var widgetName = this.data.type; | |
var safeWidgetName; | |
var safeTypeName; | |
var inputSubTypes = CTX.classType.widgets.Input.prototype.InputTypes(); | |
if ('widget' in this.data) { | |
safeWidgetName = this.data.widget; | |
if (/^.+::[^:]+$/.test(safeWidgetName)) { | |
safeWidgetName = safeWidgetName.replace(/^.+::/, ''); | |
} | |
safeWidgetName = CTX.widgets.helpers.asConstructorName(safeWidgetName); | |
safeTypeName = this.data.widget; | |
if (/^.+::[^:]+$/.test(safeTypeName)) { | |
safeTypeName = safeTypeName.replace(/^.+::/, ''); | |
} | |
safeTypeName = CTX.widgets.helpers.asConstructorName(safeTypeName); | |
if (-1 !== inputSubTypes.indexOf(safeTypeName)) { | |
widgetName = safeTypeName; | |
CTX.debug('replaced type "', this.data.type, '" with type "', safeTypeName, '". Ignoring "', this.data.widget, '"'); | |
} else if (safeWidgetName in CTX.widgets) { | |
fieldWidget = safeWidgetName; | |
CTX.debug('replaced type "', this.data.type, '" with widget "', safeWidgetName, '" from "', this.data.widget, '"'); | |
} else { | |
CTX.debug('ignoring widget "', safeWidgetName, '" instead, using type "', CTX.widgets.helpers.asConstructorName(widgetName), '" from "', this.data.type, '"'); | |
} | |
} | |
return { | |
'widgetName': widgetName, | |
'fieldWidget': fieldWidget | |
}; | |
}, | |
returnInputClasses: function returnInputClasses(baseClasses) { | |
var classes = []; | |
if ('array' === CTX.helpers.typeOf(baseClasses)) { | |
classes = baseClasses; | |
} | |
if (this.data.className) { | |
classes = classes.concat(this.data.className); | |
} | |
if ('elementAttributes' in this.data) { | |
if ('class' in this.data.elementAttributes) { | |
classes = classes.concat(this.data.elementAttributes['class']); | |
} | |
} | |
return classes; | |
}, | |
returnDataAttributes: function returnDataAttributes() { | |
var dataAttributes = {}; | |
var that = this; | |
if ('elementAttributes' in this.data) { | |
Object.keys(this.data.elementAttributes).forEach(function (key) { | |
if (/^data-/.test(key)) { | |
var value = that.data.elementAttributes[key]; | |
key = key.replace(/^data-/, ''); | |
dataAttributes[key] = value; | |
} | |
}); | |
} | |
return dataAttributes; | |
}, | |
returnInput: function returnInput() { | |
var output = []; | |
var values = []; | |
var renderingWidget = this.determineRenderingWidget(); | |
var widgetName = renderingWidget.widgetName; | |
var fieldWidget = renderingWidget.fieldWidget; | |
var widgetObject = { | |
id: this.data.id, | |
subType: CTX.widgets.helpers.asConstructorName(widgetName), | |
name: this.data.fullName | |
}; | |
if ('subType' in this.data && 'string' === CTX.helpers.typeOf(this.data.subType) && 'Text' === this.data.widget) { | |
widgetObject.subType = this.data.subType; | |
} | |
widgetObject.className = this.returnInputClasses(); | |
widgetObject.data = this.returnDataAttributes(); | |
if ('disabled' in this.data && true === this.data.disabled) { | |
widgetObject.disabled = true; | |
} | |
if (/^\+OTTCatalyst(.*)Button$/.test(this.data.type)) { | |
this.data.type = 'Button'; | |
} | |
if (this.data.type === 'Submit' || this.data.type === 'Button') { | |
return this.returnButton(widgetObject); | |
} | |
widgetObject.value = this.getValue(); | |
if (this.data.type !== 'hidden') { | |
if (this.data.type === 'Select' || this.data.widget === 'Dropdown') { | |
if (this.data.widget !== 'RadioGroup') { | |
fieldWidget = 'selectBox'; | |
if ('emptySelect' in this.data) { | |
values.push(['', this.data.emptySelect]); | |
} | |
this.data.options.forEach(function (item) { | |
values.push([item.value, item.label]); | |
}); | |
widgetObject.values = values; | |
} else { | |
return this.returnRadioGroup(); | |
} | |
} | |
} | |
if (this.data.type === '+OTTCatalyst::Form::Field::CloneHook') { | |
return this.returnCloneHook(); | |
} | |
output.push(CTX.widgets[fieldWidget](widgetObject)); | |
return output; | |
}, | |
returnButton: function (widgetObject) { | |
widgetObject = widgetObject || {}; | |
var output = []; | |
var fieldWidget = 'button'; | |
widgetObject.subType = 'submit'; | |
if ('value' in this.data) { | |
widgetObject.text = this.data.value; | |
} | |
if ('text' in this.data) { | |
widgetObject.text = this.data.text; | |
} | |
if ('btnClass' in this.data) { | |
widgetObject.btnClass = this.data.btnClass; | |
} | |
if (this.data.widget === '+OTT::Form::Widget::Field::SerialisableSubmitButton') { | |
fieldWidget = 'serialisableSubmitButton'; | |
} | |
output.push(CTX.widgets[fieldWidget](widgetObject)); | |
return output; | |
}, | |
returnCloneHook: function () { | |
var output = []; | |
output.push(CTX.widgets.button({ | |
text: CTX.helpers.ucfirst(this.data.value), | |
data: { | |
value: this.data.value, | |
name: this.data.fullName | |
}, | |
action: { | |
callback: function (e) { | |
var $target = $(e.target); | |
var $form = $target.closest('.ctx_form'); | |
var $fieldset = $target.closest('.ctx_accordion'); | |
var values = {}; | |
var $fieldsetWidgets = $fieldset.find('.ctx_widget'); | |
var replacePart = $target.data('name').split('.')[0]; | |
var replaceWith = $target.data('value'); | |
$fieldsetWidgets.each(function (i, widget) { | |
var instance = CTX.getWidgetInstance(widget); | |
var name; | |
var value; | |
if (instance.isFormElement()) { | |
value = instance.getValue(); | |
name = instance.getName(); | |
if (name !== null && value !== null) { | |
name = name.replace(new RegExp('^' + replacePart + '.'), replaceWith + '.'); | |
values[name] = value; | |
} | |
} | |
}); | |
$form.find('.ctx_widget').each(function (i, widget) { | |
var instance = CTX.getWidgetInstance(widget); | |
var name; | |
if (instance.isFormElement()) { | |
name = instance.getName(); | |
if (name in values) { | |
instance.setValue(values[name]); | |
} | |
} | |
}); | |
$form.submit(); | |
} | |
} | |
})); | |
return output; | |
}, | |
returnRadioGroup: function returnRadioGroup() { | |
var output = []; | |
var that = this; | |
var classes = this.returnInputClasses(['ctx_label_control-radio-group']); | |
var dataAttributes; | |
if ('options' in this.data) { | |
dataAttributes = this.returnDataAttributes(); | |
this.data.options.forEach(function (radioInput, id) { | |
var uniqueId = that.data.fullName + '.' + id; | |
var checked = false; | |
if (that.getValue() === radioInput.value) { | |
checked = true; | |
} | |
output.push(CTX.widgets.label({ | |
forId: uniqueId, | |
text: [CTX.widgets.input({ | |
subType: 'radio', | |
value: radioInput.value, | |
name: that.data.fullName, | |
id: uniqueId, | |
checked: checked, | |
data: dataAttributes | |
}), radioInput.label], | |
className: classes | |
})); | |
}); | |
} | |
return output; | |
}, | |
returnLabel: function returnLabel() { | |
var output = []; | |
if (this.widgetLabel === 'None') { | |
return output; | |
} | |
if (!('label' in this.data)) { | |
this.data.label = CTX.helpers.ucfirst(this.data.name).replace(/\_/g, ' '); | |
} | |
if (this.widgetLabel === 'Spacer') { | |
output.push(CTX.widgets.block({ | |
content: '', | |
className: 'ctx_block_control-spacer' | |
})); | |
} else { | |
output.push(CTX.widgets.label({ | |
forId: this.data.id, | |
text: this.data.label, | |
className: 'ctx_label_control-label' | |
})); | |
} | |
return output; | |
}, | |
returnError: function returnError() { | |
var output = []; | |
if ('errors' in this.data && this.data.errors !== null) { | |
output.push(CTX.widgets.text({ | |
text: this.data.errors.join('. '), | |
className: ['ctx_text_help-inline', 'ctx_text_help-inline-error'] | |
})); | |
} | |
return output; | |
} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.dataStructure.widgets.TabList = function TabList(data) { | |
this.data = data; | |
}; | |
CTX.dataStructure.widgets.TabList.prototype = { | |
isValid: function isValid() { | |
var requiredKeys = ['text', 'action']; | |
var returnVal = true; | |
if ('array' === CTX.helpers.typeOf(this.data)) { | |
this.data.forEach(function (object) { | |
requiredKeys.forEach(function (key) { | |
if (Object.keys(object).indexOf(key) === -1) { | |
returnVal = false; | |
} | |
}); | |
}); | |
if (returnVal === false) { | |
return false; | |
} | |
return true; | |
} | |
return false; | |
} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.widgets.helpers = {}; | |
CTX.widgets.helpers.registerClasses = function registerClasses() { | |
for (var widgetType in CTX.classType.widgets) { | |
if (CTX.classType.widgets.hasOwnProperty(widgetType)) { | |
var constructor = CTX.widgets.helpers.asConstructorName(widgetType); | |
CTX.widgets[constructor] = CTX.widgets.helpers.constructor(widgetType); | |
} | |
} | |
}; | |
CTX.widgets.helpers.constructor = function (widgetType) { | |
return function (attrs) { | |
var obj = new CTX.classType.widgets[widgetType](attrs); | |
return obj; | |
}; | |
}; | |
CTX.widgets.helpers.asConstructorName = function asConstructorName(string) { | |
return string.charAt(0).toLowerCase() + string.slice(1); | |
}; | |
CTX.widgets.helpers.asCssClass = function asCssClass(string) { | |
if (null === string) { | |
string = ''; | |
} | |
return string.replace(/(.)([A-Z][a-z]+)/g, '$1-$2').replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase(); | |
}; | |
}(CTX)); | |
(function () { | |
'use strict'; | |
CTX.abstract.action = function action(params) { | |
this.params = { | |
getStash: false, | |
response: { | |
200: function () { | |
CTX.loadTemplate(); | |
}, | |
302: function (data, xhr) { | |
if ('headers' in xhr && 'Location' in xhr.headers) { | |
var URIObject = CTX.helpers.URIToObject(xhr.headers.Location); | |
return CTX.helpers.redirectWindowToURI(URIObject); | |
} | |
return true; | |
}, | |
defaultAction: function () { | |
CTX.warning('Could not handle response code'); | |
CTX.loadAction({ | |
URI: { | |
path: '/error/index' | |
}, | |
detach: true | |
}); | |
} | |
} | |
}; | |
this.setParams(params); | |
}; | |
CTX.abstract.action.prototype = { | |
callAction: function callAction() { | |
var stashObject = {}; | |
if (this.params.getStash !== false) { | |
if (typeof this.params.getStash === 'object') { | |
stashObject = this.params.getStash; | |
} | |
stashObject.action = this; | |
CTX.getStash(stashObject); | |
} else { | |
this.callResponse(200); | |
} | |
}, | |
callResponse: function callResponse(responseName, responseData, xhr) { | |
CTX.event.fire('action.callResponse'); | |
if (responseName in this.params.response && this.params.response[responseName] !== null) { | |
this.params.response[responseName](responseData, xhr); | |
} else { | |
this.params.response.defaultAction(responseData, xhr); | |
} | |
return true; | |
}, | |
setParams: function setParams(params) { | |
if (params !== null) { | |
if ('getStash' in params) { | |
this.params.getStash = params.getStash; | |
} | |
if ('response' in params) { | |
for (var method in params.response) { | |
if (params.response.hasOwnProperty(method)) { | |
this.params.response[method] = params.response[method]; | |
} | |
} | |
} | |
} | |
} | |
}; | |
}(CTX)); | |
(function () { | |
'use strict'; | |
CTX.abstract.resultSetHandler = function resultSetHandler(params) { | |
this.updateURI = null; | |
this.dataWrapper = null; | |
this.tableNamespace = null; | |
this.setParams(params); | |
}; | |
CTX.abstract.resultSetHandler.prototype = { | |
clearCache: function clearCache() { | |
this.resultSets = {}; | |
this.currentPage = null; | |
this.requestingPage = null; | |
this.clearGetPageCallbacks(); | |
}, | |
setParams: function setParams(request) { | |
var params = {}; | |
var pageKey = this.tableNamespace + '.paging.length'; | |
var pagingLengthKey = this.tableNamespace + '.paging.length'; | |
var filterKey = this.tableNamespace + '.filter'; | |
if ('parameters' in request) { | |
params = request.parameters; | |
} | |
if (pagingLengthKey in params) { | |
this.setPageLength(params[pagingLengthKey]); | |
} | |
if (pageKey in params) { | |
this.currentPage = params[pageKey]; | |
} | |
if (filterKey in params) { | |
this.setFilter(params[filterKey]); | |
} | |
this.pageLength = this.pageLength || 10; | |
this.sortColumn = this.sortColumn || null; | |
this.sortOrder = this.sortOrder || 'asc'; | |
this.searchTerm = this.searchTerm || null; | |
this.pointer = this.pointer || null; | |
this.requestingPage = null; | |
this.getPageCallbacks = []; | |
this.totalRecords = null; | |
this.resultSets = {}; | |
this.totalDisplayRecords = null; | |
this.currentPage = null; | |
return true; | |
}, | |
setFirstPage: function setFirstPage(data) { | |
var unwrappedData; | |
if (typeof data !== 'undefined') { | |
this.currentPage = 1; | |
unwrappedData = CTX.unwrapMessage(this.dataWrapper, data); | |
this.successHandler(unwrappedData); | |
} | |
return true; | |
}, | |
setPageLength: function setPageLength(pageLength) { | |
if (pageLength !== this.pageLength) { | |
this.clearCache(); | |
this.pageLength = pageLength; | |
} | |
}, | |
setSort: function setPageLength(column, order) { | |
if (typeof order === 'undefined') { | |
if (column === this.sortColumn) { | |
if (this.sortOrder === 'asc') { | |
order = 'desc'; | |
} else { | |
order = 'asc'; | |
} | |
} else { | |
order = 'asc'; | |
} | |
} | |
if (this.sortColumn !== column || this.sortOrder !== order) { | |
this.clearCache(); | |
this.sortColumn = column; | |
this.sortOrder = order; | |
} | |
}, | |
setFilter: function setFilter(term) { | |
if (this.searchTerm !== term) { | |
this.clearCache(); | |
this.searchTerm = term; | |
} | |
}, | |
hasPage: function hasPage() { | |
if (this.currentPage === null || !(this.currentPage in this.resultSets)) { | |
return false; | |
} | |
return true; | |
}, | |
all: function all() { | |
if (this.hasPage()) { | |
return this.resultSets[this.currentPage]; | |
} | |
return null; | |
}, | |
nextPage: function nextPage(callback) { | |
if (this.currentPage === null) { | |
this.currentPage = 1; | |
} | |
this.currentPage += 1; | |
return this.getPage(callback); | |
}, | |
getPage: function getPage(callback) { | |
var that = this; | |
var data = {}; | |
if (this.hasPage()) { | |
callback(true); | |
return this.resultSets[this.currentPage]; | |
} else { | |
this.registerGetPageCallback(callback); | |
} | |
if (this.currentPage === null) { | |
this.currentPage = 1; | |
} else if (this.requestingPage === this.currentPage) { | |
return null; | |
} | |
data[this.tableNamespace] = { | |
paging: { | |
start: this.currentPage, | |
length: this.pageLength | |
}, | |
sorting: { | |
column: this.sortColumn, | |
order: this.sortOrder | |
}, | |
filter: this.searchTerm | |
}; | |
this.requestingPage = this.currentPage; | |
CTX.getMessage({ | |
dataWrapper: this.dataWrapper, | |
URI: this.updateURI, | |
data: data, | |
success: function (data) { | |
that.successHandler.call(that, data); | |
} | |
}); | |
return null; | |
}, | |
successHandler: function successHandler(data) { | |
if ('object' !== CTX.helpers.typeOf(data)) { | |
CTX.debug('Invalid table data in resultSetHandler response', data); | |
return; | |
} | |
if ('tableData' in data) { | |
this.resultSets[this.currentPage] = data.tableData; | |
this.totalDisplayRecords = data.totalDisplayRecords; | |
this.totalRecords = data.totalRecords; | |
this.fireGetPageCallbacks(); | |
} else { | |
CTX.debug('Missing table data in resultSetHandler response', data); | |
} | |
}, | |
registerGetPageCallback: function (callback) { | |
if ('function' === CTX.helpers.typeOf(callback)) { | |
this.getPageCallbacks.push(callback); | |
return true; | |
} | |
return false; | |
}, | |
clearGetPageCallbacks: function () { | |
this.getPageCallbacks = []; | |
}, | |
fireGetPageCallbacks: function () { | |
this.getPageCallbacks.forEach(function (callback) { | |
callback(true); | |
}); | |
this.clearGetPageCallbacks(); | |
}, | |
previousPage: function nextPage(callback) { | |
if (this.currentPage === null) { | |
this.currentPage = 1; | |
} | |
this.currentPage -= 1; | |
return this.getPage(callback); | |
} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.abstract.widgets.Base = function Base() {}; | |
CTX.abstract.widgets.Base.prototype = { | |
makeDOMElement: function makeDomElement() { | |
this.DOMElement = $('<span></span>')[0]; | |
return true; | |
}, | |
getUUID: function () { | |
if (this.UUID === null || this.UUID === undefined) { | |
this.UUID = CTX.helpers.UUID(); | |
} | |
return this.UUID; | |
}, | |
purgeContents: function () { | |
var $el = $(this.DOMElement); | |
CTX.removeObj(this.getUUID()); | |
$el.removeData(); | |
this.DOMElement = undefined; | |
}, | |
getDOMElement: function getDOMElement() { | |
if (this.DOMElement) { | |
this.purgeContents(); | |
} | |
this.init(); | |
if (typeof this.DOMAttrs !== 'undefined') { | |
this.addDOMAttrsFromStorage(this.DOMAttrs); | |
} | |
this.addClass('ctx_widget'); | |
this.addClass('ctx_' + CTX.widgets.helpers.asCssClass(this.widgetType())); | |
$(this.DOMElement).data('CTXWidget', this.getUUID()); | |
CTX.registerObj(this.getUUID(), this); | |
return this.DOMElement; | |
}, | |
setDefaults: function setDefaults() { | |
if (this.defaults) { | |
for (var defaultKey in this.defaults) { | |
if (this.defaults.hasOwnProperty(defaultKey)) { | |
if (!(defaultKey in this.objAttrs)) { | |
this.objAttrs[defaultKey] = this.defaults[defaultKey]; | |
} | |
} | |
} | |
} | |
return true; | |
}, | |
init: function init() { | |
this.setDefaults(); | |
if (!(this.isValid())) { | |
CTX.debug('Is valid check failed', this, this.objAttrs); | |
return ''; | |
} | |
this.makeDOMElement(); | |
this.addDataFromObjAttrs(); | |
this.addClassFromObjAttrs(); | |
this.addIDFromObjAttrs(); | |
this.addTitleFromObjAttrs(); | |
this.onLoad(); | |
return this; | |
}, | |
addDOMAttrsFromStorage: function addDOMAttrsFromStorage(DOMAttrs) { | |
for (var key in DOMAttrs) { | |
if (DOMAttrs.hasOwnProperty(key)) { | |
this.setDOMAttr(key, DOMAttrs[key]); | |
} | |
} | |
}, | |
remove: function () { | |
this.purgeContents(); | |
$(this.DOMElement).remove(); | |
}, | |
hide: function hide() { | |
$(this.DOMElement).hide(); | |
}, | |
show: function show() { | |
$(this.DOMElement).show(); | |
}, | |
addClass: function addClass(className) { | |
var classes = []; | |
var currentClasses; | |
var that = this; | |
this.DOMAttrs = this.DOMAttrs || {}; | |
this.classes = this.classes || []; | |
if (typeof className === 'string') { | |
className = className.split(' '); | |
} | |
classes = classes.concat(className); | |
if (typeof this.DOMElement !== 'undefined') { | |
currentClasses = $(this.DOMElement).attr('class'); | |
if (typeof currentClasses !== 'undefined') { | |
classes = classes.concat(currentClasses.split(' ')); | |
} | |
} | |
classes.forEach(function (item) { | |
if (that.classes.indexOf(item) === -1) { | |
that.classes.push(item); | |
} | |
}); | |
this.setDOMAttr('class', this.classes.join(' ')); | |
}, | |
hasClass: function hasClass(className) { | |
this.classes = this.classes || []; | |
return (this.classes.indexOf(className) !== -1); | |
}, | |
toggleClass: function toggleClass(className) { | |
if (this.hasClass(className)) { | |
this.removeClass(className); | |
} else { | |
this.addClass(className); | |
} | |
}, | |
replaceClass: function replaceClass(oldClassName, className) { | |
this.removeClass(oldClassName); | |
this.addClass(className); | |
}, | |
addClassFromObjAttrs: function addClassFromObjAttrs() { | |
if ('className' in this.objAttrs) { | |
this.addClass(this.objAttrs.className); | |
} | |
}, | |
addIDFromObjAttrs: function addIDFromObjAttrs() { | |
if ('id' in this.objAttrs) { | |
this.setDOMAttr('id', this.objAttrs.id); | |
} | |
}, | |
addTitleFromObjAttrs: function addTitleFromObjAttrs() { | |
if ('title' in this.objAttrs) { | |
this.setDOMAttr('title', this.objAttrs.title); | |
} | |
}, | |
setDOMAttrs: function setDOMAttrs(attributes) { | |
for (var key in attributes) { | |
if (attributes.hasOwnProperty(key)) { | |
this.setDOMAttr(key, attributes[key]); | |
} | |
} | |
return true; | |
}, | |
setDOMAttr: function setDOMAttr(key, value) { | |
this.DOMAttrs = this.DOMAttrs || {}; | |
this.DOMAttrs[key] = value; | |
if (typeof this.DOMElement !== 'undefined') { | |
if (this.getDOMAttr(key) !== value) { | |
$(this.DOMElement).attr(key, value); | |
} | |
} | |
return true; | |
}, | |
getDOMAttr: function getDOMAttr(key) { | |
return $(this.DOMElement).attr(key); | |
}, | |
removeDOMAttr: function removeDOMAttr(key) { | |
this.DOMAttr[key] = null; | |
if (key === 'class') { | |
CTX.warning('Please use the removeClassName instead to remove class'); | |
return false; | |
} | |
$(this.DOMElement).removeAttr(key); | |
return true; | |
}, | |
visitObjAttrs: function visitObjAttrs(visitorObj) { | |
var visitor; | |
for (visitor in visitorObj) { | |
if (visitorObj.hasOwnProperty(visitor)) { | |
if (visitor in this.objAttrs) { | |
visitorObj[visitor].call(this, this.objAttrs[visitor]); | |
} | |
} | |
} | |
}, | |
removeClass: function removeClass(className) { | |
var index; | |
if (typeof this.classes !== 'undefined') { | |
index = this.classes.indexOf(className); | |
this.classes.splice(index, 1); | |
} | |
if (typeof this.DOMElement !== 'undefined') { | |
$(this.DOMElement).removeClass(className); | |
} | |
}, | |
addDataFromObjAttrs: function addDataFromObjAttrs() { | |
if ('data' in this.objAttrs) { | |
var that = this; | |
$.each(this.objAttrs.data, function (key, value) { | |
that.setDOMAttr('data-' + key, value); | |
}); | |
} | |
}, | |
widgetType: function () { | |
var constructorName = 'base'; | |
var matches; | |
if (this.constructor) { | |
matches = this.constructor.toString().match(/^function ([$_a-z][$_a-z0-9]*)\(/i); | |
constructorName = matches[1]; | |
} | |
return CTX.widgets.helpers.asConstructorName(constructorName); | |
}, | |
setObjAttr: function setAttr(key, value, rebuild) { | |
if (typeof rebuild === 'undefined') { | |
rebuild = true; | |
} | |
this.objAttrs[key] = value; | |
if (rebuild === true) { | |
this.rebuildElement(); | |
} | |
return true; | |
}, | |
setObjAttrs: function setObjAttrs(attributes, rebuild) { | |
if (typeof rebuild === 'undefined') { | |
rebuild = true; | |
} | |
for (var key in attributes) { | |
if (attributes.hasOwnProperty(key)) { | |
this.setObjAttr(key, attributes[key], false); | |
} | |
} | |
if (rebuild === true) { | |
this.rebuildElement(); | |
} | |
return true; | |
}, | |
rebuildElement: function rebuildElement() { | |
var replaceElement = false; | |
var $oldEl; | |
var oldEl; | |
if (typeof this.DOMElement !== 'undefined') { | |
replaceElement = true; | |
oldEl = this.DOMElement; | |
$oldEl = $(this.DOMElement); | |
$oldEl.off(); | |
$oldEl.find('*').off(); | |
oldEl.onclick = null; | |
oldEl.onchange = null; | |
oldEl.onhover = null; | |
} | |
this.init(); | |
if (replaceElement === true) { | |
$oldEl.replaceWith(this.getDOMElement()); | |
oldEl = this.DOMElement; | |
} | |
return true; | |
}, | |
getObjAttr: function getAttr(key) { | |
if (key in this.objAttrs) { | |
return this.objAttrs[key]; | |
} | |
return null; | |
}, | |
isValid: function isValid() { | |
if (typeof this.objAttrs === 'undefined') { | |
return false; | |
} | |
if ('object' !== CTX.helpers.typeOf(this.objAttrs)) { | |
return false; | |
} | |
this.setDefaults(); | |
return true; | |
}, | |
isFormElement: function () { | |
return false; | |
}, | |
onLoad: function () {} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function FormElement() {} | |
CTX.abstract.widgets.FormElement = FormElement; | |
CTX.helpers.extend(FormElement, CTX.abstract.widgets.Base); | |
FormElement.prototype.value = ''; | |
FormElement.prototype.disabled = false; | |
FormElement.prototype.onChangeCallbacks = null; | |
FormElement.prototype.isFormElement = function isFormElement() { | |
if (this.disabled === false) { | |
return true; | |
} | |
return false; | |
}; | |
FormElement.prototype.setValue = function setValue(value, fireUpdates) { | |
this.value = value; | |
if (fireUpdates !== false) { | |
this.fireOnChangeCallbacks(); | |
} | |
return true; | |
}; | |
FormElement.prototype.getValue = function getValue() { | |
if (this.disabled === false) { | |
return this.value; | |
} else { | |
return null; | |
} | |
}; | |
FormElement.prototype.getName = function getName() { | |
if (this.disabled === false) { | |
if ('name' in this.objAttrs) { | |
return this.objAttrs.name; | |
} else { | |
return null; | |
} | |
} else { | |
return null; | |
} | |
}; | |
FormElement.prototype.disable = function disable() { | |
this.disabled = true; | |
return true; | |
}; | |
FormElement.prototype.enable = function enable() { | |
this.disabled = false; | |
return true; | |
}; | |
FormElement.prototype.registerOnChangeCallback = function (callback) { | |
if (!(this.onChangeCallbacks)) { | |
this.onChangeCallbacks = []; | |
} | |
this.onChangeCallbacks.push(callback); | |
return true; | |
}; | |
FormElement.prototype.fireOnChangeCallbacks = function fireOnChangeCallbacks() { | |
var that = this; | |
if (this.onChangeCallbacks) { | |
this.onChangeCallbacks.forEach(function (callback) { | |
callback(that.value); | |
}); | |
} | |
return true; | |
}; | |
FormElement.prototype.getForm = function () { | |
var $form = $(this.DOMElement).closest('form'); | |
if (1 === $form.length) { | |
return CTX.getWidgetInstance($form); | |
} | |
return null; | |
}; | |
FormElement.prototype.updateFormFields = function () { | |
var form = this.getForm(); | |
if (null !== form) { | |
return form.updateFields(); | |
} | |
return false; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function FormWrapper() {} | |
CTX.abstract.widgets.FormWrapper = FormWrapper; | |
CTX.helpers.extend(FormWrapper, CTX.abstract.widgets.Base); | |
FormWrapper.prototype.legend = null; | |
FormWrapper.prototype.content = null; | |
FormWrapper.prototype.isFormWrapper = function isFormWrapper() { | |
return true; | |
}; | |
FormWrapper.prototype.setLegend = function setLegend(legend) { | |
this.legend = legend; | |
return true; | |
}; | |
FormWrapper.prototype.setContent = function setContent(content) { | |
this.content = content; | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerController('/error', { | |
index: CTX.action({}) | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerTemplate('/error/index', function () { | |
var output = []; | |
output.push(CTX.widgets.infoPod({ | |
content: [CTX.widgets.heading({ | |
text: 'Internal server error', | |
level: 1 | |
}), CTX.widgets.block({ | |
content: '', | |
className: 'ctx_block_error-image' | |
})], | |
className: 'ctx_info-pod_main' | |
})); | |
return output; | |
}); | |
}(window.CTX)); | |
(function () { | |
'use strict'; | |
function WhoisPrivacy(params) { | |
this.updateURI = { | |
path: '/mobile/order/whoisprivacy' | |
}; | |
this.dataWrapper = ['mobileOrderWhoisPrivacy', 'possibleWhoIsDomains']; | |
this.tableNamespace = 'possibleWhoIsDomains'; | |
this.setParams(params); | |
} | |
CTX.model.WhoisPrivacy = WhoisPrivacy; | |
CTX.helpers.extend(WhoisPrivacy, CTX.abstract.resultSetHandler); | |
}(CTX)); | |
(function () { | |
'use strict'; | |
function DomainAvailability(params) { | |
var info = this.getExtensionAndHostname(params.domain); | |
this.hostname = info.hostname || ''; | |
this.extension = info.extension || null; | |
this.extensionResults = {}; | |
this.suggestions = []; | |
this.callbacks = {}; | |
this.suggestionCallbacks = []; | |
} | |
CTX.model.DomainAvailability = DomainAvailability; | |
DomainAvailability.prototype.getHostname = function () { | |
return this.hostname; | |
}; | |
DomainAvailability.prototype.setExtension = function (extension, data) { | |
this.extensionResults[extension] = data; | |
this.fireUpdateCallbacks(extension, data); | |
return true; | |
}; | |
DomainAvailability.prototype.registerSuggestionCallback = function (callback) { | |
if ('function' !== CTX.helpers.typeOf(callback)) { | |
return false; | |
} | |
this.suggestionCallbacks.push(callback); | |
return true; | |
}; | |
DomainAvailability.prototype.fireSuggestionCallbacks = function (data) { | |
this.suggestionCallbacks.forEach(function (callback) { | |
callback(data); | |
}); | |
return true; | |
}; | |
DomainAvailability.prototype.registerUpdateCallback = function (extensions, callback) { | |
var that = this; | |
if ('array' !== CTX.helpers.typeOf(extensions)) { | |
extensions = [extensions]; | |
} | |
extensions.forEach(function (extension) { | |
that.callbacks[extension] = that.callbacks[extension] || []; | |
that.callbacks[extension].push(callback); | |
}); | |
return true; | |
}; | |
DomainAvailability.prototype.fireUpdateCallbacks = function (extension, data) { | |
if (extension in this.callbacks) { | |
this.callbacks[extension].forEach(function (callback) { | |
callback(data); | |
}); | |
} | |
return true; | |
}; | |
DomainAvailability.prototype.getDomainExtension = function (extension, callback) { | |
if ('function' !== CTX.helpers.typeOf(callback)) { | |
return false; | |
} | |
this.registerUpdateCallback(extension, callback); | |
if (extension in this.extensionResults) { | |
callback(this.extensionResults[extension]); | |
} else { | |
this.getDomainExtensions({ | |
extensions: [extension] | |
}); | |
} | |
return true; | |
}; | |
DomainAvailability.prototype.getDomainExtensions = function (options, callback) { | |
var that = this; | |
var extensions = []; | |
var extensionsToSearchLimit = 5; | |
var segments; | |
if ('object' !== CTX.helpers.typeOf(options) || !('extensions' in options)) { | |
CTX.debug('Options provided to getDomainExtensions is invalid'); | |
return false; | |
} | |
options.retries = options.retries || 0; | |
options.extensions.forEach(function (extension) { | |
if (!(extension in that.extensionResults)) { | |
extensions.push(extension); | |
} | |
}); | |
if ('function' === CTX.helpers.typeOf(callback)) { | |
this.registerUpdateCallback(options.extensions, callback); | |
} | |
if (options.retries >= 5) { | |
extensions.forEach(function (extension) { | |
that.setExtension(extension, { | |
backorder: 0, | |
extension: extension, | |
status: 'unknown' | |
}); | |
}); | |
return; | |
} | |
if (extensions.length > 0) { | |
if (extensions.length < 5) { | |
this.submitDomainRequest(this.hostname, extensions, options); | |
} else { | |
segments = [ | |
[] | |
]; | |
for (var i = 0; i < extensions.length; i++) { | |
if (segments[segments.length - 1].length > extensionsToSearchLimit) { | |
segments.push([]); | |
} | |
segments[segments.length - 1].push(extensions[i]); | |
} | |
segments.forEach(function (extensionsToSearch) { | |
that.submitDomainRequest(that.hostname, extensionsToSearch, options); | |
}); | |
} | |
} | |
}; | |
DomainAvailability.prototype.submitDomainRequest = function (hostname, extensions, options) { | |
var that = this; | |
CTX.getMessage({ | |
URI: { | |
path: '/api/domain' | |
}, | |
data: { | |
method: 'check_domain_availability', | |
params: { | |
client: { | |
username: '123-reg' | |
}, | |
search: { | |
domain: hostname, | |
extensions: extensions | |
} | |
} | |
}, | |
sendRawData: true, | |
method: 'POST', | |
success: function (data) { | |
that.getDomainExtensionsSuccess.call(that, data, options); | |
}, | |
fail: function () { | |
that.retryDomainExtensions.call(that, options); | |
} | |
}); | |
}; | |
DomainAvailability.prototype.retryDomainExtensions = function (options) { | |
var that = this; | |
var retrytime = (((1 / 3) * options.retries + 1) * (2 * Math.random() + 1)) * 1000; | |
retrytime = Math.floor(retrytime); | |
options.retries += 1; | |
setTimeout(function () { | |
that.getDomainExtensions(options); | |
}, retrytime); | |
return true; | |
}; | |
DomainAvailability.prototype.getDomainExtensionsSuccess = function (data, options) { | |
var that = this; | |
if ('object' === CTX.helpers.typeOf(data) && 'object' === CTX.helpers.typeOf(data.result)) { | |
data = CTX.helpers.objUnderscoreToCamelCase(data); | |
if (Number(data.result.isSuccess) === 1) { | |
if ('array' === CTX.helpers.typeOf(data.result.attributes.results)) { | |
data.result.attributes.results.forEach(function (extensionRes) { | |
that.setExtension(extensionRes.extension, extensionRes); | |
}); | |
return true; | |
} | |
} | |
} | |
that.retryDomainExtensions(options); | |
return false; | |
}; | |
DomainAvailability.prototype.getPremiumSuggestions = function (options, callback) { | |
var that = this; | |
var search = that.hostname; | |
if (null !== that.extension) { | |
search += that.extension; | |
} | |
this.registerSuggestionCallback(callback); | |
if (0 === this.suggestions.length) { | |
CTX.getMessage({ | |
URI: { | |
path: '/api/domain' | |
}, | |
data: { | |
method: 'get_premium_domain_suggestions', | |
params: { | |
client: { | |
username: '123-reg' | |
}, | |
search: { | |
domain: search | |
} | |
} | |
}, | |
sendRawData: true, | |
method: 'POST', | |
success: function (data) { | |
that.getPremiumSuggestionsSuccess.call(that, data, options); | |
} | |
}); | |
} else { | |
this.fireSuggestionCallbacks(that.suggestions); | |
} | |
}; | |
DomainAvailability.prototype.getPremiumSuggestionsSuccess = function (data) { | |
var that = this; | |
if ('object' === CTX.helpers.typeOf(data) && 'object' === CTX.helpers.typeOf(data.result)) { | |
data = CTX.helpers.objUnderscoreToCamelCase(data); | |
if ('attributes' in data.result && 'suggestions' in data.result.attributes && 'array' === CTX.helpers.typeOf(data.result.attributes.suggestions)) { | |
data.result.attributes.suggestions.forEach(function (suggestion) { | |
var suggestionInfo = that.getExtensionAndHostname(suggestion.domain); | |
if (suggestionInfo !== null && suggestionInfo.hostname === that.hostname) { | |
that.setExtension(suggestionInfo.extension, { | |
backorder: 0, | |
extension: suggestionInfo.extension, | |
status: 'taken' | |
}); | |
} | |
suggestion.extension = suggestionInfo.extension; | |
suggestion.hostname = suggestionInfo.hostname; | |
that.suggestions.push(suggestion); | |
}); | |
that.fireSuggestionCallbacks(that.suggestions); | |
} | |
} | |
}; | |
DomainAvailability.prototype.isExactMatch = function (callback) { | |
var that = this; | |
if (null === this.extension) { | |
callback(false); | |
return false; | |
} | |
this.getPremiumSuggestions({}, function (suggestions) { | |
if ('array' === CTX.helpers.typeOf(suggestions)) { | |
suggestions.forEach(function (suggestion) { | |
if (suggestion.domain === that.hostname + that.extension) { | |
callback(suggestion); | |
} | |
}); | |
} | |
}); | |
return true; | |
}; | |
DomainAvailability.prototype.getExtensionAndHostname = function (search) { | |
var domainMatches = search.match(/([^.]*)(\..*)?/); | |
if ('array' !== CTX.helpers.typeOf(domainMatches)) { | |
return domainMatches; | |
} else { | |
return { | |
hostname: domainMatches[1], | |
extension: domainMatches[2] | |
}; | |
} | |
}; | |
}(CTX)); | |
(function () { | |
'use strict'; | |
CTX.abstract.action = function action(params) { | |
this.params = { | |
getStash: false, | |
response: { | |
200: function () { | |
CTX.loadTemplate(); | |
}, | |
302: function (data, xhr) { | |
if ('headers' in xhr && 'Location' in xhr.headers) { | |
var URIObject = CTX.helpers.URIToObject(xhr.headers.Location); | |
return CTX.helpers.redirectWindowToURI(URIObject); | |
} | |
return true; | |
}, | |
defaultAction: function () { | |
CTX.warning('Could not handle response code'); | |
CTX.loadAction({ | |
URI: { | |
path: '/error/index' | |
}, | |
detach: true | |
}); | |
} | |
} | |
}; | |
this.setParams(params); | |
}; | |
CTX.abstract.action.prototype = { | |
callAction: function callAction() { | |
var stashObject = {}; | |
if (this.params.getStash !== false) { | |
if (typeof this.params.getStash === 'object') { | |
stashObject = this.params.getStash; | |
} | |
stashObject.action = this; | |
CTX.getStash(stashObject); | |
} else { | |
this.callResponse(200); | |
} | |
}, | |
callResponse: function callResponse(responseName, responseData, xhr) { | |
CTX.event.fire('action.callResponse'); | |
if (responseName in this.params.response && this.params.response[responseName] !== null) { | |
this.params.response[responseName](responseData, xhr); | |
} else { | |
this.params.response.defaultAction(responseData, xhr); | |
} | |
return true; | |
}, | |
setParams: function setParams(params) { | |
if (params !== null) { | |
if ('getStash' in params) { | |
this.params.getStash = params.getStash; | |
} | |
if ('response' in params) { | |
for (var method in params.response) { | |
if (params.response.hasOwnProperty(method)) { | |
this.params.response[method] = params.response[method]; | |
} | |
} | |
} | |
} | |
} | |
}; | |
}(CTX)); | |
(function () { | |
'use strict'; | |
CTX.abstract.resultSetHandler = function resultSetHandler(params) { | |
this.updateURI = null; | |
this.dataWrapper = null; | |
this.tableNamespace = null; | |
this.setParams(params); | |
}; | |
CTX.abstract.resultSetHandler.prototype = { | |
clearCache: function clearCache() { | |
this.resultSets = {}; | |
this.currentPage = null; | |
this.requestingPage = null; | |
this.clearGetPageCallbacks(); | |
}, | |
setParams: function setParams(request) { | |
var params = {}; | |
var pageKey = this.tableNamespace + '.paging.length'; | |
var pagingLengthKey = this.tableNamespace + '.paging.length'; | |
var filterKey = this.tableNamespace + '.filter'; | |
if ('parameters' in request) { | |
params = request.parameters; | |
} | |
if (pagingLengthKey in params) { | |
this.setPageLength(params[pagingLengthKey]); | |
} | |
if (pageKey in params) { | |
this.currentPage = params[pageKey]; | |
} | |
if (filterKey in params) { | |
this.setFilter(params[filterKey]); | |
} | |
this.pageLength = this.pageLength || 10; | |
this.sortColumn = this.sortColumn || null; | |
this.sortOrder = this.sortOrder || 'asc'; | |
this.searchTerm = this.searchTerm || null; | |
this.pointer = this.pointer || null; | |
this.requestingPage = null; | |
this.getPageCallbacks = []; | |
this.totalRecords = null; | |
this.resultSets = {}; | |
this.totalDisplayRecords = null; | |
this.currentPage = null; | |
return true; | |
}, | |
setFirstPage: function setFirstPage(data) { | |
var unwrappedData; | |
if (typeof data !== 'undefined') { | |
this.currentPage = 1; | |
unwrappedData = CTX.unwrapMessage(this.dataWrapper, data); | |
this.successHandler(unwrappedData); | |
} | |
return true; | |
}, | |
setPageLength: function setPageLength(pageLength) { | |
if (pageLength !== this.pageLength) { | |
this.clearCache(); | |
this.pageLength = pageLength; | |
} | |
}, | |
setSort: function setPageLength(column, order) { | |
if (typeof order === 'undefined') { | |
if (column === this.sortColumn) { | |
if (this.sortOrder === 'asc') { | |
order = 'desc'; | |
} else { | |
order = 'asc'; | |
} | |
} else { | |
order = 'asc'; | |
} | |
} | |
if (this.sortColumn !== column || this.sortOrder !== order) { | |
this.clearCache(); | |
this.sortColumn = column; | |
this.sortOrder = order; | |
} | |
}, | |
setFilter: function setFilter(term) { | |
if (this.searchTerm !== term) { | |
this.clearCache(); | |
this.searchTerm = term; | |
} | |
}, | |
hasPage: function hasPage() { | |
if (this.currentPage === null || !(this.currentPage in this.resultSets)) { | |
return false; | |
} | |
return true; | |
}, | |
all: function all() { | |
if (this.hasPage()) { | |
return this.resultSets[this.currentPage]; | |
} | |
return null; | |
}, | |
nextPage: function nextPage(callback) { | |
if (this.currentPage === null) { | |
this.currentPage = 1; | |
} | |
this.currentPage += 1; | |
return this.getPage(callback); | |
}, | |
getPage: function getPage(callback) { | |
var that = this; | |
var data = {}; | |
if (this.hasPage()) { | |
callback(true); | |
return this.resultSets[this.currentPage]; | |
} else { | |
this.registerGetPageCallback(callback); | |
} | |
if (this.currentPage === null) { | |
this.currentPage = 1; | |
} else if (this.requestingPage === this.currentPage) { | |
return null; | |
} | |
data[this.tableNamespace] = { | |
paging: { | |
start: this.currentPage, | |
length: this.pageLength | |
}, | |
sorting: { | |
column: this.sortColumn, | |
order: this.sortOrder | |
}, | |
filter: this.searchTerm | |
}; | |
this.requestingPage = this.currentPage; | |
CTX.getMessage({ | |
dataWrapper: this.dataWrapper, | |
URI: this.updateURI, | |
data: data, | |
success: function (data) { | |
that.successHandler.call(that, data); | |
} | |
}); | |
return null; | |
}, | |
successHandler: function successHandler(data) { | |
if ('object' !== CTX.helpers.typeOf(data)) { | |
CTX.debug('Invalid table data in resultSetHandler response', data); | |
return; | |
} | |
if ('tableData' in data) { | |
this.resultSets[this.currentPage] = data.tableData; | |
this.totalDisplayRecords = data.totalDisplayRecords; | |
this.totalRecords = data.totalRecords; | |
this.fireGetPageCallbacks(); | |
} else { | |
CTX.debug('Missing table data in resultSetHandler response', data); | |
} | |
}, | |
registerGetPageCallback: function (callback) { | |
if ('function' === CTX.helpers.typeOf(callback)) { | |
this.getPageCallbacks.push(callback); | |
return true; | |
} | |
return false; | |
}, | |
clearGetPageCallbacks: function () { | |
this.getPageCallbacks = []; | |
}, | |
fireGetPageCallbacks: function () { | |
this.getPageCallbacks.forEach(function (callback) { | |
callback(true); | |
}); | |
this.clearGetPageCallbacks(); | |
}, | |
previousPage: function nextPage(callback) { | |
if (this.currentPage === null) { | |
this.currentPage = 1; | |
} | |
this.currentPage -= 1; | |
return this.getPage(callback); | |
} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function FormElement() {} | |
CTX.abstract.widgets.FormElement = FormElement; | |
CTX.helpers.extend(FormElement, CTX.abstract.widgets.Base); | |
FormElement.prototype.value = ''; | |
FormElement.prototype.disabled = false; | |
FormElement.prototype.onChangeCallbacks = null; | |
FormElement.prototype.isFormElement = function isFormElement() { | |
if (this.disabled === false) { | |
return true; | |
} | |
return false; | |
}; | |
FormElement.prototype.setValue = function setValue(value, fireUpdates) { | |
this.value = value; | |
if (fireUpdates !== false) { | |
this.fireOnChangeCallbacks(); | |
} | |
return true; | |
}; | |
FormElement.prototype.getValue = function getValue() { | |
if (this.disabled === false) { | |
return this.value; | |
} else { | |
return null; | |
} | |
}; | |
FormElement.prototype.getName = function getName() { | |
if (this.disabled === false) { | |
if ('name' in this.objAttrs) { | |
return this.objAttrs.name; | |
} else { | |
return null; | |
} | |
} else { | |
return null; | |
} | |
}; | |
FormElement.prototype.disable = function disable() { | |
this.disabled = true; | |
return true; | |
}; | |
FormElement.prototype.enable = function enable() { | |
this.disabled = false; | |
return true; | |
}; | |
FormElement.prototype.registerOnChangeCallback = function (callback) { | |
if (!(this.onChangeCallbacks)) { | |
this.onChangeCallbacks = []; | |
} | |
this.onChangeCallbacks.push(callback); | |
return true; | |
}; | |
FormElement.prototype.fireOnChangeCallbacks = function fireOnChangeCallbacks() { | |
var that = this; | |
if (this.onChangeCallbacks) { | |
this.onChangeCallbacks.forEach(function (callback) { | |
callback(that.value); | |
}); | |
} | |
return true; | |
}; | |
FormElement.prototype.getForm = function () { | |
var $form = $(this.DOMElement).closest('form'); | |
if (1 === $form.length) { | |
return CTX.getWidgetInstance($form); | |
} | |
return null; | |
}; | |
FormElement.prototype.updateFormFields = function () { | |
var form = this.getForm(); | |
if (null !== form) { | |
return form.updateFields(); | |
} | |
return false; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function FormWrapper() {} | |
CTX.abstract.widgets.FormWrapper = FormWrapper; | |
CTX.helpers.extend(FormWrapper, CTX.abstract.widgets.Base); | |
FormWrapper.prototype.legend = null; | |
FormWrapper.prototype.content = null; | |
FormWrapper.prototype.isFormWrapper = function isFormWrapper() { | |
return true; | |
}; | |
FormWrapper.prototype.setLegend = function setLegend(legend) { | |
this.legend = legend; | |
return true; | |
}; | |
FormWrapper.prototype.setContent = function setContent(content) { | |
this.content = content; | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.abstract.widgets.Base = function Base() {}; | |
CTX.abstract.widgets.Base.prototype = { | |
makeDOMElement: function makeDomElement() { | |
this.DOMElement = $('<span></span>')[0]; | |
return true; | |
}, | |
getUUID: function () { | |
if (this.UUID === null || this.UUID === undefined) { | |
this.UUID = CTX.helpers.UUID(); | |
} | |
return this.UUID; | |
}, | |
purgeContents: function () { | |
var $el = $(this.DOMElement); | |
CTX.removeObj(this.getUUID()); | |
$el.removeData(); | |
this.DOMElement = undefined; | |
}, | |
getDOMElement: function getDOMElement() { | |
if (this.DOMElement) { | |
this.purgeContents(); | |
} | |
this.init(); | |
if (typeof this.DOMAttrs !== 'undefined') { | |
this.addDOMAttrsFromStorage(this.DOMAttrs); | |
} | |
this.addClass('ctx_widget'); | |
this.addClass('ctx_' + CTX.widgets.helpers.asCssClass(this.widgetType())); | |
$(this.DOMElement).data('CTXWidget', this.getUUID()); | |
CTX.registerObj(this.getUUID(), this); | |
return this.DOMElement; | |
}, | |
setDefaults: function setDefaults() { | |
if (this.defaults) { | |
for (var defaultKey in this.defaults) { | |
if (this.defaults.hasOwnProperty(defaultKey)) { | |
if (!(defaultKey in this.objAttrs)) { | |
this.objAttrs[defaultKey] = this.defaults[defaultKey]; | |
} | |
} | |
} | |
} | |
return true; | |
}, | |
init: function init() { | |
this.setDefaults(); | |
if (!(this.isValid())) { | |
CTX.debug('Is valid check failed', this, this.objAttrs); | |
return ''; | |
} | |
this.makeDOMElement(); | |
this.addDataFromObjAttrs(); | |
this.addClassFromObjAttrs(); | |
this.addIDFromObjAttrs(); | |
this.addTitleFromObjAttrs(); | |
this.onLoad(); | |
return this; | |
}, | |
addDOMAttrsFromStorage: function addDOMAttrsFromStorage(DOMAttrs) { | |
for (var key in DOMAttrs) { | |
if (DOMAttrs.hasOwnProperty(key)) { | |
this.setDOMAttr(key, DOMAttrs[key]); | |
} | |
} | |
}, | |
remove: function () { | |
this.purgeContents(); | |
$(this.DOMElement).remove(); | |
}, | |
hide: function hide() { | |
$(this.DOMElement).hide(); | |
}, | |
show: function show() { | |
$(this.DOMElement).show(); | |
}, | |
addClass: function addClass(className) { | |
var classes = []; | |
var currentClasses; | |
var that = this; | |
this.DOMAttrs = this.DOMAttrs || {}; | |
this.classes = this.classes || []; | |
if (typeof className === 'string') { | |
className = className.split(' '); | |
} | |
classes = classes.concat(className); | |
if (typeof this.DOMElement !== 'undefined') { | |
currentClasses = $(this.DOMElement).attr('class'); | |
if (typeof currentClasses !== 'undefined') { | |
classes = classes.concat(currentClasses.split(' ')); | |
} | |
} | |
classes.forEach(function (item) { | |
if (that.classes.indexOf(item) === -1) { | |
that.classes.push(item); | |
} | |
}); | |
this.setDOMAttr('class', this.classes.join(' ')); | |
}, | |
hasClass: function hasClass(className) { | |
this.classes = this.classes || []; | |
return (this.classes.indexOf(className) !== -1); | |
}, | |
toggleClass: function toggleClass(className) { | |
if (this.hasClass(className)) { | |
this.removeClass(className); | |
} else { | |
this.addClass(className); | |
} | |
}, | |
replaceClass: function replaceClass(oldClassName, className) { | |
this.removeClass(oldClassName); | |
this.addClass(className); | |
}, | |
addClassFromObjAttrs: function addClassFromObjAttrs() { | |
if ('className' in this.objAttrs) { | |
this.addClass(this.objAttrs.className); | |
} | |
}, | |
addIDFromObjAttrs: function addIDFromObjAttrs() { | |
if ('id' in this.objAttrs) { | |
this.setDOMAttr('id', this.objAttrs.id); | |
} | |
}, | |
addTitleFromObjAttrs: function addTitleFromObjAttrs() { | |
if ('title' in this.objAttrs) { | |
this.setDOMAttr('title', this.objAttrs.title); | |
} | |
}, | |
setDOMAttrs: function setDOMAttrs(attributes) { | |
for (var key in attributes) { | |
if (attributes.hasOwnProperty(key)) { | |
this.setDOMAttr(key, attributes[key]); | |
} | |
} | |
return true; | |
}, | |
setDOMAttr: function setDOMAttr(key, value) { | |
this.DOMAttrs = this.DOMAttrs || {}; | |
this.DOMAttrs[key] = value; | |
if (typeof this.DOMElement !== 'undefined') { | |
if (this.getDOMAttr(key) !== value) { | |
$(this.DOMElement).attr(key, value); | |
} | |
} | |
return true; | |
}, | |
getDOMAttr: function getDOMAttr(key) { | |
return $(this.DOMElement).attr(key); | |
}, | |
removeDOMAttr: function removeDOMAttr(key) { | |
this.DOMAttr[key] = null; | |
if (key === 'class') { | |
CTX.warning('Please use the removeClassName instead to remove class'); | |
return false; | |
} | |
$(this.DOMElement).removeAttr(key); | |
return true; | |
}, | |
visitObjAttrs: function visitObjAttrs(visitorObj) { | |
var visitor; | |
for (visitor in visitorObj) { | |
if (visitorObj.hasOwnProperty(visitor)) { | |
if (visitor in this.objAttrs) { | |
visitorObj[visitor].call(this, this.objAttrs[visitor]); | |
} | |
} | |
} | |
}, | |
removeClass: function removeClass(className) { | |
var index; | |
if (typeof this.classes !== 'undefined') { | |
index = this.classes.indexOf(className); | |
this.classes.splice(index, 1); | |
} | |
if (typeof this.DOMElement !== 'undefined') { | |
$(this.DOMElement).removeClass(className); | |
} | |
}, | |
addDataFromObjAttrs: function addDataFromObjAttrs() { | |
if ('data' in this.objAttrs) { | |
var that = this; | |
$.each(this.objAttrs.data, function (key, value) { | |
that.setDOMAttr('data-' + key, value); | |
}); | |
} | |
}, | |
widgetType: function () { | |
var constructorName = 'base'; | |
var matches; | |
if (this.constructor) { | |
matches = this.constructor.toString().match(/^function ([$_a-z][$_a-z0-9]*)\(/i); | |
constructorName = matches[1]; | |
} | |
return CTX.widgets.helpers.asConstructorName(constructorName); | |
}, | |
setObjAttr: function setAttr(key, value, rebuild) { | |
if (typeof rebuild === 'undefined') { | |
rebuild = true; | |
} | |
this.objAttrs[key] = value; | |
if (rebuild === true) { | |
this.rebuildElement(); | |
} | |
return true; | |
}, | |
setObjAttrs: function setObjAttrs(attributes, rebuild) { | |
if (typeof rebuild === 'undefined') { | |
rebuild = true; | |
} | |
for (var key in attributes) { | |
if (attributes.hasOwnProperty(key)) { | |
this.setObjAttr(key, attributes[key], false); | |
} | |
} | |
if (rebuild === true) { | |
this.rebuildElement(); | |
} | |
return true; | |
}, | |
rebuildElement: function rebuildElement() { | |
var replaceElement = false; | |
var $oldEl; | |
var oldEl; | |
if (typeof this.DOMElement !== 'undefined') { | |
replaceElement = true; | |
oldEl = this.DOMElement; | |
$oldEl = $(this.DOMElement); | |
$oldEl.off(); | |
$oldEl.find('*').off(); | |
oldEl.onclick = null; | |
oldEl.onchange = null; | |
oldEl.onhover = null; | |
} | |
this.init(); | |
if (replaceElement === true) { | |
$oldEl.replaceWith(this.getDOMElement()); | |
oldEl = this.DOMElement; | |
} | |
return true; | |
}, | |
getObjAttr: function getAttr(key) { | |
if (key in this.objAttrs) { | |
return this.objAttrs[key]; | |
} | |
return null; | |
}, | |
isValid: function isValid() { | |
if (typeof this.objAttrs === 'undefined') { | |
return false; | |
} | |
if ('object' !== CTX.helpers.typeOf(this.objAttrs)) { | |
return false; | |
} | |
this.setDefaults(); | |
return true; | |
}, | |
isFormElement: function () { | |
return false; | |
}, | |
onLoad: function () {} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function SelectBox(objAttrs) { | |
this.objAttrs = objAttrs; | |
this.defaults = { | |
value: '' | |
}; | |
} | |
CTX.classType.widgets.SelectBox = SelectBox; | |
CTX.helpers.extend(SelectBox, CTX.abstract.widgets.FormElement); | |
SelectBox.prototype.makeDOMElement = function makeDOMElement() { | |
if (CTX.data.browser.mobile === true) { | |
this.DOMElement = this.normalSelect(); | |
} else { | |
this.DOMElement = this.fancySelect(); | |
} | |
return true; | |
}; | |
SelectBox.prototype.onLoad = function () { | |
$(this.DOMElement).find('[data-toggle="dropdown"]').dropdown(); | |
}; | |
SelectBox.prototype.fancySelect = function fancySelect() { | |
var $el; | |
var that = this; | |
var display; | |
var list; | |
var selectToggle; | |
var items; | |
var icon; | |
var $displayElement; | |
$el = $('<div />'); | |
this.addClass('btn-group btn-select input-append'); | |
$el.append(this.buildHidden()); | |
display = this.buildDisplay(); | |
$el.append(display); | |
$displayElement = $(display); | |
icon = CTX.widgets.icon({ | |
subType: 'chevron-down' | |
}); | |
selectToggle = CTX.widgets.button({ | |
icon: icon, | |
className: 'select-toggle', | |
data: { | |
toggle: 'dropdown' | |
}, | |
action: { | |
href: '#' | |
} | |
}); | |
$el.append(selectToggle.getDOMElement()); | |
items = this.buildItems(); | |
list = CTX.widgets.list({ | |
listItems: items, | |
className: 'dropdown-menu' | |
}); | |
$el.append(list.getDOMElement()); | |
list.setDOMAttr('role', 'menu'); | |
if ('subType' in this.objAttrs && this.objAttrs.subType === 'searchable') { | |
$el.find('.select-toggle').on('click', function () { | |
$displayElement.val(''); | |
$displayElement.focus(); | |
}); | |
$displayElement.on('click, focus', function () { | |
$displayElement.val(''); | |
}); | |
$displayElement.on('blur', function () { | |
that.resetDisplay(); | |
}); | |
} | |
$displayElement.keydown(function (e) { | |
that.matchKeyEvent.call(that, e); | |
}); | |
this.registerOnChangeCallback(function (value) { | |
that.onChange(value); | |
}); | |
$el.find('.dropdown-menu a').keydown(function (e) { | |
that.keyDownLink.call(that, e); | |
}); | |
return $el[0]; | |
}; | |
SelectBox.prototype.normalSelect = function normalSelect() { | |
var $el = $('<select />'); | |
var that = this; | |
var selected = ''; | |
if ('values' in this.objAttrs) { | |
this.objAttrs.values.forEach(function (value) { | |
if (value[0].toString() === that.objAttrs.value.toString()) { | |
selected = ' selected="selected" '; | |
that.setValue(that.objAttrs.value, false); | |
} else { | |
selected = ''; | |
} | |
$el.append('<option value="' + value[0] + '" ' + selected + '>' + value[1] + '</option>'); | |
}); | |
} | |
$el.on('change', function () { | |
that.setValue($(this).val()); | |
}); | |
return $el; | |
}; | |
SelectBox.prototype.resetDisplay = function resetDisplay() { | |
var item; | |
var $displayElement = $(this.DOMElement).find('.select-display'); | |
if (typeof this.value !== 'undefined') { | |
item = this.getItem(this.value); | |
$displayElement.val(item[1]); | |
} | |
}; | |
SelectBox.prototype.buildHidden = function buildHidden() { | |
var hidden = null; | |
var hiddenAttrs = { | |
subType: 'hidden', | |
className: 'select-hidden' | |
}; | |
if ('name' in this.objAttrs) { | |
hiddenAttrs.name = this.objAttrs.name; | |
} | |
if ('value' in this.objAttrs && false !== this.getItem(this.objAttrs.value)) { | |
hiddenAttrs.value = this.objAttrs.value; | |
} | |
hidden = CTX.widgets.input(hiddenAttrs); | |
hidden.disable(); | |
return hidden.getDOMElement(); | |
}; | |
SelectBox.prototype.buildDisplay = function buildSelect() { | |
var selectOptions = { | |
subType: 'text', | |
readonly: true, | |
className: 'select-display', | |
value: this.getItem(this.objAttrs.value)[1], | |
data: { | |
toggle: 'dropdown' | |
} | |
}; | |
if ('subType' in this.objAttrs && this.objAttrs.subType === 'searchable') { | |
selectOptions.readonly = false; | |
} | |
if ('placeholder' in this.objAttrs) { | |
selectOptions.placeholder = this.objAttrs.placeholder; | |
} | |
return CTX.widgets.input(selectOptions).getDOMElement(); | |
}; | |
SelectBox.prototype.keyDownLink = function keyDownLink(e) { | |
var $el = $(this.DOMElement); | |
if (e.keyCode === 13) { | |
this.setValue($(e.target).data('value')); | |
this.resetDisplay(); | |
$el.removeClass('open'); | |
} | |
}; | |
SelectBox.prototype.matchKeyEvent = function matchKeyEvent(e) { | |
if (/(38|40|27)/.test(e.keyCode)) { | |
return; | |
} | |
if (!('subType' in this.objAttrs) || this.objAttrs.subType !== 'searchable') { | |
this.selectFirstItem(this.searchString(String.fromCharCode(e.keyCode))); | |
} else { | |
this.showSearch(e); | |
} | |
}; | |
SelectBox.prototype.searchString = function searchString(searchTerm) { | |
var whiteSpaceMatch = /\s*/g; | |
return searchTerm.replace(whiteSpaceMatch, '').toLowerCase(); | |
}; | |
SelectBox.prototype.selectFirstItem = function showFirstItem(search) { | |
var $el = $(this.DOMElement); | |
var $items = $('[role=menu] li:not(.divider):visible a', $el); | |
var $find = $items.filter(function () { | |
return this.text[0] === search[0]; | |
}).first(); | |
if ($find) { | |
$find.focus(); | |
} | |
}; | |
SelectBox.prototype.showSearch = function showSearch(e) { | |
var that = this; | |
var $el = $(this.DOMElement); | |
var $display = $el.find('.select-display'); | |
var currentValue = $display.val(); | |
if (e.keyCode === 8) { | |
currentValue = currentValue.substr(0, currentValue.length - 1); | |
} else { | |
currentValue += String.fromCharCode(e.keyCode); | |
} | |
var searchValue = this.searchString(currentValue); | |
$el.find('.dropdown-menu').show(); | |
$el.find('.dropdown-menu li').each(function (id, li) { | |
var $li = $(li); | |
var $a = $li.find('a'); | |
var value = that.searchString($a.data('value')); | |
var text = that.searchString($(li).find('a').text()); | |
if (!(text.indexOf(searchValue) > -1 || value.indexOf(searchValue) > -1)) { | |
$li.hide(); | |
} else { | |
$li.show(); | |
} | |
}); | |
}; | |
SelectBox.prototype.buildItems = function BuildItems() { | |
var items = []; | |
var item; | |
var that = this; | |
if ('values' in this.objAttrs) { | |
this.objAttrs.values.forEach(function (value) { | |
item = { | |
text: value[1], | |
data: { | |
value: value[0] | |
} | |
}; | |
if (value[0].toString() === that.objAttrs.value.toString()) { | |
item.className = 'active'; | |
that.setValue(that.objAttrs.value, false); | |
} | |
item.action = { | |
path: '#', | |
callback: function () { | |
that.setValue(value[0]); | |
} | |
}; | |
items.push({ | |
content: [CTX.widgets.link(item)] | |
}); | |
}); | |
} | |
return items; | |
}; | |
SelectBox.prototype.getItem = function (key) { | |
var returnVal = false; | |
this.objAttrs.values.forEach(function (option) { | |
if (key.toString() === option[0].toString()) { | |
returnVal = option; | |
return false; | |
} | |
}); | |
return returnVal; | |
}; | |
SelectBox.prototype.onChange = function onChange(value) { | |
var item = this.getItem(value); | |
var $domElement = $(this.DOMElement); | |
$domElement.find('.select-display').val(item[1]); | |
$domElement.find('.select-hidden').val(value); | |
$domElement.find('.dropdown-menu .active').removeClass('active'); | |
$domElement.find('.dropdown-menu li a[data-value="' + value + '"]').addClass('active'); | |
}; | |
SelectBox.prototype.setValue = function setValue(value) { | |
this.value = value; | |
if (CTX.data.browser.mobile === true) { | |
var $el = $(this.DOMElement); | |
$el.val(this.value); | |
} | |
return this.superClass.setValue.apply(this, [this.value]); | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function TabbedInfoPane(objAttrs) { | |
this.objAttrs = objAttrs; | |
this.defaults = { | |
subType: 'horizontal', | |
dynamicContent: false | |
}; | |
} | |
CTX.classType.widgets.TabbedInfoPane = TabbedInfoPane; | |
CTX.helpers.extend(TabbedInfoPane, CTX.abstract.widgets.Base); | |
TabbedInfoPane.prototype.makeDOMElement = function makeDOMElement() { | |
var tabOutput = {}; | |
var output = []; | |
var widgetStructure = { | |
content: output, | |
subType: 'div' | |
}; | |
this.selectedId = 0; | |
this.UUID = CTX.helpers.UUID(); | |
if ('selected' in this.objAttrs) { | |
this.selectedId = this.objAttrs.selected; | |
} | |
if (this.objAttrs.subType === 'horizontal') { | |
widgetStructure.subType = 'div', widgetStructure.className = 'ctx_tabbed-info-pane_horizontal'; | |
} | |
if (this.objAttrs.subType === 'vertical') { | |
widgetStructure.subType = 'div'; | |
widgetStructure.className = 'ctx_tabbed-info-pane_vertical'; | |
} | |
tabOutput = this.getTabs(this.objAttrs); | |
output.push(CTX.widgets.block({ | |
content: [CTX.widgets.list({ | |
subType: 'unordered', | |
listItems: tabOutput.listItems, | |
className: ['nav', 'nav-tabs', 'ctx_tabbed-info-pane_nav-tabs'] | |
}), CTX.widgets.block({ | |
subType: 'div', | |
content: tabOutput.content, | |
className: ['tab-content', 'ctx_tabbed-info-pane_tab-content'] | |
})], | |
subType: 'div', | |
className: 'ctx_tabbed-info-pane_container' | |
})); | |
this.DOMElement = CTX.widgets.block(widgetStructure).getDOMElement(); | |
return this.DOMElement; | |
}; | |
TabbedInfoPane.prototype.tabCallback = function (e) { | |
var $DOMElement = $(this.DOMElement); | |
var $selectedTab = $(e.target); | |
var tabId = $selectedTab.data('tabid'); | |
$DOMElement.find('.active').removeClass('active'); | |
$DOMElement.find('.tab-pane').hide(); | |
$DOMElement.find('#' + tabId).show(); | |
$selectedTab.addClass('active'); | |
}; | |
TabbedInfoPane.prototype.getTabs = function getTabs(options, level, blockContent) { | |
var that = this; | |
var listItems = []; | |
if (typeof level === 'undefined') { | |
level = 0; | |
} | |
if (typeof blockContent === 'undefined') { | |
blockContent = []; | |
} | |
options.tabs.forEach(function (tab, id) { | |
var listStructure = {}; | |
var tabId = that.UUID + '-' + id + '-' + level; | |
var linkClass = ''; | |
var tabClass = ''; | |
var existingCallback; | |
if ('tabId' in tab) { | |
tabId = tab.tabId; | |
} | |
if (!('action' in tab)) { | |
tab.action = {}; | |
} | |
if (!('URI' in tab.action)) { | |
tab.action.URI = {}; | |
} | |
if (that.selectedId === 0 && id === 0 && level === 0) { | |
that.selectedId = tabId; | |
} | |
if (that.selectedId === tabId) { | |
linkClass = 'active'; | |
tabClass = 'active'; | |
if ('selectedContent' in that.objAttrs) { | |
tab.content = that.objAttrs.selectedContent; | |
} | |
} | |
if (that.objAttrs.dynamicContent === false) { | |
if ('callback' in tab.action) { | |
existingCallback = tab.action.callback; | |
tab.action.callback = function (e) { | |
that.tabCallback.call(that, e); | |
existingCallback.call(that, e); | |
}; | |
} else { | |
tab.action.callback = function (e) { | |
that.tabCallback.call(that, e); | |
}; | |
} | |
tab.action.URI.fragment = tabId; | |
} | |
listStructure.content = CTX.widgets.link({ | |
text: tab.text, | |
action: tab.action, | |
data: { | |
tabid: tabId | |
}, | |
className: linkClass | |
}); | |
if ('subTabs' in tab && 'tabs' in tab.subTabs) { | |
listStructure.subList = that.getTabs(tab.subTabs, level + 1, blockContent); | |
} | |
listItems.push(listStructure); | |
blockContent.push(CTX.widgets.infoPod({ | |
content: tab.content, | |
className: 'tab-pane ' + tabClass, | |
id: tabId | |
})); | |
}); | |
return { | |
listItems: listItems, | |
content: blockContent | |
}; | |
}; | |
TabbedInfoPane.prototype.isValid = function isValid() { | |
var tabListStructure; | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
if (!('tabs' in this.objAttrs)) { | |
return false; | |
} | |
tabListStructure = new CTX.dataStructure.widgets.TabList(this.objAttrs.tabs); | |
if (!(tabListStructure.isValid())) { | |
return false; | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function EditablePane(objAttrs) { | |
this.objAttrs = objAttrs; | |
this.TODO = true; | |
} | |
CTX.classType.widgets.EditablePane = EditablePane; | |
CTX.helpers.extend(EditablePane, CTX.abstract.widgets.Base); | |
EditablePane.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var link; | |
var that = this; | |
$el = $('<div />'); | |
this.DOMElement = $el[0]; | |
$el.addClass('ctx_editable-pane_view-mode'); | |
link = CTX.widgets.link({ | |
text: 'Edit', | |
icon: CTX.widgets.icon({ | |
subType: 'pencil' | |
}), | |
className: 'ctx_editable-pane_edit-link', | |
action: { | |
callback: function () { | |
that.editMode.apply(that); | |
} | |
} | |
}); | |
$el.append(link.getDOMElement()); | |
$el.append(this.objAttrs.form.getDOMElement()); | |
$el.find('.ctx_widget').each(function (id, widget) { | |
var value; | |
var text; | |
var $widget = $(widget); | |
var widgetInstance = CTX.getWidgetInstance(widget); | |
if (widgetInstance.isFormElement() === true) { | |
value = widgetInstance.getValue(); | |
if (typeof value === 'undefined' || value === null) { | |
value = ''; | |
} | |
text = CTX.widgets.text({ | |
text: value, | |
className: 'ctx_editable-pane_text' | |
}); | |
$widget.after(text.getDOMElement()); | |
$widget.hide(); | |
} | |
}); | |
return true; | |
}; | |
EditablePane.prototype.editMode = function editMode() { | |
var $el = $(this.DOMElement); | |
$el.removeClass('ctx_editable-pane_view-mode'); | |
$el.addClass('ctx_editable-pane_edit-mode'); | |
$el.find('.ctx_editable-pane_edit-link').hide(); | |
$el.find('.ctx_editable-pane_text').hide(); | |
$el.find('.ctx_widget').each(function (id, widget) { | |
var $widget = $(widget); | |
var widgetInstance = CTX.getWidgetInstance($widget); | |
if (widgetInstance.isFormElement() === true) { | |
$widget.show(); | |
} | |
}); | |
}; | |
EditablePane.prototype.isValid = function isValid() { | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
if (!('form' in this.objAttrs)) { | |
CTX.debug('editablePane expects fields to be passed', this.objAttrs); | |
return false; | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function ProductButton(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.ProductButton = ProductButton; | |
CTX.helpers.extend(ProductButton, CTX.abstract.widgets.Base); | |
ProductButton.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var textBlock; | |
var blockLink; | |
var textLink; | |
$el = $('<div />'); | |
this.DOMElement = $el[0]; | |
if ('subType' in this.objAttrs) { | |
$el.addClass('ctx_product-button_product-' + CTX.widgets.helpers.asCssClass(this.objAttrs.subType)); | |
} | |
var actionURI = this.objAttrs.defaultURI; | |
if ('manageURI' in this.objAttrs && 'manageableProducts' in this.objAttrs && this.objAttrs.manageableProducts > 0) { | |
actionURI = this.objAttrs.manageURI; | |
} | |
blockLink = CTX.widgets.link({ | |
text: [CTX.widgets.block({ | |
content: [CTX.widgets.block({ | |
content: '', | |
className: 'ctx_product-button_product-image' | |
})], | |
className: 'ctx_product-button_pane' | |
})], | |
action: { | |
URI: CTX.helpers.clone(actionURI) | |
}, | |
className: 'ctx_product-button_block-link' | |
}); | |
$el.append(blockLink.getDOMElement()); | |
if ('text' in this.objAttrs) { | |
textLink = CTX.widgets.link({ | |
text: this.objAttrs.text, | |
action: { | |
URI: CTX.helpers.clone(actionURI) | |
} | |
}); | |
textBlock = CTX.widgets.block({ | |
content: [textLink], | |
className: 'ctx_product-button_text' | |
}); | |
$el.append(textBlock.getDOMElement()); | |
} | |
return true; | |
}; | |
ProductButton.prototype.isValid = function isValid() { | |
var textStructure; | |
var manageURIStructure; | |
var validSubTypes = ['websiteBuilder', 'email', 'webHosting', 'domains', 'servers', 'security', 'ecommerce', 'marketing', 'account', 'affiliates', 'offers']; | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
if (!('defaultURI' in this.objAttrs)) { | |
CTX.debug('defaultURI requires a action to be passed'); | |
return false; | |
} | |
if ('manageURI' in this.objAttrs) { | |
manageURIStructure = new CTX.dataStructure.widgets.URI(this.objAttrs.manageURI); | |
if (!(manageURIStructure.isValid())) { | |
return false; | |
} | |
} | |
if ('text' in this.objAttrs) { | |
textStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.text); | |
if (!(textStructure.isValid())) { | |
return false; | |
} | |
} | |
if ('subType' in this.objAttrs) { | |
if (validSubTypes.indexOf(this.objAttrs.subType) === -1) { | |
return false; | |
} | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Modal(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.Modal = Modal; | |
CTX.helpers.extend(Modal, CTX.abstract.widgets.Base); | |
Modal.prototype.makeDOMElement = function makeDOMElement() { | |
var closeButton; | |
var that = this; | |
var headerContent = ''; | |
var primaryOutput = []; | |
var secondaryOutput = []; | |
if ('headerContent' in this.objAttrs) { | |
headerContent = CTX.helpers.clone(this.objAttrs.headerContent); | |
if ('closeButton' in this.objAttrs) { | |
closeButton = CTX.widgets.link({ | |
className: 'ctx_modal_close-button close-button', | |
data: { | |
dismiss: 'modal' | |
}, | |
text: CTX.widgets.icon({ | |
subType: 'remove-sign' | |
}), | |
action: { | |
callback: function () { | |
that.hide(); | |
} | |
} | |
}); | |
if (typeof headerContent === 'string') { | |
headerContent = [closeButton, headerContent]; | |
} else { | |
headerContent.unshift(closeButton); | |
} | |
} | |
} | |
secondaryOutput.push(CTX.widgets.block({ | |
subType: 'div', | |
content: headerContent, | |
className: 'ctx_modal_header' | |
})); | |
secondaryOutput.push(CTX.widgets.block({ | |
subType: 'div', | |
content: this.objAttrs.bodyContent, | |
className: 'ctx_modal_body' | |
})); | |
if ('footerContent' in this.objAttrs) { | |
secondaryOutput.push(CTX.widgets.block({ | |
subType: 'div', | |
content: this.objAttrs.footerContent, | |
className: 'ctx_modal_footer' | |
})); | |
} | |
primaryOutput.push(CTX.widgets.link({ | |
data: { | |
dismiss: 'modal' | |
}, | |
action: { | |
callback: function () { | |
that.hide(); | |
} | |
}, | |
text: '', | |
className: 'ctx_modal_close' | |
})); | |
primaryOutput.push(CTX.widgets.block({ | |
subType: 'div', | |
content: secondaryOutput, | |
className: 'ctx_modal_window' | |
})); | |
this.DOMElement = CTX.widgets.block({ | |
subType: 'div', | |
content: primaryOutput | |
}).getDOMElement(); | |
}; | |
Modal.prototype.isValid = function isValid() { | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
if (!('bodyContent' in this.objAttrs)) { | |
CTX.debug('Modal widget requires bodyContent', this.objAttrs); | |
return false; | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Label(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.Label = Label; | |
CTX.helpers.extend(Label, CTX.abstract.widgets.Base); | |
Label.prototype.attrVisitors = { | |
forId: function (value) { | |
this.setDOMAttr('for', value); | |
}, | |
text: function (value) { | |
var textStructure = new CTX.dataStructure.widgets.Content(value); | |
$(this.DOMElement).html(textStructure.output()); | |
} | |
}; | |
Label.prototype.makeDOMElement = function makeDOMElement() { | |
var $el = $('<label />'); | |
this.DOMElement = $el[0]; | |
this.visitObjAttrs(this.attrVisitors); | |
return $el[0]; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Accordion(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.Accordion = Accordion; | |
CTX.helpers.extend(Accordion, CTX.abstract.widgets.FormWrapper); | |
Accordion.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var $heading; | |
var $body; | |
var that = this; | |
var blockStructure; | |
$el = $('<div />'); | |
this.DOMElement = $el[0]; | |
this.handleFormWrapperAttributes(); | |
if ('heading' in this.objAttrs) { | |
$heading = $('<div class="ctx_accordion_heading">'); | |
$heading.click(function (e) { | |
that.handleHeadingClick(e); | |
}); | |
blockStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.heading); | |
$heading.append(blockStructure.output()); | |
$heading.append(CTX.widgets.icon({ | |
subType: 'plus-sign', | |
className: ['pull-right'] | |
}).getDOMElement()); | |
$el.append($heading); | |
} | |
if ('content' in this.objAttrs) { | |
$body = $('<div class="ctx_accordion_body ctx_accordion_collapsed">'); | |
blockStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.content); | |
$body.append(blockStructure.output()); | |
$el.append($body); | |
} | |
return this.DOMElement; | |
}; | |
Accordion.prototype.onLoad = function () { | |
var $DOMElement = $(this.DOMElement); | |
var icon = CTX.getWidgetInstance($(this.DOMElement).find('.ctx_icon')); | |
if ($DOMElement.data('accordion-open') === 1) { | |
$DOMElement.find('.ctx_accordion_body').removeClass('ctx_accordion_collapsed').addClass('ctx_accordion_open'); | |
icon.setObjAttr('subType', 'minus-sign'); | |
} | |
}; | |
Accordion.prototype.handleFormWrapperAttributes = function () { | |
if ('legend' in this && this.legend !== null) { | |
this.objAttrs.heading = this.legend; | |
} | |
if ('content' in this && this.content !== null) { | |
this.objAttrs.content = this.content; | |
} | |
}; | |
Accordion.prototype.handleHeadingClick = function () { | |
var $body = $(this.DOMElement).find('.ctx_accordion_body'); | |
var icon = CTX.getWidgetInstance($(this.DOMElement).find('.ctx_icon')); | |
$body.slideToggle(); | |
$('body .ctx_accordion_heading .ctx_icon_minus-sign').each(function () { | |
var iconWidget = CTX.getWidgetInstance($(this)[0]); | |
iconWidget.removeClass('ctx_icon_plus-sign'); | |
iconWidget.removeClass('ctx_icon_minus-sign'); | |
iconWidget.setObjAttr('subType', 'plus-sign'); | |
}); | |
if ($body.hasClass('ctx_accordion_collapsed')) { | |
$('body div.ctx_accordion_open').slideUp().removeClass('ctx_accordion_open').addClass('ctx_accordion_collapsed'); | |
$body.removeClass('ctx_accordion_collapsed'); | |
$body.addClass('ctx_accordion_open'); | |
icon.setObjAttr('subType', 'minus-sign'); | |
} else { | |
$body.removeClass('ctx_accordion_open'); | |
$body.addClass('ctx_accordion_collapsed'); | |
} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function SubTabbedInfoPane(objAttrs) { | |
this.objAttrs = objAttrs; | |
this.TODO = true; | |
} | |
CTX.classType.widgets.SubTabbedInfoPane = SubTabbedInfoPane; | |
CTX.helpers.extend(SubTabbedInfoPane, CTX.abstract.widgets.Base); | |
SubTabbedInfoPane.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var nav; | |
var listItems = []; | |
var selectedId = 0; | |
var UUID = CTX.helpers.UUID(); | |
var blockContent = []; | |
$el = $('<div />'); | |
this.DOMElement = $el[0]; | |
$el.addClass('tabs-left'); | |
this.objAttrs.tabs.forEach(function (tab, id) { | |
var tabID = UUID + '-' + id; | |
tab.action.uri = '#' + tabID; | |
var link = CTX.widgets.link({ | |
text: tab.text, | |
action: tab.action, | |
data: { | |
toggle: 'tab' | |
} | |
}); | |
listItems.push({ | |
content: link | |
}); | |
if (tab.selected) { | |
selectedId = id; | |
} | |
blockContent.push(CTX.widgets.infoPod({ | |
content: tab.content, | |
className: 'tab-pane', | |
id: tabID | |
})); | |
}); | |
nav = CTX.widgets.list({ | |
subType: 'unordered', | |
listItems: listItems, | |
className: ['nav', 'nav-tabs'] | |
}); | |
$el.append(nav.getDOMElement()); | |
$el.append(CTX.widgets.block({ | |
subType: 'div', | |
content: blockContent, | |
className: 'tab-content' | |
}).getDOMElement()); | |
$el.find('.ctx_list li').eq(selectedId).addClass('active'); | |
$el.find('#' + UUID + '-' + selectedId).addClass('active'); | |
$el.find('.ctx_list li a').each(function (id) { | |
$(this).attr('href', '#' + UUID + '-' + id); | |
}); | |
return this.DOMElement; | |
}; | |
SubTabbedInfoPane.prototype.isValid = function isValid() { | |
var tabListStructure; | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
if (!('tabs' in this.objAttrs)) { | |
return false; | |
} | |
tabListStructure = new CTX.dataStructure.widgets.TabList(this.objAttrs.tabs); | |
if (!(tabListStructure.isValid())) { | |
return false; | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Input(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.Input = Input; | |
CTX.helpers.extend(Input, CTX.abstract.widgets.FormElement); | |
Input.prototype.attrVisitors = { | |
'fileType': function (value) { | |
if (this.objAttrs.subType === 'file') { | |
this.setDOMAttr('accept', value); | |
} | |
}, | |
'spellcheck': function (value) { | |
var spellCheck = 'false'; | |
if (value) { | |
spellCheck = 'true'; | |
} | |
this.setDOMAttr('spellcheck', spellCheck); | |
}, | |
'autocomplete': function (value) { | |
var autoComplete = 'off'; | |
if (value) { | |
autoComplete = 'on'; | |
} | |
this.setDOMAttr('autocomplete', autoComplete); | |
}, | |
'autocorrect': function (value) { | |
var autoCorrect = 'off'; | |
if (value) { | |
autoCorrect = 'on'; | |
} | |
this.setDOMAttr('autocorrect', autoCorrect); | |
}, | |
'autocapitalize': function (value) { | |
var autoCapitalize = 'off'; | |
if (true === value) { | |
autoCapitalize = 'on'; | |
} else if (false !== value) { | |
autoCapitalize = value; | |
} | |
this.setDOMAttr('autocapitalize', autoCapitalize); | |
}, | |
'autofocus': function (value) { | |
var autoFocus = ''; | |
if (value) { | |
autoFocus = 'autofocus'; | |
} | |
this.setDOMAttr('autofocus', autoFocus); | |
}, | |
'disabled': function (value) { | |
this.setDOMAttr('disabled', value); | |
}, | |
'checked': function (value) { | |
if (this.objAttrs.subType === 'checkbox' || this.objAttrs.subType === 'radio') { | |
this.setDOMAttr('checked', value); | |
} | |
}, | |
'readonly': function (value) { | |
var readOnly = ''; | |
if (value) { | |
readOnly = 'readonly'; | |
} | |
this.setDOMAttr('readonly', readOnly); | |
}, | |
'name': function (value) { | |
this.setDOMAttr('name', value); | |
}, | |
'placeholder': function (value) { | |
this.setDOMAttr('placeholder', value); | |
}, | |
'subType': function (value) { | |
this.setDOMAttr('type', value); | |
}, | |
'value': function (value) { | |
this.setValue(value, false); | |
this.setDOMAttr('value', value); | |
} | |
}; | |
Input.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var that = this; | |
$el = $('<input />'); | |
this.DOMElement = $el[0]; | |
if (!('subType' in this.objAttrs)) { | |
this.objAttrs.subType = 'text'; | |
} | |
if ('radio' === this.objAttrs.subType || 'checkbox' === this.objAttrs.subType) { | |
$el.on('click', function () { | |
that.setValue($(this).val()); | |
}); | |
} else { | |
$el.on('change', function () { | |
that.setValue($(this).val()); | |
}); | |
} | |
this.addAutoUpdateFieldsBehavior(); | |
this.visitObjAttrs(this.attrVisitors); | |
return true; | |
}; | |
Input.prototype.addAutoUpdateFieldsBehavior = function () { | |
var that = this; | |
if ('data' in this.objAttrs && 'auto-update-fields' in this.objAttrs.data) { | |
if (1 === Number(this.objAttrs.data['auto-update-fields'])) { | |
this.registerOnChangeCallback(function () { | |
that.updateFormFields(); | |
}); | |
} | |
} | |
}; | |
Input.prototype.getValue = function getValue() { | |
var $DOMElement = $(this.DOMElement); | |
if ('subType' in this.objAttrs && (this.objAttrs.subType === 'radio' || this.objAttrs.subType === 'checkbox')) { | |
if ($(this.DOMElement).is(':checked') === false) { | |
return null; | |
} | |
} | |
if (this.value !== $DOMElement.val()) { | |
this.setValue($DOMElement.val()); | |
} | |
return this.superClass.getValue.apply(this); | |
}; | |
Input.prototype.setValue = function setValue(value) { | |
var $el = $(this.DOMElement); | |
this.value = value; | |
$el.val(this.value); | |
return this.superClass.setValue.apply(this, [this.value]); | |
}; | |
Input.prototype.isValid = function isValid() { | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
var inputTypes = Input.prototype.InputTypes(); | |
if ('subType' in this.objAttrs) { | |
if (inputTypes.indexOf(this.objAttrs.subType) > -1) { | |
return true; | |
} | |
if (this.objAttrs.subType === 'checkbox' || this.objAttrs.subType === 'radio') { | |
if ('value' in this.objAttrs) { | |
return true; | |
} | |
} | |
CTX.debug('Invalid subType passed to input widget', this.objAttrs); | |
return false; | |
} | |
CTX.debug('No subType passed to input widget', this.objAttrs); | |
return false; | |
}; | |
Input.prototype.InputTypes = function InputTypes() { | |
var inputTypes = ['checkbox', 'color', 'date', 'datetime', 'datetime-local', 'email', 'file', 'hidden', 'month', 'number', 'password', 'radio', 'range', 'search', 'tel', 'text', 'time', 'url', 'week']; | |
return inputTypes; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Header(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.Header = Header; | |
CTX.helpers.extend(Header, CTX.abstract.widgets.Base); | |
Header.prototype.makeDOMElement = function makeDOMElement() { | |
var className = ['ctx_header']; | |
if (!(this.isSearchPresent())) { | |
className.push('ctx_header_single-line'); | |
} | |
this.DOMElement = CTX.widgets.block({ | |
subType: 'header', | |
content: [this.getTopHeader()], | |
className: className | |
}).getDOMElement(); | |
}; | |
Header.prototype.isSearchPresent = function () { | |
if (/^\/mobile(\/index)?\/?$/.test(CTX.request.path)) { | |
return true; | |
} | |
if (/^\/mobile\/order\/domainresults\//.test(CTX.request.path)) { | |
return true; | |
} | |
return false; | |
}; | |
Header.prototype.getSearchForm = function () { | |
var domainValue = CTX.request.parameters.domain || ''; | |
var output = []; | |
var searchDivContent = []; | |
if (this.isSearchPresent()) { | |
searchDivContent.push(CTX.widgets.text({ | |
text: 'www.', | |
subType: 'span', | |
className: 'add-on' | |
})); | |
searchDivContent.push(CTX.widgets.input({ | |
subType: 'text', | |
placeholder: 'Search for your domain', | |
value: domainValue, | |
name: 'domain', | |
spellcheck: false, | |
autocomplete: false, | |
autocapitalize: false, | |
autocorrect: false, | |
className: 'ctx_input_medium ctx_header_search-input' | |
})); | |
searchDivContent.push(CTX.widgets.button({ | |
text: CTX.helpers.getIconGlyph('search'), | |
className: 'ctx_button_medium ctx_header_search-button', | |
subType: 'submit' | |
})); | |
output.push(CTX.widgets.form({ | |
action: { | |
URI: { | |
path: '/mobile/order/domainresults/results_page' | |
} | |
}, | |
subType: 'div', | |
content: searchDivContent, | |
className: 'ctx_header_search-box input-append input-prepend' | |
})); | |
} | |
return output; | |
}; | |
Header.prototype.getCPButton = function (className) { | |
if ('string' !== CTX.helpers.typeOf(className)) { | |
className = ''; | |
} | |
return CTX.widgets.button({ | |
text: ['CP'], | |
action: { | |
URI: { | |
host: '123-reg.co.uk', | |
port: null, | |
path: '/secure' | |
} | |
}, | |
className: 'ctx_button_medium ctx_button_flat ctx_button_header ' + className | |
}); | |
}; | |
Header.prototype.getLoginButton = function (className) { | |
if ('string' !== CTX.helpers.typeOf(className)) { | |
className = ''; | |
} | |
return CTX.widgets.button({ | |
text: [CTX.widgets.icon({ | |
subType: 'user' | |
}), ' Log in'], | |
action: { | |
URI: { | |
path: '/mobile/secure/log_in' | |
} | |
}, | |
className: 'ctx_button_medium ctx_button_flat ctx_button_header ' + className | |
}); | |
}; | |
Header.prototype.getTopHeader = function getTopHeader() { | |
var that = this; | |
var buttonDivContent = []; | |
var content = []; | |
var button; | |
var hiddenClass = 'ctx_hidden'; | |
var buttonClass = 'ctx_button_medium ctx_button_flat ctx_button_header'; | |
var getBasketContent = function () { | |
var items = 0; | |
var prices = CTX.basket.getPrices(); | |
var output = [CTX.widgets.icon({ | |
subType: 'shopping-cart' | |
}), ' Basket']; | |
if (prices.grossPrice !== null) { | |
items = CTX.basket.count(); | |
output.push(CTX.widgets.text({ | |
text: [items + ' ', CTX.helpers.pluralise(items, 'item', 'items'), ' ' + CTX.productPrice.getPriceString(prices.netPrice)], | |
className: 'ctx_text_secondary' | |
})); | |
} | |
return output; | |
}; | |
buttonDivContent = []; | |
CTX.basket.loadItems(); | |
if (0 === CTX.basket.count()) { | |
buttonClass += ' ' + hiddenClass; | |
} | |
button = CTX.widgets.button({ | |
text: getBasketContent(), | |
action: { | |
URI: { | |
path: '/mobile/order/basket/basket' | |
} | |
}, | |
className: buttonClass | |
}); | |
buttonDivContent.push(button); | |
var cpButton = that.getCPButton(hiddenClass); | |
var loginButton = that.getLoginButton(hiddenClass); | |
buttonDivContent.push(cpButton); | |
buttonDivContent.push(loginButton); | |
CTX.basket.registerUpdateCallback(function () { | |
button.setObjAttr('text', getBasketContent()); | |
if (CTX.basket.count()) { | |
button.removeClass(hiddenClass); | |
} else { | |
button.addClass(hiddenClass); | |
} | |
if (/^\/mobile\/secure\/order\/confirmation/.test(CTX.request.path)) { | |
cpButton.removeClass(hiddenClass); | |
loginButton.addClass(hiddenClass); | |
} else if (/^\/mobile(\/index)?\/?$/.test(CTX.request.path)) { | |
if (false !== CTX.getUsernameLogin()) { | |
cpButton.removeClass(hiddenClass); | |
loginButton.addClass(hiddenClass); | |
} else { | |
loginButton.removeClass(hiddenClass); | |
cpButton.addClass(hiddenClass); | |
} | |
} | |
}); | |
buttonDivContent.push(CTX.widgets.button({ | |
text: [CTX.widgets.icon({ | |
subType: 'question' | |
}), ' Support'], | |
action: { | |
URI: { | |
path: '/mobile/support/index' | |
} | |
}, | |
className: 'ctx_button_medium ctx_button_flat ctx_button_header' | |
})); | |
buttonDivContent.push(CTX.widgets.button({ | |
text: [CTX.widgets.icon({ | |
subType: 'envelope' | |
}), ' WebMail'], | |
className: 'ctx_header_webmail-link ctx_button_medium ctx_button_flat ctx_button_header', | |
action: { | |
URI: { | |
path: '/login/', | |
port: null, | |
scheme: 'https', | |
host: 'webmail.123-reg.co.uk' | |
} | |
} | |
})); | |
content.push(CTX.widgets.block({ | |
subType: 'div', | |
content: [CTX.widgets.heading({ | |
level: 1, | |
text: [CTX.widgets.link({ | |
text: '123-reg.co.uk', | |
action: { | |
URI: { | |
path: '/mobile/index' | |
} | |
} | |
})], | |
className: 'ctx_header_logo' | |
}), that.getSearchForm(), CTX.widgets.block({ | |
subType: 'div', | |
content: buttonDivContent, | |
className: 'ctx_header_button-box' | |
})], | |
className: 'ctx_header_wrapper' | |
})); | |
return CTX.widgets.block({ | |
subType: 'div', | |
content: content, | |
className: 'ctx_header_wrapper-top' | |
}); | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function ChoiceList(objAttrs) { | |
this.objAttrs = objAttrs; | |
this.TODO = true; | |
} | |
CTX.classType.widgets.ChoiceList = ChoiceList; | |
CTX.helpers.extend(ChoiceList, CTX.abstract.widgets.Base); | |
ChoiceList.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var list; | |
var listItems = []; | |
$el = $('<div />'); | |
this.DOMElement = $el[0]; | |
this.objAttrs.choices.forEach(function (item) { | |
var link = { | |
text: item.content, | |
action: item.action | |
}; | |
if ('icon' in item) { | |
link.icon = item.icon; | |
} | |
listItems.push({ | |
content: CTX.widgets.link(link) | |
}); | |
}); | |
list = CTX.widgets.list({ | |
subType: 'unordered', | |
listItems: listItems | |
}); | |
$el.append(list.getDOMElement()); | |
return this.DOMElement; | |
}; | |
ChoiceList.prototype.isValid = function isValid() { | |
var returnVal = true; | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
if (!('choices' in this.objAttrs)) { | |
CTX.debug('ChoiceList requires choices passed'); | |
return false; | |
} | |
this.objAttrs.choices.forEach(function (item) { | |
if (!('content' in item)) { | |
returnVal = false; | |
CTX.debug('ChoiceList choices require content'); | |
return false; | |
} | |
if (!('action' in item)) { | |
returnVal = false; | |
CTX.debug('ChoiceList choices require an action'); | |
return false; | |
} | |
}); | |
return returnVal; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Notification(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.Notification = Notification; | |
CTX.helpers.extend(Notification, CTX.abstract.widgets.Base); | |
Notification.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var messageStructure; | |
$el = $('<div />'); | |
this.DOMElement = $el[0]; | |
this.addClass('ctx_notification_' + this.objAttrs.level); | |
messageStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.message); | |
$el.append(messageStructure.output()); | |
return true; | |
}; | |
Notification.prototype.isValid = function isValid() { | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
var validLevels = ['warning', 'error', 'info', 'success']; | |
if (!('level' in this.objAttrs)) { | |
return false; | |
} | |
if (validLevels.indexOf(this.objAttrs.level) === -1) { | |
return false; | |
} | |
if (!('message' in this.objAttrs)) { | |
return false; | |
} else { | |
var messageStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.message); | |
if (!(messageStructure.isValid())) { | |
return false; | |
} | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Indicator(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.Indicator = Indicator; | |
CTX.helpers.extend(Indicator, CTX.abstract.widgets.Base); | |
Indicator.prototype.attrVisitors = { | |
'number': function (value) { | |
var $el = $(this.DOMElement); | |
if (value > 9) { | |
value = '9*'; | |
} | |
$el.text(value); | |
}, | |
'level': function (value) { | |
this.addClass('badge-' + value); | |
} | |
}; | |
Indicator.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
$el = $('<span />'); | |
this.DOMElement = $el[0]; | |
this.visitObjAttrs(this.attrVisitors); | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function DomainSearchSection(objAttrs) { | |
this.objAttrs = objAttrs; | |
this.objAttrs.hostname = this.objAttrs.domainSearch.getHostname(); | |
this.defaults = { | |
searched: false, | |
autoSearch: false, | |
heading: 'Domains', | |
rowData: {}, | |
isOpen: false, | |
extensions: [], | |
searchCount: 0, | |
showHeading: true | |
}; | |
this.setDefaults(); | |
this.pushExtensionsToRowData(); | |
} | |
CTX.classType.widgets.DomainSearchSection = DomainSearchSection; | |
CTX.helpers.extend(DomainSearchSection, CTX.abstract.widgets.Base); | |
DomainSearchSection.prototype.pushExtensionsToRowData = function () { | |
var self = this; | |
this.objAttrs.extensionInfo.forEach(function (extension) { | |
var inBasket = false; | |
CTX.basket.getItems().forEach(function (item) { | |
if (item.product === 'Domain' || item.product === 'Centralnic 2 Letter Domain') { | |
if (item.extension === extension.name && item.hostname === self.objAttrs.hostname) { | |
inBasket = true; | |
} | |
} | |
}); | |
self.objAttrs.rowData[extension.name] = { | |
extension: extension.name, | |
name: self.objAttrs.hostname + extension.name, | |
extensionID: extension.extensionID, | |
availability: 'loading', | |
inBasket: inBasket, | |
promoText: extension.promoText || null | |
}; | |
self.objAttrs.extensions.push(extension.name); | |
}); | |
}; | |
DomainSearchSection.prototype.makeDOMElement = function makeDOMElement() { | |
var rows = this.createRows(); | |
var content = []; | |
if (this.objAttrs.showHeading) { | |
content.push(this.createHeading()); | |
} | |
content.push(rows); | |
this.DOMElement = CTX.widgets.block({ | |
content: content | |
}).getDOMElement(); | |
if (!this.objAttrs.isOpen) { | |
rows.hide(); | |
this.addClass('closed'); | |
if (!this.objAttrs.searched && this.objAttrs.autoSearch) { | |
this.toggleShow(); | |
} | |
} else { | |
this.removeClass('closed'); | |
} | |
return this.DOMElement; | |
}; | |
DomainSearchSection.prototype.createHeading = function () { | |
var that = this; | |
var heading = CTX.widgets.link({ | |
text: [CTX.widgets.heading({ | |
level: 3, | |
text: this.objAttrs.heading | |
}), CTX.widgets.block({ | |
content: this.objAttrs.extensions.join(', '), | |
className: 'ctx_domain-search-section_subheading' | |
})], | |
action: { | |
callback: function () { | |
that.toggleShow(); | |
} | |
}, | |
className: 'ctx_domain-search-section_heading' | |
}); | |
return heading; | |
}; | |
DomainSearchSection.prototype.createRows = function () { | |
var self = this; | |
var rows = []; | |
this.objAttrs.extensions.forEach(function (extension) { | |
var row = CTX.widgets.infoPod(self.getRowAttrs(extension)); | |
rows.push(row); | |
}); | |
var rowHolder = CTX.widgets.block({ | |
className: 'ctx_domain-search-section_body', | |
content: rows | |
}); | |
return rowHolder; | |
}; | |
DomainSearchSection.prototype.getRowAttrs = function (extension) { | |
var rowData = this.objAttrs.rowData[extension]; | |
var topRow = [CTX.widgets.text({ | |
text: CTX.helpers.domain.truncateHostname(this.objAttrs.hostname, 16) | |
}), CTX.widgets.text({ | |
text: extension, | |
className: 'extension' | |
})]; | |
if (!rowData.inBasket) { | |
topRow.push(CTX.widgets.text({ | |
text: rowData.availability, | |
className: 'availability right' | |
})); | |
} else { | |
topRow.push(CTX.widgets.text({ | |
text: 'In basket', | |
className: 'right' | |
})); | |
} | |
var attrs = { | |
className: ['ctx_domain-search-section_row', 'status-' + (rowData.inBasket ? 'basket' : rowData.availability), 'ctx_domain-search-section' + (rowData.extension).replace(/\./g, '_')], | |
content: [CTX.widgets.block({ | |
className: 'ctx_domain-search-section_row-top', | |
content: topRow | |
})] | |
}; | |
if (this.isAvailable(extension) && !rowData.inBasket) { | |
attrs.content.push(this.createBuyRow(rowData)); | |
} | |
if ('.uk' === extension) { | |
if (false === this.isAvailable(extension) || false === this.isAvailable('.co.uk')) { | |
attrs = {}; | |
} | |
} | |
return attrs; | |
}; | |
DomainSearchSection.prototype.createBuyRow = function (rowData) { | |
var that = this; | |
var extra = ''; | |
if ('.uk' === rowData.extension) { | |
extra = CTX.widgets.block({ | |
content: '*includes .co.uk' | |
}); | |
} | |
var buyRow = CTX.widgets.block({ | |
className: 'ctx_domain-search-section_row-bottom', | |
content: [CTX.widgets.form({ | |
content: [this.hiddenInput('extension', rowData.extension), this.hiddenInput('hostname', this.objAttrs.hostname), this.hiddenInput('product', 'Domain'), this.createPriceDropdown(rowData), this.createPromoText(rowData.promoText), CTX.widgets.button({ | |
text: 'ADD', | |
subType: 'submit', | |
className: 'btn-primary btn-add ctx_button_cta right' | |
}), extra], | |
callback: function (data) { | |
that.addToBasket.call(that, data); | |
} | |
})] | |
}); | |
return buyRow; | |
}; | |
DomainSearchSection.prototype.addToBasket = function (data) { | |
var that = this; | |
var rowData = this.objAttrs.rowData; | |
var ukAvailable = this.isAvailable('.uk'); | |
var coUkAvailable = this.isAvailable('.co.uk'); | |
var coUkSelect = CTX.getWidgetInstance($(this.DOMElement).find('.ctx_domain-search-section_co_uk .ctx_select-box')); | |
var coUkValue = false; | |
var ukSelect = CTX.getWidgetInstance($(this.DOMElement).find('.ctx_domain-search-section_uk .ctx_select-box')); | |
var ukValue = false; | |
if (coUkSelect) { | |
coUkValue = coUkSelect.getValue(); | |
} | |
if (ukSelect) { | |
ukValue = ukSelect.getValue(); | |
} | |
if ('.co.uk' === data.extension && true === ukAvailable && '[[.uk]]' === coUkValue) { | |
data.years = ukValue; | |
data = [data, { | |
extension: '.uk', | |
years: data.years, | |
product: 'Domain', | |
hostname: data.hostname | |
}]; | |
} | |
if ('.uk' === data.extension && true === coUkAvailable) { | |
data = [data, { | |
extension: '.co.uk', | |
years: data.years, | |
product: 'Domain', | |
hostname: data.hostname | |
}]; | |
} | |
CTX.basket.add(data, function () { | |
if ('array' === CTX.helpers.typeOf(data)) { | |
data.forEach(function (domain) { | |
rowData[domain.extension].inBasket = true; | |
}); | |
} else { | |
rowData[data.extension].inBasket = true; | |
} | |
that.rebuildElement(); | |
}); | |
}; | |
DomainSearchSection.prototype.hiddenInput = function (name, val) { | |
return CTX.widgets.input({ | |
subType: 'hidden', | |
name: name, | |
value: val | |
}); | |
}; | |
DomainSearchSection.prototype.isAvailable = function (extension) { | |
var rowData = this.objAttrs.rowData; | |
if (extension in rowData && 'availability' in rowData[extension] && 'available' === rowData[extension].availability) { | |
return true; | |
} | |
return false; | |
}; | |
DomainSearchSection.prototype.createPriceDropdown = function (rowData) { | |
var productId = 1; | |
var voucher = 3.99; | |
var priceObject; | |
var priceDropdownValues = []; | |
if ('hostname' in this.objAttrs && this.objAttrs.hostname.length === 2) { | |
productId = 258; | |
} | |
priceObject = CTX.productPrice.getPriceObject(productId, CTX.helpers.domain.getExtensionId(rowData.extension)); | |
var defaultYears = 1; | |
if ('domainProductInfo' in this.objAttrs && 'array' === CTX.helpers.typeOf(this.objAttrs.domainProductInfo)) { | |
this.objAttrs.domainProductInfo.forEach(function (domainDetails) { | |
if ('extension' in domainDetails && domainDetails.extension === rowData.extension) { | |
if ('defaultYears' in domainDetails) { | |
defaultYears = domainDetails.defaultYears; | |
} | |
} | |
}); | |
} | |
if ('.co.uk' === rowData.extension && '.uk' in this.objAttrs.rowData) { | |
priceDropdownValues.push(['[[.uk]]', 'Included with .UK']); | |
defaultYears = '[[.uk]]'; | |
} | |
if (null !== priceObject) { | |
Object.keys(priceObject.prices).forEach(function (months) { | |
var prices = priceObject.prices[months]; | |
var actualAmount; | |
var years; | |
var label; | |
if (isNaN(Number(months)) || !(1 in prices)) { | |
return false; | |
} | |
actualAmount = prices[1]; | |
years = months / 12; | |
if ('priceCategory' in rowData) { | |
actualAmount += CTX.productPrice.getPremium(rowData.priceCategory); | |
} | |
if ('.uk' === rowData.extension) { | |
actualAmount += CTX.productPrice.getPrice(productId, CTX.helpers.domain.getExtensionId('.co.uk'), months, 1); | |
actualAmount -= (voucher * (months / 12)); | |
} | |
label = years + ' ' + CTX.helpers.pluralise(years, 'year', 'years') + ' - ' + CTX.productPrice.getPriceString(actualAmount); | |
priceDropdownValues.push([years, label]); | |
}); | |
} | |
var priceDropdown = CTX.widgets.selectBox({ | |
name: 'years', | |
values: priceDropdownValues, | |
value: defaultYears | |
}); | |
return priceDropdown; | |
}; | |
DomainSearchSection.prototype.createPromoText = function (promoText) { | |
if (!promoText) { | |
return []; | |
} | |
if ('pre-order .uk' === promoText) { | |
return CTX.widgets.block({ | |
className: 'ctx_domain-search-section_guaranteed-pre-order', | |
path: '/library/bootstrap/img/uk-guaranteed-pre-order.png' | |
}); | |
} | |
return CTX.widgets.text({ | |
text: promoText, | |
className: 'ctx_domain-search-section_promo-text' | |
}); | |
}; | |
DomainSearchSection.prototype.toggleShow = function () { | |
var rows = $(this.DOMElement).find('.ctx_domain-search-section_body'); | |
if (this.objAttrs.isOpen) { | |
this.addClass('closed'); | |
rows.stop().slideUp(); | |
} else { | |
if (!this.objAttrs.searched) { | |
this.doSearch(); | |
} | |
this.removeClass('closed'); | |
rows.stop().slideDown(); | |
} | |
this.objAttrs.isOpen = !this.objAttrs.isOpen; | |
}; | |
DomainSearchSection.prototype.doSearch = function () { | |
var that = this; | |
this.objAttrs.domainSearch.getDomainExtensions({ | |
extensions: this.objAttrs.extensions | |
}, function (result) { | |
that.updateAvailability(result); | |
that.rebuildElement(); | |
}); | |
return true; | |
}; | |
DomainSearchSection.prototype.updateAvailability = function (result) { | |
if (this.objAttrs.rowData.hasOwnProperty(result.extension)) { | |
var status = result.status; | |
var match; | |
if (status === 'taken') { | |
status = 'unavailable'; | |
} | |
this.objAttrs.rowData[result.extension].availability = status; | |
if ('priceCategory' in result && 'null' !== CTX.helpers.typeOf(result.priceCategory)) { | |
match = result.priceCategory.match(/category([0-9]+)/); | |
if (null !== CTX.helpers.typeOf(match) && 2 >= match.length) { | |
this.objAttrs.rowData[result.extension].priceCategory = match[1]; | |
} | |
} | |
} | |
}; | |
DomainSearchSection.prototype.isValid = function () { | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
if (!('domainSearch' in this.objAttrs)) { | |
return false; | |
} | |
if (!('extensions' in this.objAttrs) || !$.isArray(this.objAttrs.extensions) || this.objAttrs.extensions.length === 0) { | |
return false; | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Loading(objAttrs) { | |
this.objAttrs = objAttrs; | |
this.TODO = true; | |
} | |
CTX.classType.widgets.Loading = Loading; | |
CTX.helpers.extend(Loading, CTX.abstract.widgets.Base); | |
Loading.prototype.makeDOMElement = function makeDOMElement() { | |
var blockStructure = { | |
subType: 'div', | |
content: [], | |
className: 'ctx_loading progress progress-striped active' | |
}; | |
blockStructure.content.push(CTX.widgets.block({ | |
subType: 'div', | |
content: '', | |
className: 'ctx_loading bar' | |
})); | |
this.DOMElement = CTX.widgets.block(blockStructure).getDOMElement(); | |
return this.DOMElement; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Link(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.Link = Link; | |
CTX.helpers.extend(Link, CTX.abstract.widgets.Base); | |
Link.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var that = this; | |
var linkUri; | |
$el = $('<a />'); | |
this.DOMElement = $el[0]; | |
this.addText(); | |
if ('URI' in this.objAttrs.action) { | |
if ('path' in this.objAttrs.action.URI) { | |
if (CTX.hasAction(this.objAttrs.action.URI.path)) { | |
$el.click(function (e) { | |
e.preventDefault(); | |
CTX.loadAction({ | |
URI: that.objAttrs.action.URI | |
}); | |
}); | |
} | |
} | |
linkUri = CTX.helpers.clearURIForWebRequest(this.objAttrs.action.URI); | |
var link = CTX.uriFor(linkUri); | |
if (CTX.helpers.shouldTargetBlankForUri(link)) { | |
$el.attr('target', '_blank'); | |
} | |
if (link !== null) { | |
this.setDOMAttr('href', link.toString()); | |
} else { | |
CTX.debug('Catalyst path not found in URI passed to link widget', this.objAttrs); | |
} | |
} | |
if ('callback' in this.objAttrs.action) { | |
var data = {}; | |
if ('data' in this.objAttrs.action) { | |
data = this.objAttrs.action.data; | |
} | |
var callback = this.objAttrs.action.callback; | |
$el.click(function (e) { | |
e.preventDefault(); | |
callback(e, data); | |
}); | |
} | |
if ('target' in this.objAttrs) { | |
$el.attr('target', this.objAttrs.target); | |
} | |
$el = undefined; | |
return true; | |
}; | |
Link.prototype.addText = function addText() { | |
var textStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.text); | |
var $el = $(this.DOMElement); | |
if ('icon' in this.objAttrs) { | |
$el.addClass('ctx_link_icon-link'); | |
$el.append(this.objAttrs.icon.getDOMElement()); | |
if ('text' in this.objAttrs) { | |
$el.append(' '); | |
} | |
$el.append(CTX.widgets.text({ | |
subType: 'span', | |
text: textStructure.output() | |
}).getDOMElement()); | |
} else { | |
$el.append(textStructure.output()); | |
} | |
return true; | |
}; | |
Link.prototype.isValid = function isValid() { | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
if (!('action' in this.objAttrs)) { | |
CTX.debug('No action passed to link widget'); | |
return false; | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function AddProductPod(objAttrs) { | |
this.objAttrs = objAttrs; | |
this.TODO = true; | |
} | |
CTX.classType.widgets.AddProductPod = AddProductPod; | |
CTX.helpers.extend(AddProductPod, CTX.abstract.widgets.Base); | |
AddProductPod.prototype.makeDOMElement = function makeDOMElement() { | |
var contentStructure = { | |
subType: 'div', | |
content: [], | |
className: 'ctx_add-product-pod_container' | |
}; | |
contentStructure.content.push(CTX.widgets.block({ | |
subType: 'div', | |
content: [CTX.widgets.icon({ | |
subType: this.objAttrs.icon | |
})], | |
className: 'ctx_add-product-pod_icon' | |
})); | |
if ('content' in this.objAttrs) { | |
contentStructure.content.push(this.objAttrs.content); | |
} | |
var widgetStructure = { | |
text: CTX.widgets.block(contentStructure) | |
}; | |
if ('action' in this.objAttrs) { | |
widgetStructure.action = this.objAttrs.action; | |
} | |
this.DOMElement = CTX.widgets.link(widgetStructure).getDOMElement(); | |
return this.DOMElement; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Block(objAttrs) { | |
this.objAttrs = objAttrs; | |
this.defaults = { | |
subType: 'div' | |
}; | |
} | |
CTX.classType.widgets.Block = Block; | |
CTX.helpers.extend(Block, CTX.abstract.widgets.Base); | |
Block.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var blockStructure; | |
$el = $('<' + this.objAttrs.subType + '/>'); | |
this.DOMElement = $el[0]; | |
if ('content' in this.objAttrs) { | |
blockStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.content); | |
$el.append(blockStructure.output()); | |
blockStructure = undefined; | |
} | |
return this.DOMElement; | |
}; | |
Block.prototype.isValid = function isValid() { | |
var blockStructure; | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
var validTypes = ['div', 'p', 'aside', 'br', 'header', 'nav', 'footer', 'section', 'ul', 'ol', 'li', 'fieldset', 'table', 'tr', 'td', 'th']; | |
if (this.objAttrs.subType === 'br' && ('content' in this.objAttrs)) { | |
return false; | |
} | |
if ('content' in this.objAttrs) { | |
blockStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.content); | |
if (!(blockStructure.isValid())) { | |
return false; | |
} | |
} | |
if ('object' === CTX.helpers.typeOf(this.objAttrs)) { | |
if ('subType' in this.objAttrs) { | |
if (validTypes.indexOf(this.objAttrs.subType) > -1) { | |
return true; | |
} | |
} | |
} | |
return false; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function ChoiceBox(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.ChoiceBox = ChoiceBox; | |
CTX.helpers.extend(ChoiceBox, CTX.abstract.widgets.FormElement); | |
ChoiceBox.prototype.attrVisitors = { | |
'value': function (value) { | |
this.setValue(value); | |
} | |
}; | |
ChoiceBox.prototype.makeDOMElement = function makeDOMElement() { | |
var $el = $('<div>'); | |
var $choice; | |
var that = this; | |
this.visitObjAttrs(this.attrVisitors); | |
this.DOMElement = $el[0]; | |
if ('choices' in this.objAttrs) { | |
this.objAttrs.choices.forEach(function (item, i) { | |
var contentStructure; | |
$choice = $('<div />'); | |
$choice.addClass('ctx_choice-box_choice'); | |
if (item.value === that.value) { | |
$choice.addClass('ctx_choice-box_selected'); | |
} | |
$choice.data('value', item.value); | |
if ('recommended' in item && item.recommended === true) { | |
$choice.append('<div class="ctx_choice-recommended">Recommended</div>'); | |
} | |
contentStructure = new CTX.dataStructure.widgets.Content(item.content); | |
$choice.append(contentStructure.output()); | |
if (i % 2) { | |
$choice.addClass('ctx_choice-box_even'); | |
$el.append('<div class="ctx_choice-box_or">OR</div>'); | |
} else { | |
$choice.addClass('ctx_choice-box_odd'); | |
} | |
$choice.click(function () { | |
that.setValue(item.value); | |
}); | |
$el.append($choice); | |
}); | |
} | |
this.registerOnChangeCallback(function (value) { | |
$(that.DOMElement).find('.ctx_choice-box_choice').each(function (i, el) { | |
var $el = $(el); | |
if ($el.data('value') === value) { | |
$el.addClass('ctx_choice-box_selected'); | |
} else { | |
$el.removeClass('ctx_choice-box_selected'); | |
} | |
}); | |
}); | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Tag(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.Tag = Tag; | |
CTX.helpers.extend(Tag, CTX.abstract.widgets.Base); | |
Tag.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var textStructure; | |
$el = $('<span />'); | |
this.DOMElement = $el[0]; | |
if ('text' in this.objAttrs) { | |
textStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.text); | |
$el.append(textStructure.output()); | |
} | |
this.addClass('label'); | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function FormModal(objAttrs) { | |
this.objAttrs = objAttrs; | |
this.TODO = true; | |
} | |
CTX.classType.widgets.FormModal = FormModal; | |
CTX.helpers.extend(FormModal, CTX.abstract.widgets.Base); | |
FormModal.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var modalArgs = {}; | |
$el = $('<div />'); | |
this.DOMElement = $el[0]; | |
if ('headerContent' in this.objAttrs) { | |
modalArgs.headerContent = this.objAttrs.headerContent; | |
} | |
modalArgs.bodyContent = [this.objAttrs.form]; | |
if ('footerContent' in this.objAttrs) { | |
modalArgs.footerContent = this.objAttrs.footerContent; | |
} | |
if ('closeButton' in this.objAttrs) { | |
modalArgs.closeButton = this.objAttrs.closeButton; | |
} | |
$el.append(CTX.widgets.modal(modalArgs).getDOMElement()); | |
return this.DOMElement; | |
}; | |
FormModal.prototype.isValid = function isValid() { | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
if (!('form' in this.objAttrs)) { | |
CTX.debug('FormModal requires a form to be set', this.objAttrs); | |
return false; | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function ResultTable(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.ResultTable = ResultTable; | |
CTX.helpers.extend(ResultTable, CTX.abstract.widgets.Base); | |
ResultTable.prototype.makeDOMElement = function makeDOMElement() { | |
var that = this; | |
this.table = CTX.widgets.table(this.returnTable()); | |
this.DOMElement = this.table.getDOMElement(); | |
this.registerUpdateCallback(function () { | |
that.table.clearAllHeadContainers(); | |
that.table.addNewContainer(that.returnHead()); | |
that.table.clearAllBodyContainers(); | |
that.table.addNewContainer(that.returnBody(false)); | |
}); | |
}; | |
ResultTable.prototype.returnHead = function returnHead() { | |
var that = this; | |
var headCells = []; | |
this.objAttrs.columns.forEach(function (cell) { | |
var newCell = CTX.helpers.clone(cell); | |
var cellOutput = {}; | |
var sortIcon = 'sort'; | |
var sortDirection = 'none'; | |
if (newCell.content === null) { | |
newCell.content = ''; | |
} | |
if (!('sortable' in cell) || cell.sortable === true) { | |
if (cell.dataId === that.objAttrs.resultSetHandler.sortColumn) { | |
sortDirection = 'down'; | |
if (that.objAttrs.resultSetHandler.sortOrder === 'desc') { | |
sortDirection = 'up'; | |
} | |
} | |
newCell.content = [CTX.widgets.link({ | |
action: { | |
callback: function () { | |
that.setSort(cell.dataId); | |
} | |
}, | |
text: [newCell.content, CTX.widgets.icon({ | |
subType: sortIcon | |
})], | |
className: 'ctx_result-table_sort-' + sortDirection | |
})]; | |
} | |
cellOutput.content = newCell.content; | |
if ('className' in newCell) { | |
cellOutput.className = newCell.className; | |
} | |
headCells.push(cellOutput); | |
cellOutput = undefined; | |
}); | |
return { | |
subType: 'head', | |
rows: [{ | |
cells: headCells | |
}] | |
}; | |
}; | |
ResultTable.prototype.tooManyRows = function () { | |
CTX.scrollTop(); | |
}; | |
ResultTable.prototype.fillerRows = function fillerRows(rowsRemaining, showLoading) { | |
var that = this; | |
var rowCells = []; | |
if (rowsRemaining > 6 && showLoading !== true) { | |
this.tooManyRows(); | |
} | |
for (var i = 0; i < rowsRemaining; i += 1) { | |
var cellOutput = { | |
colspan: that.objAttrs.columns.length, | |
className: 'ctx_result-table_filler-cell', | |
content: '' | |
}; | |
if (showLoading === true && i === (Math.floor(rowsRemaining / 2) - 1)) { | |
cellOutput.content = [CTX.widgets.loading({})]; | |
} | |
rowCells.push({ | |
cells: [cellOutput] | |
}); | |
} | |
return rowCells; | |
}; | |
ResultTable.prototype.returnBody = function returnBody(showLoading) { | |
var that = this; | |
var bodyRows = []; | |
var data = this.objAttrs.resultSetHandler.all(); | |
var resultSet = this.objAttrs.resultSetHandler; | |
var rows; | |
if (data !== null && showLoading === false) { | |
data.forEach(function (row) { | |
var rowData; | |
var rowOutput = { | |
cells: [] | |
}; | |
that.objAttrs.columns.forEach(function (cell) { | |
var outputCell = that.processFilter(row, cell.dataId); | |
if (outputCell) { | |
rowOutput.cells.push(outputCell); | |
outputCell = undefined; | |
} | |
}); | |
rowData = that.processRowFilter(row); | |
rowOutput = $.extend(rowData, rowOutput); | |
bodyRows.push(rowOutput); | |
rowOutput = undefined; | |
}); | |
} | |
if (bodyRows.length < resultSet.pageLength) { | |
rows = this.fillerRows(resultSet.pageLength - bodyRows.length, showLoading); | |
bodyRows = bodyRows.concat(rows); | |
} | |
return { | |
subType: 'body', | |
rows: bodyRows | |
}; | |
}; | |
ResultTable.prototype.returnTable = function returnTable() { | |
var tableData = []; | |
var headings = []; | |
this.objAttrs.columns.forEach(function (column) { | |
headings.push(column.content); | |
}); | |
tableData.push(this.returnHead()); | |
tableData.push(this.returnBody(true)); | |
return { | |
columnHeadings: headings, | |
container: tableData | |
}; | |
}; | |
ResultTable.prototype.isValid = function isValid() { | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
var result = true; | |
if ('container' in this.objAttrs) { | |
this.objAttrs.container.forEach(function (tableContainer) { | |
var validTableFormat = new CTX.dataStructure.widgets.TableContainer(tableContainer); | |
if (!validTableFormat.isValid()) { | |
result = false; | |
} | |
}); | |
} else { | |
result = false; | |
} | |
return result; | |
}; | |
ResultTable.prototype.processFilter = function (data, cellId) { | |
var cell = { | |
content: '' | |
}; | |
var newData = CTX.helpers.clone(data); | |
var columnFilters; | |
if ('columnFilters' in this.objAttrs) { | |
if (cellId in this.objAttrs.columnFilters && 'content' in this.objAttrs.columnFilters[cellId]) { | |
columnFilters = this.objAttrs.columnFilters[cellId]; | |
for (var filterId in columnFilters) { | |
if (columnFilters.hasOwnProperty(filterId)) { | |
cell[filterId] = columnFilters[filterId](newData); | |
if (filterId === 'colspan' && cell[filterId] === 0) { | |
return null; | |
} | |
} | |
} | |
} | |
} | |
if (cell.content === '' && cellId in data) { | |
cell.content = data[cellId]; | |
} | |
return cell; | |
}; | |
ResultTable.prototype.processRowFilter = function (data) { | |
var options = {}; | |
var output; | |
if ('rowFilters' in this.objAttrs) { | |
for (var key in this.objAttrs.rowFilters) { | |
if (this.objAttrs.rowFilters.hasOwnProperty(key)) { | |
output = this.objAttrs.rowFilters[key](data); | |
if (output !== null) { | |
options[key] = output; | |
} | |
} | |
} | |
} | |
return options; | |
}; | |
ResultTable.prototype.onLoad = function onLoad() { | |
this.getPage(); | |
}; | |
ResultTable.prototype.clearPage = function clearPage() { | |
var that = this; | |
that.table.clearAllBodyContainers(); | |
that.table.addNewContainer(that.returnBody(true)); | |
}; | |
ResultTable.prototype.getPage = function getPage() { | |
var that = this; | |
this.clearPage(); | |
this.objAttrs.resultSetHandler.getPage(function () { | |
that.fireUpdateCallbacks(); | |
}); | |
}; | |
ResultTable.prototype.setPageLength = function setPageLength(pageLength) { | |
this.objAttrs.resultSetHandler.setPageLength(pageLength); | |
this.getPage(); | |
}; | |
ResultTable.prototype.setSort = function setSort(columnId, order) { | |
this.objAttrs.resultSetHandler.setSort(columnId, order); | |
this.getPage(); | |
}; | |
ResultTable.prototype.setSearch = function setSearch(term) { | |
this.objAttrs.resultSetHandler.setSearch(term); | |
this.getPage(); | |
}; | |
ResultTable.prototype.registerUpdateCallback = function (callback) { | |
if (!this.updateCallbacks) { | |
this.updateCallbacks = []; | |
} | |
this.updateCallbacks.push(callback); | |
return true; | |
}; | |
ResultTable.prototype.fireUpdateCallbacks = function () { | |
var pageInfo = this.getCurrentPageInfo(); | |
if (this.updateCallbacks) { | |
this.updateCallbacks.forEach(function (callback) { | |
callback(pageInfo); | |
}); | |
} | |
return true; | |
}; | |
ResultTable.prototype.getSortableColumns = function getSortableColumns() { | |
var sortableColumns = []; | |
this.objAttrs.columns.forEach(function (cell) { | |
var sortable = true; | |
if ('sortable' in cell) { | |
sortable = cell.sortable; | |
} | |
if ('content' in cell && sortable === true) { | |
sortableColumns.push([cell.dataId, cell.content]); | |
} | |
}); | |
return sortableColumns; | |
}; | |
ResultTable.prototype.getCurrentPageInfo = function getCurrentPageInfo() { | |
var settingsObject = {}; | |
settingsObject.namespace = this.objAttrs.resultSetHandler.tableNamespace; | |
settingsObject.pageLength = this.objAttrs.resultSetHandler.pageLength; | |
settingsObject.page = this.objAttrs.resultSetHandler.currentPage; | |
settingsObject.pages = Math.ceil(this.objAttrs.resultSetHandler.totalDisplayRecords / this.objAttrs.resultSetHandler.pageLength); | |
return settingsObject; | |
}; | |
ResultTable.prototype.setPage = function setPage(page) { | |
var pageInfo = this.getCurrentPageInfo(); | |
if (page === 'next') { | |
if (pageInfo.page < pageInfo.pages) { | |
this.objAttrs.resultSetHandler.currentPage += 1; | |
} | |
} else if (page === 'previous') { | |
if (pageInfo.page > 1) { | |
this.objAttrs.resultSetHandler.currentPage -= 1; | |
} | |
} else { | |
if (/^[0-9]+$/.test(page) && 1 <= page && pageInfo.pages >= page) { | |
this.objAttrs.resultSetHandler.currentPage = page; | |
} | |
} | |
this.getPage(); | |
}; | |
ResultTable.prototype.isValid = function isValid() { | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
if (!('columns' in this.objAttrs)) { | |
return false; | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Heading(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.Heading = Heading; | |
CTX.helpers.extend(Heading, CTX.abstract.widgets.Base); | |
Heading.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var textStructure; | |
$el = $('<h' + this.objAttrs.level + ' />'); | |
this.DOMElement = $el[0]; | |
textStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.text); | |
$el.append(textStructure.output()); | |
return true; | |
}; | |
Heading.prototype.isValid = function isValid() { | |
var textStructure; | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
if (!('level' in this.objAttrs)) { | |
return false; | |
} | |
if (!(/^[1-6]$/.test(this.objAttrs.level))) { | |
return false; | |
} | |
textStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.text); | |
if (!(textStructure.isValid())) { | |
return false; | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function PageContainer(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.PageContainer = PageContainer; | |
CTX.helpers.extend(PageContainer, CTX.abstract.widgets.Base); | |
PageContainer.prototype.makeDOMElement = function makeDOMElement() { | |
var contentStructure = []; | |
var contentOutput = []; | |
if ('content' in this.objAttrs) { | |
contentStructure = this.objAttrs.content; | |
} | |
contentOutput.push(CTX.widgets.block({ | |
subType: 'div', | |
content: [CTX.widgets.header({}), CTX.widgets.block({ | |
content: contentStructure, | |
className: 'ctx_page-container_body' | |
}), CTX.widgets.block({ | |
subType: 'div', | |
content: '', | |
className: 'ctx_clear-footer' | |
})], | |
className: 'ctx_page-container_wrapper-main' | |
})); | |
contentOutput.push(CTX.widgets.footer({})); | |
this.DOMElement = CTX.widgets.block({ | |
subType: 'section', | |
content: contentOutput | |
}).getDOMElement(); | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Text(objAttrs) { | |
this.objAttrs = objAttrs; | |
this.defaults = { | |
subType: 'span' | |
}; | |
} | |
CTX.classType.widgets.Text = Text; | |
CTX.helpers.extend(Text, CTX.abstract.widgets.Base); | |
Text.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var textStructure; | |
$el = $('<' + this.objAttrs.subType + '/>'); | |
this.DOMElement = $el[0]; | |
textStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.text); | |
$el.append(textStructure.output()); | |
return this.DOMElement; | |
}; | |
Text.prototype.isValid = function isValid() { | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
var validTypes = ['strong', 'em', 'code', 's', 'cite', 'span', 'legend']; | |
if (!('text' in this.objAttrs)) { | |
return false; | |
} | |
var textStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.text); | |
if (!(textStructure.isValid())) { | |
return false; | |
} | |
if ('object' === CTX.helpers.typeOf(this.objAttrs)) { | |
if ('subType' in this.objAttrs) { | |
if (validTypes.indexOf(this.objAttrs.subType) > -1) { | |
return true; | |
} | |
} | |
} | |
return false; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Button(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.Button = Button; | |
CTX.helpers.extend(Button, CTX.abstract.widgets.Base); | |
Button.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var textStructure; | |
if ('subType' in this.objAttrs && this.objAttrs.subType === 'submit') { | |
$el = $('<input />'); | |
$el.attr('type', 'submit'); | |
if ('text' in this.objAttrs) { | |
$el.attr('value', this.objAttrs.text); | |
} | |
} else { | |
$el = $('<a />'); | |
if ('text' in this.objAttrs) { | |
textStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.text); | |
$el.html(textStructure.output()); | |
} | |
} | |
this.DOMElement = $el[0]; | |
if (!('subType' in this.objAttrs || this.objAttrs.subType === 'submit')) { | |
if ('icon' in this.objAttrs) { | |
if ('text' in this.objAttrs) { | |
$el.prepend(' '); | |
} | |
$el.prepend(this.objAttrs.icon.getDOMElement()); | |
} | |
if ('action' in this.objAttrs && 'URI' in this.objAttrs.action) { | |
var link = CTX.uriFor($.extend({}, this.objAttrs.action.URI)); | |
if (!('target' in this.objAttrs) && CTX.helpers.shouldTargetBlankForUri(link)) { | |
this.objAttrs.target = '_blank'; | |
} | |
$el.attr('href', link.toString()); | |
} | |
if ('target' in this.objAttrs) { | |
$el.attr('target', this.objAttrs.target); | |
} | |
} | |
if ('action' in this.objAttrs) { | |
this.addCallback(); | |
} | |
return true; | |
}; | |
Button.prototype.addCallback = function () { | |
var $el = $(this.DOMElement); | |
var data = {}; | |
var that = this; | |
if ('URI' in this.objAttrs.action) { | |
if ('path' in this.objAttrs.action.URI) { | |
if (CTX.hasAction(this.objAttrs.action.URI.path)) { | |
$el.click(function (e) { | |
e.preventDefault(); | |
CTX.loadAction(that.objAttrs.action); | |
}); | |
} | |
} | |
} | |
if ('callback' in this.objAttrs.action) { | |
if ('data' in this.objAttrs.action) { | |
data = this.objAttrs.action.data; | |
} | |
var callback = this.objAttrs.action.callback; | |
$el.click(function (e) { | |
callback(e, data); | |
}); | |
} | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function ResultTableControls(objAttrs) { | |
this.objAttrs = objAttrs; | |
this.TODO = true; | |
this.columnSelect = null; | |
this.tableInstance = null; | |
this.pageLinks = ''; | |
this.perPages = ''; | |
this.exportButtons = ''; | |
this.defaults = { | |
exportButtons: false, | |
pageLengthControls: true, | |
pageLinks: true, | |
sorting: true | |
}; | |
} | |
CTX.classType.widgets.ResultTableControls = ResultTableControls; | |
CTX.helpers.extend(ResultTableControls, CTX.abstract.widgets.Base); | |
ResultTableControls.prototype.makeDOMElement = function makeDOMElement() { | |
var that = this; | |
var $el; | |
var content = []; | |
var contentStructure; | |
var selectBox; | |
$el = $('<div />'); | |
this.DOMElement = $el[0]; | |
selectBox = CTX.widgets.selectBox({ | |
placeholder: 'Sort by', | |
values: [], | |
className: 'ctx_result-table-controls_column-select' | |
}); | |
selectBox.registerOnChangeCallback(function (value) { | |
that.setSort(value); | |
}); | |
this.columnSelect = CTX.widgets.form({ | |
content: [selectBox], | |
className: 'ctx_result-table-controls_sort-by' | |
}); | |
content.push(this.columnSelect); | |
if (this.objAttrs.pageLinks === true) { | |
this.pageLinks = CTX.widgets.block({ | |
subType: 'div', | |
content: this.generatePageLinks(), | |
className: 'ctx_result-table-controls_page-links' | |
}); | |
} | |
if (this.objAttrs.pageLengthControls === true) { | |
this.perPages = CTX.widgets.block({ | |
subType: 'div', | |
content: this.generatePerPage(), | |
className: 'ctx_result-table-controls_per-pages' | |
}); | |
} | |
if (this.objAttrs.exportButtons === true) { | |
this.exportButtons = CTX.widgets.block({ | |
subType: 'div', | |
content: this.generateExportButtons(), | |
className: 'ctx_result-table-controls_export-buttons' | |
}); | |
} | |
content.push(this.pageLinks); | |
content.push(this.perPages); | |
content.push(this.exportButtons); | |
contentStructure = new CTX.dataStructure.widgets.Content(content); | |
$el.append(contentStructure.output()); | |
return this.DOMElement; | |
}; | |
ResultTableControls.prototype.generatePageLinks = function (pageInfo) { | |
var that = this; | |
var pageLinks = []; | |
var getURI = function (page) { | |
var URI = {}; | |
if (pageInfo && 'namespace' in pageInfo) { | |
URI.params = {}; | |
var pageKey = pageInfo.namespace + '.paging.start'; | |
URI.params[pageKey] = page; | |
} | |
return URI; | |
}; | |
var pageLoopMethod = function (page) { | |
var pageClass = ''; | |
if (pageInfo.page === page) { | |
pageClass = 'ctx_result-table-controls_current-page'; | |
} | |
pageLinks.push(CTX.widgets.link({ | |
text: page, | |
action: { | |
callback: function () { | |
that.setPage(page); | |
}, | |
URI: getURI(page) | |
}, | |
className: pageClass | |
})); | |
}; | |
if (pageInfo && pageInfo.pages > 1) { | |
pageLinks.push(CTX.widgets.link({ | |
text: 'Prev page', | |
action: { | |
callback: function () { | |
that.setPage('previous'); | |
}, | |
URI: getURI(pageInfo.page - 1) | |
} | |
})); | |
var maxPagesShown = 5; | |
var pagerStartPage = 1; | |
var middleDistanceDown = Math.floor(maxPagesShown / 2); | |
var middleDistanceUp = middleDistanceDown; | |
if ((maxPagesShown / 2) === middleDistanceDown) { | |
middleDistanceDown -= 1; | |
} | |
var lowestDisplayPage = pagerStartPage; | |
var highestDisplayPage = pagerStartPage; | |
if ((pageInfo.pages - pagerStartPage) <= maxPagesShown) { | |
lowestDisplayPage = pagerStartPage; | |
highestDisplayPage = pageInfo.pages; | |
} else if (pageInfo.page <= (pagerStartPage + middleDistanceDown)) { | |
lowestDisplayPage = pagerStartPage; | |
highestDisplayPage = pagerStartPage + maxPagesShown - 1; | |
} else if (pageInfo.page >= (pageInfo.pages - middleDistanceUp)) { | |
lowestDisplayPage = pageInfo.pages - maxPagesShown + 1; | |
highestDisplayPage = pageInfo.pages; | |
} else { | |
lowestDisplayPage = pageInfo.page - middleDistanceDown; | |
highestDisplayPage = pageInfo.page + middleDistanceUp; | |
} | |
for (var i = lowestDisplayPage; i <= highestDisplayPage; i += 1) { | |
pageLoopMethod(i); | |
} | |
pageLinks.push(CTX.widgets.link({ | |
text: 'Next page', | |
action: { | |
callback: function () { | |
that.setPage('next'); | |
}, | |
URI: getURI(pageInfo.page + 1) | |
} | |
})); | |
return pageLinks; | |
} else { | |
return ''; | |
} | |
}; | |
ResultTableControls.prototype.generatePerPage = function (pageInfo) { | |
var perPage = []; | |
var selectBox; | |
var that = this; | |
var options = [10, 20, 50, 100, 150]; | |
var showingOptions = []; | |
if (pageInfo) { | |
perPage.push(CTX.widgets.text({ | |
text: 'Show' | |
})); | |
options.forEach(function (option) { | |
if (!('pageLengthLimit' in that.objAttrs) || that.objAttrs.pageLengthLimit > option) { | |
showingOptions.push([option, option.toString()]); | |
} | |
}); | |
selectBox = CTX.widgets.selectBox({ | |
value: pageInfo.pageLength, | |
values: showingOptions | |
}); | |
var selectInitCounter = 0; | |
selectBox.registerOnChangeCallback(function (value) { | |
if (selectInitCounter > 1) { | |
that.setPageLength(value); | |
} | |
selectInitCounter += 1; | |
}); | |
perPage.push(selectBox); | |
perPage.push(CTX.widgets.text({ | |
text: 'Per page' | |
})); | |
return perPage; | |
} | |
return ''; | |
}; | |
ResultTableControls.prototype.setPageLength = function (length) { | |
if (this.loadTable() !== null) { | |
this.tableInstance.setPageLength(length); | |
} | |
}; | |
ResultTableControls.prototype.generateExportButtons = function () { | |
if ('exportButtons' in this.objAttrs && this.objAttrs.exportButtons === true) { | |
var content = []; | |
content.push(CTX.widgets.link({ | |
text: 'Download entire list as a CSV', | |
icon: CTX.widgets.icon({ | |
subType: 'file-text' | |
}), | |
action: { | |
URI: { | |
params: { | |
'content-type': 'text/csv' | |
} | |
} | |
} | |
})); | |
return content; | |
} | |
return ''; | |
}; | |
ResultTableControls.prototype.setPage = function setPage(page) { | |
if (this.loadTable() !== null) { | |
this.tableInstance.setPage(page); | |
} | |
return false; | |
}; | |
ResultTableControls.prototype.setSort = function setSort(sort, order) { | |
if (this.loadTable() !== null) { | |
this.tableInstance.setSort(sort, order); | |
} | |
return false; | |
}; | |
ResultTableControls.prototype.loadTable = function loadTable() { | |
var $tableElement; | |
if (this.tableInstance !== null) { | |
return this.tableInstance; | |
} | |
if ('tableID' in this.objAttrs) { | |
$tableElement = $('#' + this.objAttrs.tableID); | |
if ($tableElement) { | |
this.tableInstance = CTX.getWidgetInstance($tableElement); | |
return this.tableInstance; | |
} else { | |
CTX.debug('Result table controls could not find a table with supplied ID', this.objAttrs); | |
return null; | |
} | |
} | |
return null; | |
}; | |
ResultTableControls.prototype.onLoad = function onLoad() { | |
var that = this; | |
if (this.loadTable() !== null) { | |
this.getSortableColumns(); | |
this.tableInstance.registerUpdateCallback(function (pageInfo) { | |
that.updateFromPageInfo.call(that, pageInfo); | |
}); | |
} | |
}; | |
ResultTableControls.prototype.getCurrentPageInfo = function () { | |
var pageInfo; | |
if (this.loadTable() !== null) { | |
pageInfo = this.tableInstance.getCurrentPageInfo(); | |
this.updateFromPageInfo(pageInfo); | |
return pageInfo; | |
} | |
return null; | |
}; | |
ResultTableControls.prototype.updateFromPageInfo = function (pageInfo) { | |
CTX.info('updatingFrom pageInfo', pageInfo); | |
if (this.pageLinks !== null && this.objAttrs.pageLinks === true) { | |
this.pageLinks.setObjAttr('content', this.generatePageLinks(pageInfo)); | |
} | |
if (this.objAttrs.pageLengthControls === true) { | |
this.perPages.setObjAttr('content', this.generatePerPage(pageInfo)); | |
} | |
if (this.objAttrs.exportButtons === true) { | |
this.exportButtons.setObjAttr('content', this.generateExportButtons(pageInfo)); | |
} | |
}; | |
ResultTableControls.prototype.getSortableColumns = function () { | |
if (this.loadTable() !== null) { | |
var $tableSelect = $(this.DOMElement).find('.ctx_result-table-controls_column-select'); | |
var sortableColumns; | |
var selectInstance = CTX.getWidgetInstance($tableSelect); | |
if (this.tableInstance && $tableSelect && selectInstance) { | |
sortableColumns = this.tableInstance.getSortableColumns(); | |
selectInstance.setObjAttr('values', sortableColumns); | |
return sortableColumns; | |
} | |
} | |
return null; | |
}; | |
ResultTableControls.prototype.isValid = function isValid() { | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
if (!('tableID' in this.objAttrs)) { | |
return false; | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function MenuButton(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.MenuButton = MenuButton; | |
CTX.helpers.extend(MenuButton, CTX.abstract.widgets.Base); | |
MenuButton.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var $menu; | |
var $item; | |
var callback = function () {}; | |
var iconObj; | |
var linkObj; | |
var icon = null; | |
if ('icon' in this.objAttrs) { | |
icon = this.objAttrs.icon; | |
} else { | |
icon = CTX.widgets.icon({ | |
subType: 'menu' | |
}); | |
} | |
var button = { | |
className: ['dropdown-toggle'], | |
icon: icon, | |
action: { | |
href: '#', | |
callback: callback | |
}, | |
data: { | |
toggle: 'dropdown' | |
} | |
}; | |
if ('text' in this.objAttrs) { | |
button.text = this.objAttrs.text; | |
} | |
if ('buttonClassName' in this.objAttrs) { | |
button.className = button.className.concat(this.objAttrs.buttonClassName); | |
} | |
$el = $('<span />'); | |
this.DOMElement = $el[0]; | |
iconObj = new CTX.widgets.button(button); | |
$el.append(iconObj.getDOMElement()); | |
$menu = $('<ul class="ctx_menu-button_dropdown dropdown-menu" />'); | |
$.each(this.objAttrs.actions, function (i, item) { | |
$item = $('<li />'); | |
if ('text' in item) { | |
linkObj = new CTX.widgets.link(item); | |
$item.append(linkObj.getDOMElement()); | |
} else { | |
$item.addClass('divider'); | |
} | |
$menu.append($item); | |
}); | |
$el.append($menu); | |
$menu = undefined; | |
return true; | |
}; | |
MenuButton.prototype.onLoad = function () { | |
$(this.DOMElement).find('[data-toggle="dropdown"]').dropdown(); | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function PageRow(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.PageRow = PageRow; | |
CTX.helpers.extend(PageRow, CTX.abstract.widgets.Base); | |
PageRow.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var $cell; | |
$el = $('<section />'); | |
this.DOMElement = $el[0]; | |
this.addClass('row-fluid'); | |
if ('cells' in this.objAttrs) { | |
this.objAttrs.cells.forEach(function (cell) { | |
var contentStructure = new CTX.dataStructure.widgets.Content(cell.content); | |
$cell = $('<div />'); | |
$cell.append(contentStructure.output()); | |
$el.append($cell); | |
if (!('colspan' in cell)) { | |
cell.colspan = 1; | |
} | |
$cell.addClass('span' + cell.colspan.toString()); | |
$cell.addClass('ctx_page-row_cell'); | |
if ('className' in cell) { | |
$cell.addClass(cell.className); | |
} | |
}); | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function ProgressBar(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.ProgressBar = ProgressBar; | |
CTX.helpers.extend(ProgressBar, CTX.abstract.widgets.Base); | |
ProgressBar.prototype.attrVisitors = { | |
level: function (value) { | |
var divisibleMax = this.objAttrs.max; | |
if (this.objAttrs.min !== 1) { | |
divisibleMax = this.objAttrs.max - this.objAttrs.min; | |
} | |
$(this.DOMElement).find('.bar').css('width', value / divisibleMax * 100 + '%'); | |
} | |
}; | |
ProgressBar.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var textStructure; | |
$el = $('<div />'); | |
this.DOMElement = $el[0]; | |
$el.append('<div class="progress"><div class="bar" ></div></div> '); | |
textStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.label); | |
$el.append(textStructure.output()); | |
this.visitObjAttrs(this.attrVisitors); | |
return true; | |
}; | |
ProgressBar.prototype.isValid = function () { | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
if (typeof this.objAttrs === 'undefined') { | |
return false; | |
} | |
if (!('max' in this.objAttrs)) { | |
return false; | |
} | |
if (!('min' in this.objAttrs)) { | |
return false; | |
} | |
if (!('level' in this.objAttrs)) { | |
return false; | |
} | |
if (!('label' in this.objAttrs)) { | |
return false; | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Form(objAttrs) { | |
this.objAttrs = objAttrs; | |
this.defaults = { | |
value: {}, | |
dynamicRequest: true | |
}; | |
this.TODO = true; | |
} | |
CTX.classType.widgets.Form = Form; | |
CTX.helpers.extend(Form, CTX.abstract.widgets.Base); | |
Form.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var contentStructure; | |
var action; | |
var that = this; | |
var actionURI; | |
$el = $('<form />'); | |
if (this.objAttrs.dynamicRequest === true) { | |
$el.submit(function (e) { | |
that.handleFormSubmit(e); | |
}); | |
} | |
this.DOMElement = $el[0]; | |
if ('action' in this.objAttrs && 'URI' in this.objAttrs.action) { | |
actionURI = CTX.helpers.clearURIForWebRequest(this.objAttrs.action.URI); | |
action = CTX.uriFor(actionURI); | |
if (CTX.helpers.shouldTargetBlankForUri(action)) { | |
$el.attr('target', '_blank'); | |
} | |
if (action !== null) { | |
this.setDOMAttr('action', action.toString()); | |
} else { | |
CTX.debug('Catalyst path not found in URI passed to form widget', this.objAttrs); | |
} | |
} | |
if ('action' in this.objAttrs && 'transportMethod' in this.objAttrs.action) { | |
$el.attr('method', this.objAttrs.action.transportMethod); | |
} | |
if ('formHandler' in this.objAttrs) { | |
if (this.objAttrs.formHandler.idValid()) { | |
contentStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.formHandler.output()); | |
} | |
} else if ('content' in this.objAttrs) { | |
contentStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.content); | |
} | |
$el.append(contentStructure.output()); | |
if ('cstoken' in window && 'action' in this.objAttrs && 'transportMethod' in this.objAttrs.action && this.objAttrs.action.transportMethod === 'POST') { | |
$el.append(CTX.widgets.input({ | |
subType: 'hidden', | |
name: 'X-CSRF-Token', | |
value: window.cstoken | |
}).getDOMElement()); | |
} | |
return this.DOMElement; | |
}; | |
Form.prototype.getValues = function () { | |
var values = {}; | |
$(this.DOMElement).find('.ctx_widget').each(function () { | |
var name = null; | |
var value = null; | |
var instance = CTX.getWidgetInstance(this); | |
if (instance !== null && instance.isFormElement()) { | |
name = instance.getName(); | |
value = instance.getValue(); | |
if (name !== null && value !== null) { | |
if (/\[\]$/.test(name)) { | |
if (name in values) { | |
values[name].push(value); | |
} else { | |
values[name] = [value]; | |
} | |
} else { | |
values[name] = value; | |
} | |
} | |
} | |
}); | |
return values; | |
}; | |
Form.prototype.getAction = function (values) { | |
var action = CTX.helpers.clone(this.objAttrs.action); | |
values = values || this.getValues(); | |
if (!('URI' in action)) { | |
action.URI = CTX.helpers.clone(CTX.URI); | |
} | |
if (!('transportMethod' in action) || action.transportMethod === 'GET') { | |
action.URI.params = $.extend(action.URI.params, values, {}); | |
} else { | |
action.params = values || {}; | |
} | |
return action; | |
}; | |
Form.prototype.handleFormSubmit = function (e) { | |
var values = this.getValues(); | |
var action = this.getAction(); | |
if ('dataCallback' in this.objAttrs) { | |
values = this.objAttrs.dataCallback(values); | |
} | |
if ('callback' in this.objAttrs) { | |
e.preventDefault(); | |
return this.objAttrs.callback(values); | |
} | |
if ('URI' in action && 'path' in action.URI && CTX.hasAction(action.URI.path)) { | |
e.preventDefault(); | |
CTX.loadAction(action, true); | |
} | |
}; | |
Form.prototype.updateFields = function validateFields() { | |
var action = this.getAction(); | |
action.transportMethod = 'POST'; | |
action.params.HTTPmethod = 'UPDATE_FIELDS'; | |
CTX.getMessage({ | |
URI: action.URI, | |
method: action.transportMethod, | |
data: action.params, | |
complete: function (data, xhrClone) { | |
CTX.jumpToActionFromResponse(action.URI, xhrClone, data, action.params); | |
} | |
}); | |
return true; | |
}; | |
Form.prototype.isValid = function isValid() { | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
if (!('content' in this.objAttrs || 'fields' in this.objAttrs)) { | |
CTX.debug('Form widget requires content or fields passed', this.objAttrs); | |
return false; | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function InfoPod(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.InfoPod = InfoPod; | |
CTX.helpers.extend(InfoPod, CTX.abstract.widgets.Base); | |
InfoPod.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var $header; | |
var $body; | |
var content; | |
var titleStructure; | |
$el = $('<section />'); | |
this.DOMElement = $el[0]; | |
if ('title' in this.objAttrs) { | |
$header = $('<header class="ctx_info-pod_title-header" />'); | |
titleStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.title); | |
$header.append(titleStructure.output()); | |
$el.append($header); | |
} | |
if ('content' in this.objAttrs) { | |
$body = $('<div class="ctx_info-pod_body" ></div>'); | |
content = new CTX.dataStructure.widgets.Content(this.objAttrs.content); | |
$body.append(content.output()); | |
$el.append($body); | |
} | |
$el.append('<br class="clearfix"/>'); | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Footer(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.Footer = Footer; | |
CTX.helpers.extend(Footer, CTX.abstract.widgets.Base); | |
Footer.prototype.makeDOMElement = function makeDOMElement() { | |
this.DOMElement = CTX.widgets.block({ | |
subType: 'footer', | |
content: [CTX.widgets.block({ | |
subType: 'div', | |
content: [CTX.widgets.block({ | |
subType: 'div', | |
className: 'ctx_footer_wrapper', | |
content: [this.getTopFooter()] | |
})], | |
className: 'ctx_footer_top' | |
}), CTX.widgets.block({ | |
subType: 'div', | |
content: [CTX.widgets.block({ | |
subType: 'div', | |
className: 'ctx_footer_wrapper', | |
content: [this.getBottomFooter()] | |
})], | |
className: 'ctx_footer_bottom' | |
})] | |
}).getDOMElement(); | |
return true; | |
}; | |
Footer.prototype.getTopFooter = function getTopHeader() { | |
var topOutput = []; | |
var list; | |
list = CTX.widgets.list({ | |
listItems: [{ | |
content: [CTX.widgets.link({ | |
text: 'Email', | |
action: { | |
URI: { | |
host: '123-reg.co.uk', | |
port: null, | |
path: '/email-hosting' | |
} | |
} | |
})] | |
}, { | |
content: [CTX.widgets.link({ | |
text: 'Web hosting', | |
action: { | |
URI: { | |
host: '123-reg.co.uk', | |
port: null, | |
path: '/web-hosting' | |
} | |
} | |
})] | |
}, { | |
content: [CTX.widgets.link({ | |
text: 'SSL Certificates', | |
action: { | |
URI: { | |
host: '123-reg.co.uk', | |
port: null, | |
path: '/ssl-certificates' | |
} | |
} | |
})] | |
}, { | |
content: [CTX.widgets.link({ | |
text: 'Create a website', | |
action: { | |
URI: { | |
host: '123-reg.co.uk', | |
port: null, | |
path: '/make-a-website' | |
} | |
} | |
})] | |
}, { | |
content: [CTX.widgets.link({ | |
text: 'VPS', | |
action: { | |
URI: { | |
host: '123-reg.co.uk', | |
port: null, | |
path: '/vps-hosting' | |
} | |
} | |
})] | |
}, { | |
content: [CTX.widgets.link({ | |
text: 'eCommerce', | |
action: { | |
URI: { | |
host: '123-reg.co.uk', | |
port: null, | |
path: '/ecommerce' | |
} | |
} | |
})] | |
}] | |
}); | |
topOutput.push(list); | |
list = undefined; | |
return CTX.widgets.block({ | |
content: [topOutput], | |
className: 'ctx_footer_wrapper-top' | |
}); | |
}; | |
Footer.prototype.getBottomFooter = function getBottomFooter() { | |
var firstCell = []; | |
var secondCell = []; | |
var list; | |
list = undefined; | |
firstCell.push(CTX.widgets.block({ | |
subType: 'div', | |
content: [CTX.widgets.text({ | |
subType: 'span', | |
text: 'Prices are for business use & exclude VAT at 20%', | |
className: 'ctx_footer_vat-notice' | |
}), CTX.widgets.text({ | |
subType: 'span', | |
text: 'Copyright © Webfusion Ltd', | |
className: 'ctx_footer_attribution' | |
})], | |
className: 'ctx_footer_legal' | |
})); | |
if (CTX.debugMode === true) { | |
secondCell.push(CTX.widgets.block({ | |
subType: 'div', | |
content: [CTX.widgets.link({ | |
text: 'JavaScript OFF', | |
action: { | |
URI: { | |
path: '/public/javascript/set_javascript_mode_off' | |
} | |
}, | |
className: 'pull-right' | |
})] | |
})); | |
} | |
return CTX.widgets.block({ | |
content: [CTX.widgets.block({ | |
content: firstCell | |
}), CTX.widgets.block({ | |
content: secondCell, | |
className: 'ctx_footer_wrapper-bottom-js' | |
})], | |
className: 'ctx_footer_wrapper-bottom' | |
}); | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function HeadingSection(objAttrs) { | |
this.objAttrs = objAttrs; | |
this.TODO = true; | |
} | |
CTX.classType.widgets.HeadingSection = HeadingSection; | |
CTX.helpers.extend(HeadingSection, CTX.abstract.widgets.Base); | |
HeadingSection.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var divBlock; | |
var contentClass = ['ctx_heading-section_content-cell']; | |
$el = $('<div class="ctx_heading-section ctx_widget" />'); | |
this.DOMElement = $el[0]; | |
divBlock = CTX.widgets.block({ | |
subType: 'div', | |
content: [this.objAttrs.heading], | |
className: 'ctx_heading-section_heading-cell' | |
}); | |
$el.append(divBlock.getDOMElement()); | |
divBlock = undefined; | |
if ('contentClassName' in this.objAttrs) { | |
contentClass = contentClass.concat(this.objAttrs.contentClassName); | |
} | |
divBlock = CTX.widgets.block({ | |
subType: 'div', | |
content: this.objAttrs.content, | |
className: contentClass | |
}); | |
$el.append(divBlock.getDOMElement()); | |
divBlock = undefined; | |
return this.DOMElement; | |
}; | |
HeadingSection.prototype.isValid = function isValid() { | |
var contentStructure; | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
if ('content' in this.objAttrs) { | |
contentStructure = new CTX.dataStructure.widgets.Content(this.objAttrs.content); | |
if (!contentStructure.isValid()) { | |
return false; | |
} | |
} | |
if (!('heading' in this.objAttrs)) { | |
CTX.debug('Heading argument was not passed'); | |
return false; | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Image(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.Image = Image; | |
CTX.helpers.extend(Image, CTX.abstract.widgets.Base); | |
Image.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
$el = $('<img />'); | |
this.DOMElement = $el[0]; | |
if ('path' in this.objAttrs) { | |
$el.attr('src', this.objAttrs.path); | |
} | |
if ('alt' in this.objAttrs) { | |
$el.attr('alt', this.objAttrs.alt); | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Table(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.Table = Table; | |
CTX.helpers.extend(Table, CTX.abstract.widgets.Base); | |
Table.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var self = this; | |
$el = $('<table />'); | |
this.DOMElement = $el[0]; | |
if ('container' in this.objAttrs) { | |
this.objAttrs.container.forEach(function (tableContainer) { | |
$el.append(self.createTableContainer(tableContainer)); | |
}); | |
} | |
return this.DOMElement; | |
}; | |
Table.prototype.isValid = function isValid() { | |
var result = true; | |
if ('container' in this.objAttrs) { | |
this.objAttrs.container.forEach(function (tableContainer) { | |
var validTableFormat = new CTX.dataStructure.widgets.TableContainer(tableContainer); | |
if (!validTableFormat.isValid()) { | |
result = false; | |
} | |
}); | |
} else { | |
CTX.debug('Table requires container argument passed', this.objAttrs); | |
result = false; | |
} | |
return result; | |
}; | |
Table.prototype.createTableContainer = function createTableContainer(tableContainer) { | |
var $tableContainer; | |
var $tableRow; | |
var self = this; | |
$tableContainer = $('<t' + tableContainer.subType + ' />'); | |
if ('className' in tableContainer) { | |
$tableContainer.addClass(tableContainer.className); | |
} | |
if ('rows' in tableContainer) { | |
tableContainer.rows.forEach(function (tableRow) { | |
$tableRow = self.createTableRows(tableRow, tableContainer.subType); | |
$tableContainer.append($tableRow); | |
$tableRow = undefined; | |
}); | |
} | |
return $tableContainer; | |
}; | |
Table.prototype.addNewContainer = function (container) { | |
$(this.DOMElement).append(this.createTableContainer(container)); | |
}; | |
Table.prototype.clearAllBodyContainers = function () { | |
$(this.DOMElement).find('tbody').remove(); | |
}; | |
Table.prototype.clearAllHeadContainers = function () { | |
$(this.DOMElement).find('thead').remove(); | |
}; | |
Table.prototype.createTableRows = function createTableRows(tableRow, sectionType) { | |
var $tableRow; | |
var $tableCell; | |
var tableCellType; | |
var that = this; | |
$tableRow = $('<tr />'); | |
if (sectionType === 'head') { | |
tableCellType = 'th'; | |
} else { | |
tableCellType = 'td'; | |
} | |
if ('className' in tableRow) { | |
$tableRow.addClass(tableRow.className); | |
} | |
if ('cells' in tableRow) { | |
tableRow.cells.forEach(function (tableCell, index) { | |
$tableCell = $('<' + tableCellType + '/>'); | |
if (tableCell.content === null) { | |
CTX.error('Content appears to be null in tableCell for table widget', tableCell, that.objAttrs.columnHeadings[index]); | |
} | |
$tableCell.append(new CTX.dataStructure.widgets.Content(tableCell.content).output()); | |
if ('columnHeadings' in that.objAttrs && index in that.objAttrs.columnHeadings) { | |
$tableCell.attr('data-label', that.objAttrs.columnHeadings[index]); | |
} | |
if ('className' in tableCell) { | |
$tableCell.addClass(tableCell.className); | |
} | |
if ('colspan' in tableCell) { | |
$tableCell.attr('colspan', tableCell.colspan); | |
} | |
if ('rowspan' in tableCell) { | |
$tableCell.attr('rowspan', tableCell.rowspan); | |
} | |
$tableRow.append($tableCell); | |
$tableCell = undefined; | |
}); | |
} | |
return $tableRow; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Postcode(objAttrs) { | |
this.objAttrs = objAttrs; | |
this.defaults = { | |
lookupButton: true | |
}; | |
} | |
CTX.classType.widgets.Postcode = Postcode; | |
CTX.helpers.extend(Postcode, CTX.abstract.widgets.Base); | |
Postcode.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var that = this; | |
var inputObject = CTX.helpers.clone(this.objAttrs); | |
var selectObject = CTX.helpers.clone(this.objAttrs); | |
var select; | |
$el = $('<span>'); | |
this.DOMElement = $el[0]; | |
$el.append(CTX.widgets.input(inputObject).getDOMElement()); | |
if (this.objAttrs.lookupButton) { | |
$el.append(this.createLookupButton().getDOMElement()); | |
} | |
if ('values' in this.objAttrs) { | |
delete selectObject.name; | |
select = CTX.widgets.selectBox(selectObject); | |
$el.append(select.getDOMElement()); | |
select.registerOnChangeCallback(function (value) { | |
that.changeAddress(value); | |
}); | |
} | |
return true; | |
}; | |
Postcode.prototype.changeAddress = function (addressId) { | |
var address; | |
if (addressId in this.objAttrs.addresses) { | |
address = this.objAttrs.addresses[addressId]; | |
$('.ctx_form .ctx_widget').each(function (id, widget) { | |
var instance = CTX.getWidgetInstance(widget); | |
var name; | |
if (instance && instance.isFormElement()) { | |
name = instance.getName(); | |
if (name && /post\_?code/.test(name)) { | |
instance.setValue(address.postcode); | |
} | |
if (name && /city|town/.test(name)) { | |
instance.setValue(address.postTown); | |
} | |
if (name && (/address$/.test(name) || /(address_line_|addr)1$/.test(name))) { | |
instance.setValue(address.addressLines[0]); | |
} | |
if (name && /(address_line_|addr)2$/.test(name) && address.addressLines.length > 1) { | |
instance.setValue(address.addressLines[1]); | |
} | |
if (name && /country(_code)?$/.test(name)) { | |
instance.setValue(address.country); | |
} | |
if (name && /county(_state)?$/.test(name)) { | |
instance.setValue(''); | |
} | |
} | |
}); | |
} else { | |
CTX.debug('Could not find addressId in addresses: ', addressId, this.objAttrs.addresses); | |
} | |
}; | |
Postcode.prototype.createLookupButton = function createLookupButton() { | |
var that = this; | |
return CTX.widgets.button({ | |
text: 'Lookup', | |
action: { | |
callback: function () { | |
var postcode = $(that.DOMElement).find('input').val(); | |
that.lookupPostcode(postcode); | |
} | |
} | |
}); | |
}; | |
Postcode.prototype.lookupPostcode = function (postcode) { | |
var that = this; | |
CTX.getMessage({ | |
method: 'POST', | |
URI: { | |
path: '/public/postcode', | |
params: { | |
postcode: postcode | |
} | |
}, | |
complete: function (data) { | |
var addresses = CTX.unwrapMessage(['json', 'addresses'], data); | |
var values = [ | |
['', '-- Please Select --'] | |
]; | |
var value; | |
if (null === addresses || 0 === addresses.length) { | |
CTX.addNotification({ | |
level: 'error', | |
message: 'Sorry we did not find that postcode.' | |
}); | |
} else { | |
addresses = CTX.helpers.objUnderscoreToCamelCase(addresses); | |
addresses.forEach(function (address, id) { | |
value = [id, address.addressLines.join(', ')]; | |
values.push(value); | |
}); | |
that.setObjAttrs({ | |
value: postcode, | |
addresses: addresses, | |
values: values | |
}); | |
} | |
} | |
}); | |
CTX.log({ | |
level: 'debug', | |
message: ['postcode', postcode] | |
}); | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function AdvertPod(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.AdvertPod = AdvertPod; | |
CTX.helpers.extend(AdvertPod, CTX.abstract.widgets.Base); | |
AdvertPod.prototype.makeDOMElement = function makeDOMElement() { | |
var widgetStructure = {}; | |
var adverts = { | |
domainBackorder: { | |
action: { | |
URI: { | |
path: '/domain-names/backorder.shtml' | |
} | |
}, | |
text: [CTX.widgets.button({ | |
text: 'Search now!', | |
className: ['ctx_button_cta', 'ctx_uppercase'], | |
subType: 'submit' | |
})] | |
}, | |
sellYourDomains: { | |
action: { | |
URI: { | |
path: '/domain-names/sell-a-domain.shtml' | |
} | |
} | |
}, | |
brandFortress: { | |
action: { | |
URI: { | |
host: 'www.brandfortress.com', | |
path: '/', | |
port: null | |
} | |
} | |
}, | |
paymentDetails: { | |
action: { | |
URI: { | |
path: '/secure/cpanel/account/information' | |
} | |
} | |
} | |
}; | |
if ('advertId' in this.objAttrs && this.objAttrs.advertId in adverts) { | |
widgetStructure = adverts[this.objAttrs.advertId]; | |
} | |
this.DOMElement = CTX.widgets.link(widgetStructure).getDOMElement(); | |
this.addClass('ctx_advert-pod_' + CTX.widgets.helpers.asCssClass(this.objAttrs.subType)); | |
this.addClass('ctx_advert-pod_' + CTX.widgets.helpers.asCssClass(this.objAttrs.podId)); | |
if ('advertId' in this.objAttrs) { | |
this.addClass('ctx_advert-pod_advert-' + CTX.widgets.helpers.asCssClass(this.objAttrs.advertId)); | |
} | |
return this.DOMElement; | |
}; | |
AdvertPod.prototype.isValid = function isValid() { | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
if (!('podId' in this.objAttrs)) { | |
return false; | |
} | |
if (!('subType' in this.objAttrs)) { | |
return false; | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function SerialisableSubmitButton(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.SerialisableSubmitButton = SerialisableSubmitButton; | |
CTX.helpers.extend(SerialisableSubmitButton, CTX.abstract.widgets.Base); | |
SerialisableSubmitButton.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
var that = this; | |
var inputWidget; | |
var buttonClass = this.objAttrs.btnClass || ''; | |
var inputObject = { | |
subType: 'hidden', | |
disabled: true, | |
value: this.objAttrs.text, | |
name: this.objAttrs.name | |
}; | |
var buttonObject = { | |
text: this.objAttrs.text, | |
subType: 'submit', | |
action: { | |
callback: function (e) { | |
that.handleSubmit.call(that, e); | |
return true; | |
} | |
}, | |
className: buttonClass | |
}; | |
$el = $('<span>'); | |
this.DOMElement = $el[0]; | |
inputWidget = CTX.widgets.input(inputObject); | |
$(inputWidget).prop('disabled', 'disabled'); | |
$el.append(CTX.widgets.button(buttonObject).getDOMElement()); | |
$el.append(inputWidget.getDOMElement()); | |
return true; | |
}; | |
SerialisableSubmitButton.prototype.handleSubmit = function handleSubmit() { | |
var inputElement = $(this.DOMElement).find('input[type=hidden]'); | |
inputElement.removeProp('disabled'); | |
CTX.getWidgetInstance(inputElement).enable(); | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function Icon(objAttrs) { | |
this.objAttrs = objAttrs; | |
} | |
CTX.classType.widgets.Icon = Icon; | |
CTX.helpers.extend(Icon, CTX.abstract.widgets.Base); | |
Icon.prototype.makeDOMElement = function makeDOMElement() { | |
var $el; | |
$el = $('<i />'); | |
this.DOMElement = $el[0]; | |
if ('subType' in this.objAttrs) { | |
$el.addClass('ctx_icon_' + this.objAttrs.subType); | |
} | |
$el = undefined; | |
return true; | |
}; | |
Icon.isValid = function isValid() { | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
var validIcons = ['glass', 'music', 'search', 'envelope', 'heart', 'star', 'star-empty', 'user', 'film', 'th-large', 'th', 'th-list', 'ok', 'remove', 'zoom-in', 'zoom-out', 'off', 'signal', 'cog', 'trash', 'home', 'file', 'time', 'road', 'download-alt', 'download', 'upload', 'inbox', 'play-circle', 'repeat', 'refresh', 'list-alt', 'lock', 'flag', 'headphones', 'volume-off', 'volume-down', 'volume-up', 'qrcode', 'barcode', 'tag', 'tags', 'book', 'bookmark', 'print', 'camera', 'font', 'bold', 'italic', 'text-height', 'text-width', 'align-left', 'align-center', 'align-right', 'align-justify', 'list', 'indent-left', 'indent-right', 'facetime-video', 'picture', 'pencil', 'map-marker', 'adjust', 'tint', 'edit', 'share', 'check', 'move', 'step-backward', 'fast-backward', 'backward', 'play', 'pause', 'stop', 'forward', 'fast-forward', 'step-forward', 'eject', 'chevron-left', 'chevron-right', 'plus-sign', 'minus-sign', 'remove-sign', 'ok-sign', 'question', 'question-sign', 'info-sign', 'screenshot', 'circle', 'remove-circle', 'ok-circle', 'ban-circle', 'arrow-left', 'arrow-right', 'arrow-up', 'arrow-down', 'share-alt', 'resize-full', 'resize-small', 'plus', 'minus', 'asterisk', 'exclamation-sign', 'gift', 'leaf', 'fire', 'eye-open', 'eye-close', 'warning-sign', 'plane', 'calendar', 'random', 'comment', 'magnet', 'chevron-up', 'chevron-down', 'retweet', 'shopping-cart', 'folder-close', 'folder-open', 'resize-vertical', 'resize-horizontal', 'hdd', 'bullhorn', 'bell', 'certificate', 'thumbs-up', 'thumbs-down', 'hand-right', 'hand-left', 'hand-up', 'hand-down', 'circle-arrow-right', 'circle-arrow-left', 'circle-arrow-up', 'circle-arrow-down', 'globe', 'wrench', 'tasks', 'filter', 'briefcase', 'fullscreen', 'account-info', 'account-security', 'account-activity', 'support', 'renew-services', 'affiliate', 'loyalty', 'payment-priority', 'file-text', 'renew-domains', 'whois-privacy', 'transfers', 'web-forwarding', 'bulk-registration', 'subdomains', 'back-ordering', 'sell-domains', 'sell-domains-disabled', 'xxx-membership', 'website-builder', 'instant-site', 'webworx', 'cloud-server', 'vps', 'ecommerce', 'instant-traffic', 'ssl', 'site-scanner', 'website-passport', 'google-analytics', 'google-adsense', 'dedicated-server', 'menu', 'pay-per-click', 'google-plus-sign', 'linkedin-sign', 'twitter-sign', 'facebook-sign', 'star']; | |
if ('path' in this.objAttrs) { | |
return true; | |
} | |
if ('subType' in this.objAttrs) { | |
if (validIcons.indexOf(this.objAttrs.subType) > -1) { | |
return true; | |
} | |
} | |
return false; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function List(objAttrs) { | |
this.objAttrs = objAttrs; | |
this.defaults = { | |
subType: 'unordered' | |
}; | |
} | |
CTX.classType.widgets.List = List; | |
CTX.helpers.extend(List, CTX.abstract.widgets.Base); | |
List.prototype.makeDOMElement = function makeDOMElement() { | |
var output = []; | |
var listStructure; | |
var widgetStructure = { | |
content: output, | |
subType: 'ul' | |
}; | |
if (this.objAttrs.subType === 'ordered') { | |
widgetStructure.subType = 'ol'; | |
} | |
if ('className' in this.objAttrs) { | |
widgetStructure.className = this.objAttrs.className; | |
} | |
if ('id' in this.objAttrs) { | |
widgetStructure.id = this.objAttrs.id; | |
} | |
this.objAttrs.listItems.forEach(function (listItem) { | |
listStructure = { | |
content: [], | |
subType: 'li' | |
}; | |
if ('content' in listItem) { | |
listStructure.content.push(listItem.content); | |
} | |
if ('className' in listItem) { | |
listStructure.className = listItem.className; | |
} | |
if ('id' in listItem) { | |
listStructure.id = listItem.id; | |
} | |
if ('subList' in listItem && 'listItems' in listItem.subList) { | |
listStructure.content.push(CTX.widgets.list({ | |
listItems: listItem.subList.listItems, | |
className: 'ctx_list_sub-list' | |
})); | |
} | |
output.push(CTX.widgets.block(listStructure)); | |
}); | |
this.DOMElement = CTX.widgets.block(widgetStructure).getDOMElement(); | |
return this.DOMElement; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
function ResultTableFilter(objAttrs) { | |
this.objAttrs = objAttrs; | |
this.TODO = true; | |
} | |
CTX.classType.widgets.ResultTableFilter = ResultTableFilter; | |
CTX.helpers.extend(ResultTableFilter, CTX.abstract.widgets.Base); | |
ResultTableFilter.prototype.makeDOMElement = function makeDOMElement() { | |
var output = []; | |
var value = ''; | |
var placeholderText = ''; | |
var filterName = this.objAttrs.resultSetHandler.tableNamespace + '.filter'; | |
if ('parameters' in CTX.request && CTX.request.parameters && filterName in CTX.request.parameters) { | |
value = CTX.request.parameters[filterName]; | |
} | |
if ('placeholder' in this.objAttrs) { | |
placeholderText = this.objAttrs.placeholder; | |
} | |
output.push(CTX.widgets.input({ | |
subType: 'text', | |
name: filterName, | |
value: value, | |
placeholder: placeholderText | |
})); | |
output.push(CTX.widgets.button({ | |
subType: 'submit', | |
text: 'Go' | |
})); | |
this.DOMElement = CTX.widgets.form({ | |
action: { | |
URI: this.objAttrs.resultSetHandler.updateURI | |
}, | |
content: output | |
}).getDOMElement(); | |
return this.DOMElement; | |
}; | |
ResultTableFilter.prototype.isValid = function isValid() { | |
if (!(this.superClass.isValid.apply(this))) { | |
return false; | |
} | |
if (!('resultSetHandler' in this.objAttrs)) { | |
return false; | |
} | |
return true; | |
}; | |
}(CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerController('/mobile/order/whoisprivacy', { | |
offerWhoisPrivacy: CTX.action({ | |
response: { | |
200: function () { | |
CTX.basket.loadItems(); | |
CTX.stash.tableHandler = new CTX.model.WhoisPrivacy(CTX.request); | |
CTX.loadTemplate(this); | |
} | |
} | |
}) | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerController('/mobile/secure/order/trademarkclaim', { | |
index: CTX.action({ | |
getStash: true, | |
response: { | |
200: function () { | |
CTX.loadTemplate(this); | |
} | |
} | |
}) | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerController('/mobile/utils', { | |
loading: CTX.action({ | |
getStash: false, | |
response: { | |
200: function () { | |
CTX.loadTemplate(this); | |
} | |
} | |
}) | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerController('/mobile/support', { | |
index: CTX.action({ | |
getStash: { | |
dataWrapper: 'MobileSupport' | |
}, | |
response: { | |
200: function () { | |
CTX.loadTemplate(this); | |
} | |
} | |
}) | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerController('/mobile/secure/order/confirmation', { | |
orderSuccess: CTX.action({ | |
getStash: { | |
dataWrapper: 'MobileSecureOrderConfirmation' | |
}, | |
response: { | |
200: function () { | |
CTX.basket.loadItems(true); | |
CTX.tracking.purchase(CTX.stash.basket); | |
CTX.tracking.conversion(CTX.stash.basket); | |
CTX.loadTemplate(this); | |
} | |
} | |
}) | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerController('/mobile', { | |
logout: CTX.action({ | |
getStash: true, | |
response: { | |
200: function () { | |
CTX.loadTemplate(this); | |
} | |
} | |
}), | |
index: CTX.action({ | |
getStash: true, | |
response: { | |
200: function () { | |
CTX.basket.loadItems(true); | |
CTX.loadTemplate(this); | |
} | |
} | |
}) | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerController('/mobile/secure', { | |
logIn: CTX.action({ | |
getStash: { | |
dataWrapper: ['MobileSecure'] | |
}, | |
response: { | |
200: function () { | |
var formChanges = { | |
append: [{ | |
fieldName: 'email', | |
append: false, | |
dataType: 'SingleField', | |
data: { | |
wrapperAttributes: { | |
'class': ['ctx_form-section-title', 'ctx_form-section-title-required-label'] | |
}, | |
disabled: false, | |
name: 'sign_up', | |
required: false, | |
widget: 'Text', | |
label: 'Sign Up', | |
value: '*Required fields', | |
fullName: 'sign_up_title', | |
widgetLabel: 'Simple', | |
widgetWrapper: 'Simple' | |
} | |
}, { | |
fieldName: 'username', | |
append: false, | |
dataType: 'SingleField', | |
data: { | |
wrapperAttributes: { | |
'class': ['ctx_form-section-title', 'ctx_form-section-title-required-label'] | |
}, | |
disabled: false, | |
name: 'login', | |
required: false, | |
widget: 'Text', | |
label: 'Login', | |
value: '*Required fields', | |
fullName: 'login_title', | |
widgetLabel: 'Simple', | |
widgetWrapper: 'Simple' | |
} | |
}], | |
update: [{ | |
fieldName: 'referral', | |
updates: { | |
type: 'Hidden', | |
readonly: true, | |
value: 105, | |
widget: 'Hidden' | |
} | |
}, { | |
fieldName: 'username', | |
updates: { | |
label: 'Email / Username*' | |
} | |
}, { | |
fieldName: 'password', | |
updates: { | |
label: 'Password*' | |
} | |
}, { | |
fieldName: 'email', | |
updates: { | |
label: 'Email address*' | |
} | |
}, { | |
fieldName: 'authpass', | |
updates: { | |
label: 'Password*' | |
} | |
}, { | |
fieldName: 'authpass_confirm', | |
updates: { | |
label: 'Re-type password*' | |
} | |
}, { | |
fieldName: 'fname', | |
updates: { | |
label: 'First name*' | |
} | |
}, { | |
fieldName: 'sname', | |
updates: { | |
label: 'Surname*' | |
} | |
}, { | |
fieldName: 'postcode', | |
updates: { | |
label: 'Postcode*' | |
} | |
}, { | |
fieldName: 'confirmation', | |
updates: { | |
wrapperAttributes: { | |
'class': ['confirmation-box'] | |
}, | |
value: 1 | |
} | |
}, { | |
fieldName: 'returnto', | |
updates: { | |
value: CTX.uriFor({ | |
path: '/mobile/secure/order/registrantdetails/register' | |
}) | |
} | |
}, { | |
fieldName: 'login', | |
updates: { | |
btnClass: 'ctx_button_cta' | |
} | |
}, { | |
fieldName: 'signup', | |
updates: { | |
btnClass: 'ctx_button_cta' | |
} | |
}, { | |
fieldName: 'addr1', | |
updates: { | |
label: 'Address line 1*' | |
} | |
}, { | |
fieldName: 'country', | |
updates: { | |
label: 'Country*' | |
} | |
}, { | |
fieldName: 'phone', | |
updates: { | |
label: 'Telephone*' | |
} | |
}, { | |
fieldName: 'city', | |
updates: { | |
label: 'Town / City*' | |
} | |
}] | |
}; | |
CTX.stash.signupForm = new CTX.dataStructure.widgets.FormHandler(CTX.stash.signupForm); | |
CTX.stash.signupForm.process({ | |
action: { | |
transportMethod: 'POST', | |
URI: { | |
path: '/mobile/secure/log_in' | |
} | |
} | |
}); | |
CTX.traverseObject.formatForm(CTX.stash.signupForm, formChanges); | |
CTX.loadTemplate(this); | |
} | |
} | |
}) | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
var FormChanges = { | |
append: [{ | |
fieldName: 'credit_card.card_type', | |
append: false, | |
dataType: 'SingleField', | |
data: { | |
wrapperAttributes: { | |
'class': ['ctx_form-section-title', 'ctx_form-section-title-required-label'] | |
}, | |
disabled: false, | |
name: 'creditCard_title', | |
required: false, | |
widget: 'Text', | |
label: 'Credit card details', | |
value: '*Required fields', | |
fullName: 'credit_card.creditCardDetails_title', | |
widgetLabel: 'Simple', | |
widgetWrapper: 'Simple' | |
} | |
}, { | |
fieldName: 'credit_card.post_code', | |
append: false, | |
dataType: 'SingleField', | |
data: { | |
wrapperAttributes: { | |
'class': ['ctx_form-section-title'] | |
}, | |
disabled: false, | |
name: 'creditCard_address', | |
required: false, | |
widget: 'Text', | |
label: 'Address', | |
value: '', | |
fullName: 'credit_card.address', | |
widgetLabel: 'Simple', | |
widgetWrapper: 'Simple' | |
} | |
}], | |
update: [{ | |
fieldName: 'credit_card.use_credit', | |
updates: { | |
value: '0.00', | |
widgetWrapper: 'Hidden', | |
type: 'Hidden', | |
widget: 'Hidden' | |
} | |
}, { | |
fieldName: 'credit_card.cv2_number', | |
updates: { | |
label: 'CV2', | |
widgetWrapper: 'Simple' | |
} | |
}, { | |
fieldName: 'credit_card.issue_number', | |
updates: { | |
label: 'Issue Number' | |
} | |
}, { | |
fieldName: 'credit_card.start_date.month', | |
updates: { | |
label: 'Start date', | |
widgetLabel: 'Simple', | |
wrapperAttributes: { | |
'class': ['start_date'] | |
} | |
} | |
}, { | |
fieldName: 'credit_card.start_date.year', | |
updates: { | |
widgetLabel: 'None', | |
wrapperAttributes: { | |
'class': ['start_date'] | |
} | |
} | |
}, { | |
fieldName: 'credit_card.end_date.month', | |
updates: { | |
label: 'Expiry date*', | |
widgetLabel: 'Simple', | |
wrapperAttributes: { | |
'class': ['end_date'] | |
} | |
} | |
}, { | |
fieldName: 'credit_card.end_date.year', | |
updates: { | |
widgetLabel: 'None', | |
wrapperAttributes: { | |
'class': ['end_date'] | |
} | |
} | |
}, { | |
fieldName: 'credit_card.start_date', | |
updates: { | |
widgetWrapper: 'Simple' | |
} | |
}, { | |
fieldName: 'credit_card.end_date', | |
updates: { | |
widgetWrapper: 'Simple' | |
} | |
}, { | |
fieldName: 'credit_card.card_number', | |
updates: { | |
label: 'Card number*' | |
} | |
}, { | |
fieldName: 'credit_card.name_on_card', | |
updates: { | |
label: 'Name on card*' | |
} | |
}, { | |
fieldName: 'credit_card.submit', | |
updates: { | |
btnClass: 'ctx_button_cta ctx_button_chevron-right', | |
text: 'Pay by credit card' | |
} | |
}, { | |
fieldName: 'paypal.submit', | |
updates: { | |
text: '', | |
btnClass: 'ctx_button_cta' | |
} | |
}, { | |
fieldName: 'credit_card.cv2_number', | |
updates: { | |
label: 'CV2*', | |
wrapperAttributes: { | |
'class': ['cv2-field'] | |
} | |
} | |
}, { | |
fieldName: 'credit_card.card_type', | |
updates: { | |
label: 'Card type*' | |
} | |
}, { | |
fieldName: 'credit_card.post_code', | |
updates: { | |
label: 'Post/Zip code*' | |
} | |
}, { | |
fieldName: 'credit_card.address_line_1', | |
updates: { | |
label: 'Address Line 1*' | |
} | |
}, { | |
fieldName: 'credit_card.address_line_1', | |
updates: { | |
label: 'Address Line 1*' | |
} | |
}, { | |
fieldName: 'credit_card.town_city', | |
updates: { | |
label: 'Town/City*' | |
} | |
}, { | |
fieldName: 'paypal', | |
updates: { | |
wrapperAttributes: { | |
'class': ['paypalSection'] | |
} | |
} | |
}, { | |
fieldName: 'credit_card', | |
updates: { | |
wrapperAttributes: { | |
'class': ['creditCardSection'] | |
} | |
} | |
}], | |
remove: [{ | |
fieldName: 'direct_debit' | |
}, { | |
fieldName: 'credit_card.available_credit' | |
}, { | |
fieldName: 'credit_card.start_date.month_year_separator' | |
}, { | |
fieldName: 'credit_card.end_date.month_year_separator' | |
}] | |
}; | |
var accordionToggle = function (accordionTitle) { | |
var accordion = CTX.getWidgetInstance($('.' + accordionTitle + 'Section')); | |
if (null !== accordion) { | |
accordion.handleHeadingClick(); | |
} | |
}; | |
CTX.registerController('/mobile/secure/order/checkout', { | |
checkout: CTX.action({ | |
getStash: { | |
dataWrapper: 'MobileSecureOrderCheckout' | |
}, | |
response: { | |
200: function () { | |
if ('redirectTo' in CTX.stash) { | |
var redirectTo = CTX.stash.redirectTo; | |
var redirectForm = jQuery('<form>'); | |
redirectForm.attr('action', redirectTo); | |
redirectForm.attr('method', 'POST'); | |
Object.keys(CTX.stash).forEach(function (key) { | |
if ('redirectTo' !== key && 'checkoutForm' !== key) { | |
var redirectParameter = jQuery('<input>'); | |
redirectParameter.attr('type', 'hidden'); | |
redirectParameter.attr('name', key); | |
redirectParameter.attr('value', CTX.stash[key]); | |
redirectForm.append(redirectParameter); | |
} | |
}); | |
jQuery('body').append(redirectForm); | |
CTX.debug('Submitting form values to Data cash', jQuery(redirectForm).serializeArray()); | |
setTimeout(function () { | |
redirectForm.submit(); | |
}, 1000); | |
return redirectForm[0]; | |
} | |
if (false) { | |
CTX.loadTemplate('/mobile/secure/order/checkout/redirect_to_card_security', CTX.stash); | |
} else { | |
CTX.stash.checkoutForm = new CTX.dataStructure.widgets.FormHandler(CTX.stash.checkoutForm); | |
CTX.stash.checkoutForm.process({ | |
action: { | |
transportMethod: 'POST', | |
URI: { | |
path: '/mobile/secure/order/checkout/checkout' | |
} | |
}, | |
dataCallback: function (values) { | |
var paymentType = 'direct_debit'; | |
if ('credit_card.submit' in values) { | |
paymentType = 'credit_card'; | |
} else if ('paypal.submit' in values) { | |
paymentType = 'paypal'; | |
} else if ('credit_balance.submit' in values) { | |
paymentType = 'credit_balance'; | |
} | |
var paymentTypeIdentifier = 'payment_type'; | |
values[paymentTypeIdentifier] = paymentType; | |
return values; | |
} | |
}); | |
CTX.traverseObject.formatForm(CTX.stash.checkoutForm, FormChanges); | |
CTX.basket.registerUpdateCallback(function () { | |
var radioBtnCard; | |
var radioBtnPaypal; | |
CTX.basket.clearUpdateCallbacks(); | |
CTX.loadTemplate(this); | |
radioBtnCard = CTX.getWidgetInstance($('.ctx_block-payment-type #creditCard')); | |
radioBtnCard.registerOnChangeCallback(function (btnValue) { | |
accordionToggle(btnValue); | |
}); | |
radioBtnPaypal = CTX.getWidgetInstance($('.ctx_block-payment-type #paypal')); | |
radioBtnPaypal.registerOnChangeCallback(function (btnValue) { | |
accordionToggle(btnValue); | |
}); | |
}); | |
CTX.basket.loadItems(); | |
} | |
} | |
} | |
}), | |
returnFromCardSecurity: CTX.action({ | |
getStash: false, | |
response: { | |
200: function () { | |
CTX.loadAction({ | |
URI: { | |
path: '/mobile/secure/order/checkout/checkout', | |
params: CTX.stash.MobileSecureOrderCheckoutReturnFromCardSecurity | |
}, | |
transportMethod: 'POST' | |
}); | |
} | |
} | |
}), | |
returnFromPaypal: CTX.action({ | |
getStash: false, | |
response: { | |
200: function () { | |
CTX.loadAction({ | |
URI: { | |
path: '/mobile/secure/order/checkout/checkout', | |
params: CTX.stash.MobileSecureOrderCheckoutReturnFromPaypal | |
}, | |
transportMethod: 'POST' | |
}); | |
} | |
} | |
}) | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerController('/mobile/order/domainresults', { | |
resultsPage: CTX.action({ | |
getStash: true, | |
response: { | |
200: function () { | |
var domain = CTX.request.parameters.domain; | |
var domainSearch = new CTX.model.DomainAvailability({ | |
domain: CTX.request.parameters.domain | |
}); | |
CTX.stash.domainSearch = domainSearch; | |
domainSearch.getPremiumSuggestions(); | |
CTX.stash.domain = domain; | |
CTX.basket.registerUpdateCallback(function () { | |
CTX.basket.clearUpdateCallbacks(); | |
CTX.loadTemplate(this); | |
}); | |
CTX.basket.loadItems(); | |
} | |
} | |
}) | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerController('/mobile/secure/order/registrantdetails', { | |
register: CTX.action({ | |
getStash: { | |
dataWrapper: 'MobileSecureOrderRegistrantDetails' | |
}, | |
response: { | |
200: function () { | |
var formChanges = { | |
update: [{ | |
fieldName: 'submit', | |
updates: { | |
className: ['ctx_button_cta', 'pull-right', 'ctx_button_chevron-right'], | |
text: 'Continue' | |
} | |
}, { | |
fieldName: 'registrant', | |
updates: { | |
label: 'Registered to*' | |
} | |
}, { | |
fieldName: 'forename', | |
updates: { | |
label: 'Forename*' | |
} | |
}, { | |
fieldName: 'surname', | |
updates: { | |
label: 'Surename*' | |
} | |
}, { | |
fieldName: 'email', | |
updates: { | |
label: 'Email*' | |
} | |
}, { | |
fieldName: 'address', | |
updates: { | |
label: 'Address*' | |
} | |
}, { | |
fieldName: 'city', | |
updates: { | |
label: 'Town / City*' | |
} | |
}, { | |
fieldName: 'country_code', | |
updates: { | |
label: 'Country*' | |
} | |
}, { | |
fieldName: 'telephone', | |
updates: { | |
label: 'Telephone*' | |
} | |
}] | |
}; | |
CTX.stash.MobileSecureOrderRegistrantDetails = new CTX.dataStructure.widgets.FormHandler(CTX.stash); | |
CTX.stash.MobileSecureOrderRegistrantDetails.process({ | |
callback: function (values) { | |
var action = { | |
URI: { | |
path: '/mobile/secure/order/registrantdetails/register' | |
}, | |
transportMethod: 'POST' | |
}; | |
var checkTruthy = function (value) { | |
if ('' !== value && 0 !== value) { | |
return true; | |
} | |
return false; | |
}; | |
if ('country_code' in values && 'IT' === values.country_code) { | |
if (!('entity_type_id' in values && checkTruthy(values.entity_type_id)) || !('registrant_code' in values && checkTruthy(values.registrant_code))) { | |
CTX.addNotification({ | |
level: 'error', | |
message: 'Please fill in "IT Registrant Type" and "IT Registrant Code".' | |
}); | |
return false; | |
} | |
} | |
action.params = values || {}; | |
CTX.loadAction(action, true); | |
} | |
}); | |
CTX.traverseObject.formatForm(CTX.stash.MobileSecureOrderRegistrantDetails, formChanges); | |
CTX.loadTemplate(this); | |
} | |
} | |
}) | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerController('/error', { | |
index: CTX.action({}) | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerController('/mobile/order/basket', { | |
basket: CTX.action({ | |
getStash: true, | |
response: { | |
200: function () { | |
CTX.basket.loadItems(); | |
CTX.basket.registerUpdateCallback(function () { | |
CTX.loadTemplate(this); | |
}); | |
} | |
} | |
}) | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerTemplate('/mobile/secure/order/trademarkclaim/index', function () { | |
var output = [], | |
trademark_notice = [], | |
remove_from_basket_form = []; | |
trademark_notice.push(CTX.widgets.heading({ | |
level: 1, | |
text: 'Trademark Claim' | |
})); | |
remove_from_basket_form.push(CTX.widgets.heading({ | |
level: 2, | |
text: 'Trademark Claim' | |
})); | |
if (CTX.stash.trademarkCheckSuccess) { | |
trademark_notice.push(CTX.widgets.block({ | |
content: ['For "', CTX.widgets.text({ | |
text: CTX.stash.domain, | |
subtype: 'strong' | |
}), '" ', CTX.widgets.text({ | |
text: CTX.stash.remaining | |
})], | |
className: ['ctx_block_trademark', 'ctx_block_tm-remove-from-basket'], | |
subtype: 'p' | |
})); | |
trademark_notice.push(CTX.stash.trademarkHtml); | |
CTX.stash.confirmTrademarkClaimsForm = new CTX.dataStructure.widgets.FormHandler(CTX.stash.confirmTrademarkClaimsForm); | |
CTX.stash.confirmTrademarkClaimsForm.process({ | |
callback: function (values) { | |
var action = { | |
URI: { | |
path: '/mobile/secure/order/trademarkclaim/index' | |
}, | |
transportMethod: 'POST' | |
}; | |
action.params = values || {}; | |
CTX.loadAction(action, true); | |
} | |
}); | |
trademark_notice.push(CTX.stash.confirmTrademarkClaimsForm.render()); | |
remove_from_basket_form.push(CTX.widgets.block({ | |
content: ['The Trademark Notice has been presented because the applied ', 'domain name matches at least one trademark on record. To continue ', 'with your purchase, you will need to check the box below the notice ', 'confirming that you understand the registration process. If you do ', 'not wish to continue with the purchase of this domain, please click ', '"REMOVE FROM BASKET" below.'], | |
subtype: 'p' | |
})); | |
remove_from_basket_form.push(CTX.widgets.block({ | |
content: ['For full details, please read the Trademark Notice before continuing.'], | |
className: ['ctx_block_tm-remove-from-basket'], | |
subtype: 'p' | |
})); | |
} else { | |
trademark_notice.push(CTX.widgets.block({ | |
content: ['Unfortunately we are currently not able to establish whether any trademarks might apply to "', CTX.widgets.text({ | |
text: CTX.stash.domain, | |
subtype: 'strong' | |
}), '". Please try again later.'], | |
className: ['ctx_block_trademark', 'ctx_block_error'], | |
subtype: 'p' | |
})); | |
remove_from_basket_form.push(CTX.widgets.block({ | |
content: ['As we are legally required to perform a trademark check on ', 'this domain but are currently unable to do so, you can not ', 'proceed to check out this basket at this time. Please try ', 'again later, or remove this domain to continue checking out ', 'your basket.'], | |
className: ['ctx_block_tm-remove-from-basket'], | |
subtype: 'p' | |
})); | |
} | |
remove_from_basket_form.push(CTX.widgets.form({ | |
dynamicRequest: false, | |
action: { | |
URI: { | |
path: '/op/order/basket/remove_for_mobile_trademark_page', | |
args: [CTX.stash.item.id] | |
}, | |
transportMethod: 'POST' | |
}, | |
content: [CTX.widgets.button({ | |
text: 'Remove from basket', | |
subType: 'submit' | |
})] | |
})); | |
output.push(CTX.widgets.infoPod({ | |
className: 'ctx_block_trademark-notice', | |
content: trademark_notice | |
})); | |
output.push(CTX.widgets.infoPod({ | |
className: 'ctx_block_trademark-notice', | |
content: remove_from_basket_form | |
})); | |
return output; | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerTemplate('/mobile/support/index', function () { | |
var output = []; | |
output.push(CTX.widgets.infoPod({ | |
className: 'ctx_info-pod_condensed', | |
content: [CTX.widgets.list({ | |
className: 'ctx_list_navigation-menu', | |
listItems: [{ | |
content: CTX.widgets.button({ | |
text: 'Go to support site', | |
action: { | |
URI: { | |
host: '123-reg.co.uk', | |
port: null, | |
path: '/support' | |
} | |
} | |
}) | |
}, { | |
content: CTX.widgets.button({ | |
text: 'Click to call sales', | |
action: { | |
URI: { | |
scheme: 'tel', | |
ts: '+44845-450-2310' | |
} | |
} | |
}) | |
}] | |
})] | |
})); | |
return output; | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
var linkCallback = function () { | |
var basketItems = CTX.basket.getItems(); | |
if ('array' === CTX.helpers.typeOf(basketItems) && basketItems.length > 0) { | |
CTX.loadAction({ | |
URI: { | |
path: '/mobile/order/whoisprivacy/offer_whois_privacy' | |
} | |
}); | |
} else { | |
CTX.addNotification({ | |
level: 'error', | |
message: 'Please add an item to your basket to continue' | |
}); | |
} | |
}; | |
CTX.registerTemplate('/mobile/order/domainresults/results_page', function () { | |
var output = []; | |
var domainOutput = []; | |
var domainProductInfo = {}; | |
var button1 = CTX.widgets.block({ | |
className: 'ctx_block_floating-button-section', | |
content: [CTX.widgets.button({ | |
className: ['ctx_button_cta', 'ctx_button_chevron-right', 'ctx_button_full-width'], | |
text: 'Continue to registration', | |
action: { | |
callback: linkCallback | |
} | |
})] | |
}); | |
var button2 = CTX.widgets.button({ | |
className: ['ctx_button_cta', 'ctx_button_chevron-right', 'ctx_button_full-width'], | |
text: 'Continue to registration', | |
action: { | |
callback: linkCallback | |
} | |
}); | |
if ('domainRegistrationProducts' in CTX.stash) { | |
domainProductInfo = CTX.helpers.objUnderscoreToCamelCase(CTX.stash.domainRegistrationProducts); | |
} | |
if (CTX.stash.domain.length <= 1) { | |
domainOutput = CTX.widgets.notification({ | |
level: 'error', | |
message: 'The hostname of the desired domain must be at least two letters long.' | |
}); | |
button1 = ''; | |
button2 = ''; | |
} else if (2 === CTX.stash.domain.length) { | |
domainOutput = CTX.loadFragment('/mobile/order/domainresults/results_page/fragment/domainSearchTwo', { | |
domainProductInfo: domainProductInfo | |
}); | |
} else { | |
domainOutput = CTX.loadFragment('/mobile/order/domainresults/results_page/fragment/domainSearch', { | |
domainProductInfo: domainProductInfo | |
}); | |
} | |
output.push(CTX.widgets.infoPod({ | |
className: 'ctx_info-pod_condensed', | |
content: [CTX.widgets.heading({ | |
level: 1, | |
className: 'ctx_heading_looks-like-h3', | |
text: 'Search results for' | |
}), CTX.widgets.infoPod({ | |
content: CTX.helpers.domain.truncateHostname(CTX.stash.domain, 29), | |
className: 'search-domain' | |
}), domainOutput, button1, button2] | |
})); | |
return output; | |
}); | |
CTX.registerFragment('/mobile/order/domainresults/results_page/fragment/domainSearchTwo', function (options) { | |
var output = [CTX.widgets.block({ | |
content: [CTX.widgets.heading({ | |
level: 3, | |
text: 'Promo', | |
className: 'ctx_heading_promo' | |
}), CTX.widgets.domainSearchSection({ | |
domainSearch: CTX.stash.domainSearch, | |
extensionInfo: [{ | |
name: '.uk.com' | |
}, { | |
name: '.cn.com' | |
}, { | |
name: '.de.com' | |
}, { | |
name: '.eu.com' | |
}, { | |
name: '.gb.com' | |
}, { | |
name: '.gb.net' | |
}, { | |
name: '.gr.com' | |
}, { | |
name: '.kr.com' | |
}, { | |
name: '.qc.com' | |
}, { | |
name: '.sa.com' | |
}, { | |
name: '.us.com' | |
}, { | |
name: '.za.com' | |
}, { | |
name: '.br.com' | |
}, { | |
name: '.hu.com' | |
}, { | |
name: '.jpn.com' | |
}, { | |
name: '.no.com' | |
}, { | |
name: '.ru.com' | |
}, { | |
name: '.se.com' | |
}, { | |
name: '.se.net' | |
}, { | |
name: '.uk.net' | |
}, { | |
name: '.uy.com' | |
}], | |
showHeading: false, | |
domainProductInfo: options.domainProductInfo, | |
autoSearch: true | |
})] | |
})]; | |
return output; | |
}); | |
CTX.registerFragment('/mobile/order/domainresults/results_page/fragment/domainSearch', function (options) { | |
var premiumMatch = ''; | |
var output = []; | |
premiumMatch = CTX.widgets.block({ | |
content: '', | |
className: ['hide', 'ctx_block_premium-match'] | |
}); | |
CTX.stash.domainSearch.isExactMatch(function (match) { | |
var inBasket = false; | |
if (match) { | |
CTX.basket.getItems().forEach(function (item) { | |
if ('hostname' in item && item.hostname) { | |
if (item.extension === match.extension && item.hostname === match.hostname) { | |
inBasket = true; | |
} | |
} | |
}); | |
if (true === inBasket) { | |
return false; | |
} | |
premiumMatch.setObjAttr('content', ['An exact match has been found in our premium domain portfolio ', CTX.widgets.block({ | |
content: [CTX.widgets.heading({ | |
text: match.domain, | |
level: 3 | |
}), CTX.widgets.text({ | |
text: 'is available to buy for ', | |
subType: 'strong' | |
}), CTX.widgets.text({ | |
text: [CTX.productPrice.getPriceString(match.price), '*'], | |
className: 'ctx_text_highlight' | |
})] | |
}), CTX.widgets.button({ | |
text: 'Add', | |
subType: 'submit', | |
className: ['btn-primary', 'btn-add', 'ctx_button_cta', 'right'], | |
action: { | |
callback: function () { | |
CTX.basket.add({ | |
hostname: match.hostname, | |
extension: match.extension, | |
product: 'Premium Domain', | |
years: 1 | |
}, function () { | |
premiumMatch.addClass('hide'); | |
}); | |
} | |
} | |
})]); | |
premiumMatch.removeClass('hide'); | |
} | |
}); | |
output = [CTX.widgets.block({ | |
content: [premiumMatch, CTX.widgets.heading({ | |
level: 3, | |
text: 'Promo', | |
className: 'ctx_heading_promo' | |
}), CTX.widgets.domainSearchSection({ | |
domainSearch: CTX.stash.domainSearch, | |
extensionInfo: [{ | |
name: '.co', | |
promoText: 'Over 60% off' | |
}, ], | |
showHeading: false, | |
domainProductInfo: options.domainProductInfo, | |
autoSearch: true | |
}), CTX.widgets.heading({ | |
level: 3, | |
text: 'Popular', | |
className: 'popular-heading' | |
}), CTX.widgets.domainSearchSection({ | |
domainSearch: CTX.stash.domainSearch, | |
extensionInfo: [{ | |
name: '.uk', | |
promoText: 'pre-order .uk' | |
}, { | |
name: '.co.uk' | |
}, { | |
name: '.com' | |
}, { | |
name: '.uk.com' | |
}, { | |
name: '.org.uk' | |
}, { | |
name: '.net' | |
}, { | |
name: '.org' | |
}, { | |
name: '.eu' | |
}, { | |
name: '.co' | |
}, { | |
name: '.biz' | |
}, { | |
name: '.info' | |
}], | |
showHeading: false, | |
domainProductInfo: options.domainProductInfo, | |
autoSearch: true | |
}), CTX.widgets.heading({ | |
level: 3, | |
text: 'New Domain Names' | |
}), CTX.widgets.domainSearchSection({ | |
domainSearch: CTX.stash.domainSearch, | |
extensionInfo: [{ | |
name: '.email' | |
}, { | |
name: '.guru' | |
}, { | |
name: '.photography' | |
}], | |
showHeading: false, | |
domainProductInfo: options.domainProductInfo, | |
autoSearch: true | |
}), CTX.widgets.domainSearchSection({ | |
heading: 'United Kingdom', | |
domainSearch: CTX.stash.domainSearch, | |
extensionInfo: [{ | |
name: '.me.uk' | |
}, { | |
name: '.uk.net' | |
}, { | |
name: '.gb.net' | |
}, { | |
name: '.gb.com' | |
}], | |
domainProductInfo: options.domainProductInfo | |
}), CTX.widgets.domainSearchSection({ | |
heading: 'Europe - Popular', | |
domainSearch: CTX.stash.domainSearch, | |
extensionInfo: [{ | |
name: '.eu.com' | |
}, { | |
name: '.at' | |
}, { | |
name: '.be' | |
}, { | |
name: '.de' | |
}, { | |
name: '.es' | |
}, { | |
name: '.nl' | |
}, { | |
name: '.pl' | |
}, { | |
name: '.it' | |
}], | |
domainProductInfo: options.domainProductInfo | |
}), CTX.widgets.domainSearchSection({ | |
heading: 'Personal & Social', | |
domainSearch: CTX.stash.domainSearch, | |
extensionInfo: [{ | |
name: '.so' | |
}, { | |
name: '.pro' | |
}, { | |
name: '.pm' | |
}, { | |
name: '.pw' | |
}, { | |
name: '.im' | |
}, { | |
name: '.ws' | |
}, { | |
name: '.tv' | |
}, { | |
name: '.cc' | |
}, { | |
name: '.sx' | |
}, { | |
name: '.xxx' | |
}, { | |
name: '.me' | |
}], | |
domainProductInfo: options.domainProductInfo | |
}), CTX.widgets.domainSearchSection({ | |
heading: 'Communications', | |
domainSearch: CTX.stash.domainSearch, | |
extensionInfo: [{ | |
name: '.tel' | |
}, { | |
name: '.mobi' | |
}, { | |
name: '.mx' | |
}], | |
domainProductInfo: options.domainProductInfo | |
}), CTX.widgets.domainSearchSection({ | |
heading: 'Europe - additional', | |
domainSearch: CTX.stash.domainSearch, | |
extensionInfo: [{ | |
name: '.de.com' | |
}, { | |
name: '.gr.com' | |
}, { | |
name: '.hu.com' | |
}, { | |
name: '.no.com' | |
}, { | |
name: '.se.com' | |
}, { | |
name: '.se.net' | |
}], | |
domainProductInfo: options.domainProductInfo | |
}), CTX.widgets.domainSearchSection({ | |
heading: 'Americas', | |
domainSearch: CTX.stash.domainSearch, | |
extensionInfo: [{ | |
name: '.us' | |
}, { | |
name: '.us.com' | |
}, { | |
name: '.br.com' | |
}, { | |
name: '.qc.com' | |
}, { | |
name: '.uy.com' | |
}], | |
domainProductInfo: options.domainProductInfo | |
}), CTX.widgets.domainSearchSection({ | |
heading: 'Africa', | |
domainSearch: CTX.stash.domainSearch, | |
extensionInfo: [{ | |
name: '.co.za' | |
}, { | |
name: '.za.com' | |
}], | |
domainProductInfo: options.domainProductInfo | |
}), CTX.widgets.domainSearchSection({ | |
heading: 'Asia', | |
domainSearch: CTX.stash.domainSearch, | |
extensionInfo: [{ | |
name: '.la' | |
}, { | |
name: '.ae' | |
}, { | |
name: '.ae.org' | |
}, { | |
name: '.asia' | |
}, { | |
name: '.cn.com' | |
}, { | |
name: '.co.il' | |
}, { | |
name: '.cx' | |
}, { | |
name: '.in' | |
}, { | |
name: '.jp' | |
}, { | |
name: '.jpn.com' | |
}, { | |
name: '.kr.com' | |
}, { | |
name: '.ru.com' | |
}, { | |
name: '.sa.com' | |
}], | |
domainProductInfo: options.domainProductInfo | |
}), CTX.widgets.domainSearchSection({ | |
heading: 'Australia and New Zealand', | |
domainSearch: CTX.stash.domainSearch, | |
extensionInfo: [{ | |
name: '.tk' | |
}, { | |
name: '.co.nz' | |
}], | |
domainProductInfo: options.domainProductInfo | |
})] | |
})]; | |
return output; | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerTemplate('/mobile/secure/order/confirmation/order_success', function () { | |
var output = []; | |
output.push(CTX.widgets.infoPod({ | |
className: 'ctx_info-pod_condensed', | |
content: [CTX.widgets.heading({ | |
level: 1, | |
className: 'ctx_heading_looks-like-h3', | |
text: 'Payment Complete' | |
}), CTX.widgets.heading({ | |
level: 2, | |
className: 'ctx_heading_looks-like-h4', | |
text: 'Thank you for your order, it is now processing.' | |
}), CTX.widgets.block({ | |
subType: 'p', | |
content: 'We will shortly send you an email to confirm your purchase. Please note, some products may take a short while to become active within your account.' | |
}), CTX.widgets.block({ | |
subType: 'div', | |
className: 'ctx-confirmation-image-holder', | |
style: 'text-align: right;', | |
content: [CTX.widgets.image({ | |
path: '/library/CTX/img/mobile/confirmation-image.png', | |
title: 'Thank you for your order', | |
className: 'ctx-image-confirmation' | |
})] | |
}), CTX.widgets.block({ | |
subType: 'div', | |
className: 'ctx_block_center', | |
content: [CTX.widgets.link({ | |
action: { | |
URI: { | |
host: 'www.123-reg.co.uk', | |
path: '/', | |
port: null | |
} | |
}, | |
text: 'Full website' | |
}), ' links below'] | |
})] | |
})); | |
if ('affiliatePixelImage' in CTX.stash && '' !== CTX.stash.affiliatePixelImage) { | |
output.push(CTX.widgets.image({ | |
path: CTX.stash.affiliatePixelImage | |
})); | |
} | |
return output; | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerTemplate('/mobile/secure/order/checkout/checkout', function () { | |
var output = []; | |
var orderTotal; | |
var paymentType; | |
var prices = CTX.basket.getPrices(); | |
paymentType = CTX.widgets.block({ | |
content: [CTX.widgets.heading({ | |
level: 4, | |
text: 'Choose your payment type' | |
}), CTX.widgets.input({ | |
value: 'creditCard', | |
subType: 'radio', | |
name: 'paymentType', | |
id: 'creditCard' | |
}), CTX.widgets.label({ | |
text: 'Credit card', | |
forId: 'creditCard' | |
}), CTX.widgets.input({ | |
value: 'paypal', | |
subType: 'radio', | |
name: 'paymentType', | |
id: 'paypal' | |
}), CTX.widgets.label({ | |
text: 'PayPal', | |
forId: 'paypal' | |
})], | |
className: ['ctx_block-payment-type'] | |
}); | |
orderTotal = CTX.widgets.block({ | |
content: [CTX.widgets.block({ | |
content: 'Your order total is', | |
subType: 'div' | |
}), CTX.widgets.block({ | |
content: '£' + prices.grossPrice, | |
subType: 'div' | |
})], | |
className: ['ctx_block-order-total', 'clearfix'] | |
}); | |
output.push(CTX.widgets.infoPod({ | |
className: 'ctx_info-pod_condensed', | |
content: [CTX.widgets.heading({ | |
level: 1, | |
className: 'ctx_heading_looks-like-h3', | |
text: 'Payment' | |
}), CTX.widgets.infoPod({ | |
content: [orderTotal, paymentType, CTX.stash.checkoutForm.render()], | |
className: 'ctx_info-pod_checkout ctx_info-pod_primary' | |
})] | |
})); | |
return output; | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerTemplate('/mobile/utils/loading', function () { | |
var output = []; | |
output.push(CTX.widgets.infoPod({ | |
content: [CTX.widgets.loading({})] | |
})); | |
return output; | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerTemplate('/mobile/secure/order/checkout/return_from_paypal', function () { | |
var output = []; | |
output.push(CTX.widgets.infoPod({ | |
content: [CTX.widgets.headingSection({ | |
heading: CTX.widgets.heading({ | |
level: 1, | |
text: 'OTTCatalyst::Controller::Mobile::Secure::Order::Checkout' | |
}) | |
})] | |
})); | |
return output; | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerTemplate('/mobile/secure/log_in', function () { | |
var output = [CTX.widgets.infoPod({ | |
className: 'ctx_info-pod_condensed', | |
content: [CTX.widgets.headingSection({ | |
heading: CTX.widgets.heading({ | |
level: 1, | |
text: 'Login or Sign Up' | |
}) | |
}), CTX.stash.signupForm.render()] | |
})]; | |
return output; | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerTemplate('/error/index', function () { | |
var output = []; | |
output.push(CTX.widgets.infoPod({ | |
content: [CTX.widgets.heading({ | |
text: 'Internal server error', | |
level: 1 | |
}), CTX.widgets.block({ | |
content: '', | |
className: 'ctx_block_error-image' | |
})], | |
className: 'ctx_info-pod_main' | |
})); | |
return output; | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerTemplate('/mobile/index', function () { | |
var output = []; | |
var searchContainerContent = []; | |
var searchContainer; | |
var searchForm; | |
searchContainerContent.push(CTX.widgets.text({ | |
subType: 'span', | |
text: 'www.', | |
className: 'ctx_text_prepend-search add-on ctx_text_medium-with-padding' | |
})); | |
searchContainerContent.push(CTX.widgets.input({ | |
subType: 'text', | |
name: 'domain', | |
className: 'ctx_input_search ctx_input_medium' | |
})); | |
searchContainerContent.push(CTX.widgets.button({ | |
subType: 'submit', | |
text: CTX.helpers.getIconGlyph('search'), | |
name: 'domainsearchbtn', | |
className: 'ctx_button_primary ctx_button_medium ctx_button_flat' | |
})); | |
searchContainer = CTX.widgets.block({ | |
subType: 'div', | |
content: searchContainerContent, | |
className: 'ctx_block_search-container input-prepend input-append' | |
}); | |
searchForm = CTX.widgets.form({ | |
action: { | |
URI: { | |
path: '/mobile/order/domainresults/results_page' | |
} | |
}, | |
content: searchContainer | |
}); | |
output.push(CTX.widgets.infoPod({ | |
content: [CTX.widgets.heading({ | |
level: 1, | |
text: 'The UK\'s #1 choice for domains', | |
className: 'ctx_heading_looks-like-h3' | |
}), CTX.widgets.heading({ | |
level: 2, | |
text: 'We register more .uk domains than anyone else!', | |
className: 'ctx_heading_looks-like-h4 ctx_heading_light' | |
}), CTX.widgets.image({ | |
path: '/library/CTX/img/mobile/search-for-domain.png', | |
title: 'Search for domain', | |
className: 'ctx_image_search-domain' | |
}), searchForm, CTX.widgets.heading({ | |
level: 3, | |
text: 'Popular domains' | |
}), CTX.loadFragment('/mobile/index/fragment/popularDomains', {}), CTX.widgets.block({ | |
subType: 'div', | |
className: 'ctx_block_center', | |
content: [CTX.widgets.link({ | |
action: { | |
URI: { | |
host: 'www.123-reg.co.uk', | |
path: '/', | |
port: null | |
} | |
}, | |
text: 'Full website' | |
}), ' links below'] | |
})], | |
className: 'ctx_info-pod_primary' | |
})); | |
return output; | |
}); | |
CTX.registerFragment('/mobile/index/fragment/popularDomains', function () { | |
var output = []; | |
var tableContainer = { | |
rows: [], | |
subType: 'body' | |
}; | |
var cellCallbacks = { | |
saleLabel: function (value, domain) { | |
var className = ['ctx_tag_sale']; | |
if (value === null) { | |
return ''; | |
} | |
if ('saleLabelClassName' in domain) { | |
className.push(domain.saleLabelClassName); | |
} | |
return CTX.widgets.tag({ | |
text: value, | |
className: className | |
}); | |
}, | |
price: function (value, domain) { | |
var price = CTX.productPrice.getPriceObject(1, CTX.helpers.domain.getExtensionId(domain.name)); | |
return CTX.productPrice.getPriceString(price.lowest_yearly_net_price); | |
}, | |
priceLabel: function (value) { | |
if (value === null) { | |
value = 'PER YEAR'; | |
} | |
return value; | |
} | |
}; | |
var order = ['name', 'saleLabel', 'price', 'priceLabel']; | |
var popularDomains = [{ | |
name: '.co.uk' | |
}, { | |
name: '.com' | |
}, { | |
name: '.org' | |
}, { | |
name: '.eu' | |
}, { | |
name: '.net' | |
}]; | |
popularDomains.forEach(function (domain) { | |
var row = { | |
cells: [], | |
className: 'ctx_table_popular-domain' + domain.name.replace(/\./g, '-') | |
}; | |
order.forEach(function (key) { | |
var value = null; | |
if (key in domain) { | |
value = domain[key]; | |
} | |
if (key in cellCallbacks) { | |
value = cellCallbacks[key](value, domain); | |
} | |
row.cells.push({ | |
content: [value], | |
className: 'ctx_table_popular-domain-' + key | |
}); | |
}); | |
tableContainer.rows.push(row); | |
}); | |
output.push(CTX.widgets.table({ | |
container: [tableContainer], | |
className: 'ctx_table_popular-domains' | |
})); | |
return output; | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerTemplate('/mobile/logout', function () { | |
var output = []; | |
output.push(CTX.widgets.infoPod({ | |
content: [CTX.widgets.headingSection({ | |
heading: CTX.widgets.heading({ | |
level: 1, | |
text: 'OTTCatalyst::Controller::Mobile' | |
}) | |
})] | |
})); | |
return output; | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
var checkWhoisPresent = function (parent) { | |
var items = CTX.basket.getItems(); | |
var returnValue = false; | |
if (null === items) { | |
return returnValue; | |
} | |
items.forEach(function (item) { | |
if (Number(parent) === Number(item.parentId) && 'Whois Privacy' === item.product) { | |
returnValue = true; | |
} | |
}); | |
return returnValue; | |
}; | |
CTX.registerTemplate('/mobile/order/whoisprivacy/offer_whois_privacy', function () { | |
var output = []; | |
var table = CTX.widgets.resultTable({ | |
className: 'ctx_table_modern', | |
columns: [{ | |
dataId: 'domainName', | |
content: 'Domain', | |
className: 'ctx_text_small ctx_text_muted ctx_span7', | |
sortable: false | |
}, { | |
dataId: 'periodAndCost', | |
content: 'Period & cost', | |
sortable: false, | |
className: 'ctx_span12' | |
}], | |
columnFilters: { | |
domainName: { | |
content: function (data) { | |
var output = []; | |
output.push(CTX.widgets.text({ | |
text: CTX.helpers.domain.truncateHostname(data.hostname, 10) | |
})); | |
output.push(CTX.widgets.text({ | |
text: data.extension, | |
className: 'ctx_text_active' | |
})); | |
return output; | |
} | |
}, | |
periodAndCost: { | |
content: function (data) { | |
var output = []; | |
var price = ''; | |
var productId = CTX.productPrice.getProductIdFromName('Whois Privacy'); | |
if (null !== productId && Number(data.years) > 0) { | |
price = CTX.productPrice.getPrice(productId, 0, Number(data.years) * 12); | |
} | |
output.push(CTX.widgets.text({ | |
text: data.years + ' yr - ' + CTX.productPrice.getPriceString(price) + ' ' | |
})); | |
if (checkWhoisPresent(data.id)) { | |
return 'In Basket'; | |
} | |
output.push(CTX.widgets.button({ | |
text: 'Add', | |
className: 'ctx_button_cta pull-right', | |
target: '_blank', | |
action: { | |
callback: function () { | |
var callback = function () { | |
table.rebuildElement(); | |
}; | |
CTX.basket.add({ | |
product: 'Whois Privacy', | |
parent: data.id, | |
years: data.years | |
}, callback); | |
} | |
} | |
})); | |
return output; | |
} | |
} | |
}, | |
resultSetHandler: CTX.stash.tableHandler | |
}); | |
output.push(CTX.widgets.infoPod({ | |
className: 'ctx_info-pod_condensed', | |
content: [CTX.widgets.heading({ | |
level: 1, | |
text: 'Add WHOIS privacy' | |
}), CTX.widgets.block({ | |
content: ['When you register a domain with any ', 'registrar your registration details are ', 'automatically entered into a publicly ', 'available WHOIS database. But with ', 'WHOIS privacy, it replaces your details ', 'with generic information in the WHOIS ', 'database.'], | |
subType: 'div', | |
className: 'ctx_block_muted' | |
}), table, CTX.widgets.block({ | |
className: 'clearfix', | |
content: [CTX.widgets.button({ | |
action: { | |
URI: { | |
path: '/mobile/secure/order/registrantdetails/register' | |
} | |
}, | |
text: 'Continue to registration', | |
className: ['ctx_button_primary-cta', 'ctx_button_chevron-right', 'ctx_button_cta', 'pull-right'] | |
})] | |
})] | |
})); | |
return output; | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerTemplate('/mobile/secure/order/registrantdetails/register', function () { | |
var output = []; | |
output.push(CTX.widgets.infoPod({ | |
className: 'ctx_info-pod_condensed', | |
content: [CTX.widgets.heading({ | |
level: 1, | |
className: 'ctx_heading_looks-like-h3', | |
text: 'Registrant Details' | |
}), CTX.widgets.block({ | |
content: 'The information entered below will be used to register your domain name and represents the owner of the domain.' | |
}), CTX.widgets.block({ | |
subType: 'br' | |
}), CTX.widgets.infoPod({ | |
className: 'ctx_info-pod_primary', | |
content: [CTX.stash.MobileSecureOrderRegistrantDetails.render()] | |
}), CTX.widgets.block({ | |
subType: 'br' | |
})] | |
})); | |
return output; | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerTemplate('/mobile/secure/order/checkout/return_from_card_security', function () { | |
var output = []; | |
output.push(CTX.widgets.infoPod({ | |
content: [CTX.widgets.headingSection({ | |
heading: CTX.widgets.heading({ | |
level: 1, | |
text: 'OTTCatalyst::Controller::Mobile::Secure::Order::Checkout' | |
}) | |
})] | |
})); | |
return output; | |
}); | |
}(window.CTX)); | |
(function (CTX) { | |
'use strict'; | |
CTX.registerTemplate('/mobile/secure/order/checkout/redirect_to_card_security', function () { | |
var output = []; | |
output.push(CTX.widgets.infoPod({ | |
content: [CTX.widgets.headingSection({ | |
heading: CTX.widgets.heading({ | |
level: 1, | |
text: 'OTTCatalyst::Controller::Mobile::Secure::Order::Checkout' | |
}) | |
})] | |
})); | |
return output; | |
}); | |
}(window.CTX)); | |
(function (CTX, $) { | |
'use strict'; | |
CTX.registerTemplate('/mobile/order/basket/basket', function () { | |
var output = []; | |
var tableHeader = { | |
rows: [], | |
subType: 'head' | |
}; | |
var tableContainer = { | |
rows: [], | |
subType: 'body' | |
}; | |
var totalsTable = { | |
rows: [], | |
subType: 'body' | |
}; | |
var toggleVoucherForm = function (el) { | |
var $element = $(el.currentTarget); | |
if ($element.hasClass('ctx_link')) { | |
$element.addClass('hidden'); | |
$('.ctx_block_voucherCode-form').show(); | |
} else if ($element.hasClass('ctx_button')) { | |
$('.ctx_block_voucherCode > .ctx_link').removeClass('hidden'); | |
$element.parents('.ctx_block_voucherCode-form').removeClass('ctx_block_invalid-voucher').removeClass('ctx_block_valid-voucher').hide(); | |
} | |
}; | |
var getRemoveBtn = function (productId) { | |
var trashBtn = CTX.widgets.button({ | |
text: [CTX.widgets.icon({ | |
subType: 'trash' | |
})], | |
action: { | |
URI: { | |
path: '/order/basket/remove/' + productId | |
}, | |
callback: function (e) { | |
e.preventDefault(); | |
CTX.basket.remove(productId); | |
} | |
} | |
}); | |
return trashBtn; | |
}; | |
var coUkBundleName = function (domain) { | |
var product = [CTX.widgets.block({ | |
content: [CTX.helpers.domain.truncateHostname(domain.hostname, 10), CTX.widgets.text({ | |
text: '.uk', | |
className: 'ctx_text_success' | |
})], | |
subType: 'div' | |
})]; | |
product.push(CTX.widgets.block({ | |
content: ['Includes ', CTX.widgets.text({ | |
text: '.co.uk', | |
className: 'ctx_text_success' | |
})] | |
})); | |
return product; | |
}; | |
var isCoUkBundle = function (domain, childProducts) { | |
if ('.co.uk' === domain.extension && childProducts.length === 1) { | |
return true; | |
} | |
return false; | |
}; | |
var cellCallbacks = { | |
name: function (domain, childProducts) { | |
if (true === isCoUkBundle(domain, childProducts)) { | |
return coUkBundleName(domain); | |
} | |
var domainName = CTX.helpers.domain.truncateHostname(domain.hostname, 10); | |
var ext = CTX.widgets.text({ | |
text: domain.extension, | |
className: 'ctx_text_success' | |
}); | |
var product = [domainName, ext]; | |
if ('array' === CTX.helpers.typeOf(childProducts) && childProducts.length > 0) { | |
product = [CTX.widgets.block({ | |
content: product, | |
subType: 'div' | |
})]; | |
childProducts.forEach(function (childItem) { | |
product.push(CTX.widgets.block({ | |
content: [CTX.widgets.text({ | |
text: childItem.product + ' +' + CTX.productPrice.getPriceString(childItem.netPrice), | |
className: 'ctx_text_success' | |
})], | |
subType: 'div' | |
})); | |
}); | |
} | |
return product; | |
}, | |
duration: function (domain, childProducts) { | |
var duration; | |
var plural = ''; | |
var voucher = 3.99; | |
var months = domain.years * 12; | |
var discount = 0; | |
var actualAmount = domain.netPrice; | |
if (domain.years > 1) { | |
plural = 's'; | |
} | |
duration = domain.years + ' yr' + plural + ' - '; | |
if (true === isCoUkBundle(domain, childProducts)) { | |
actualAmount += CTX.productPrice.getPrice(1, CTX.helpers.domain.getExtensionId('.uk'), months, 1); | |
discount = (voucher * (months / 12)); | |
actualAmount -= discount; | |
} | |
duration += CTX.productPrice.getPriceString(actualAmount); | |
if ('array' === CTX.helpers.typeOf(childProducts) && childProducts.length > 0) { | |
duration = CTX.widgets.block({ | |
content: duration, | |
subType: 'div' | |
}); | |
} | |
return [duration]; | |
}, | |
action: function (domain, childProducts) { | |
var trashBtns = [getRemoveBtn(domain.id)]; | |
if (true === isCoUkBundle(domain, childProducts)) { | |
trashBtns = []; | |
childProducts.forEach(function (childItem) { | |
trashBtns.push(CTX.widgets.block({ | |
content: [getRemoveBtn(childItem.id)], | |
subType: 'div' | |
})); | |
}); | |
return trashBtns; | |
} | |
if ('array' === CTX.helpers.typeOf(childProducts) && childProducts.length > 0) { | |
trashBtns = [CTX.widgets.block({ | |
content: [getRemoveBtn(domain.id)], | |
subType: 'div' | |
})]; | |
childProducts.forEach(function (childItem) { | |
trashBtns.push(CTX.widgets.block({ | |
content: [getRemoveBtn(childItem.id)], | |
subType: 'div' | |
})); | |
}); | |
} | |
return trashBtns; | |
} | |
}; | |
var tableColumns = ['Domain', 'Duration', '']; | |
var order = ['name', 'duration', 'action']; | |
var basketItems = CTX.basket.getItems(); | |
output.push(CTX.widgets.heading({ | |
level: 1, | |
text: 'Your Basket' | |
})); | |
var headerRow = { | |
cells: [] | |
}; | |
tableColumns.forEach(function (key) { | |
var cell = { | |
content: key | |
}; | |
headerRow.cells.push(cell); | |
}); | |
tableHeader.rows.push(headerRow); | |
basketItems.forEach(function (domain) { | |
if (domain.parentId === '0') { | |
var childItems = CTX.basket.getChildItems(domain.id); | |
var row = { | |
cells: [], | |
className: '' | |
}; | |
order.forEach(function (key) { | |
var cellContent = null; | |
var cellClass = null; | |
if (key in domain) { | |
cellContent = [domain[key]]; | |
} | |
if (key in cellCallbacks) { | |
cellContent = cellCallbacks[key](domain, childItems); | |
} | |
if (childItems.length > 0) { | |
row.className = 'ctx_table_mutliRow'; | |
} | |
if (childItems.length > 0 && key === 'duration') { | |
cellClass = 'cell-duration'; | |
} | |
row.cells.push({ | |
content: cellContent, | |
className: cellClass | |
}); | |
}); | |
tableContainer.rows.push(row); | |
} | |
}); | |
output.push(CTX.widgets.table({ | |
container: [tableHeader, tableContainer], | |
className: 'ctx_table_modern ctx_table_modern_basket' | |
})); | |
var voucherState = ''; | |
var feedbackMsg = ''; | |
var voucherLinkState = ''; | |
if (CTX.basket.hasOwnProperty('validVoucher')) { | |
if (CTX.basket.validVoucher === true) { | |
voucherState = 'ctx_block_valid-voucher'; | |
feedbackMsg = 'Discount applied to basket'; | |
} else { | |
voucherState = 'ctx_block_invalid-voucher'; | |
feedbackMsg = 'Sorry, voucher is invalid'; | |
} | |
voucherLinkState = 'hidden'; | |
} | |
var feedback = CTX.widgets.block({ | |
subType: 'div', | |
content: [CTX.widgets.button({ | |
text: CTX.widgets.icon({ | |
subType: 'remove-sign' | |
}), | |
action: { | |
callback: function (e) { | |
toggleVoucherForm(e); | |
} | |
} | |
}), CTX.widgets.block({ | |
subType: 'div', | |
content: [feedbackMsg] | |
})], | |
className: 'clearfix' | |
}); | |
var voucherForm = CTX.widgets.form({ | |
name: 'voucherCodeForm', | |
content: [CTX.widgets.input({ | |
subType: 'text', | |
name: 'voucherCode' | |
}), CTX.widgets.button({ | |
text: 'Apply', | |
action: { | |
URI: { | |
path: '/order/basket/voucher/', | |
params: { | |
voucher: $('.ctx_form_voucherCode input[name="voucherCode"]').val() | |
} | |
}, | |
callback: function (e) { | |
e.preventDefault(); | |
CTX.basket.validateVoucher($('.ctx_form_voucherCode input[name="voucherCode"]').val()); | |
} | |
}, | |
className: ['ctx_button_cta', 'ctx_button_chevron-right'] | |
})], | |
className: ['ctx_form_voucherCode', 'clearfix'] | |
}); | |
output.push(CTX.widgets.block({ | |
subType: 'div', | |
className: 'ctx_block ctx_block_voucherCode clearfix', | |
content: [CTX.widgets.link({ | |
text: 'I have a voucher', | |
action: { | |
callback: function (e) { | |
toggleVoucherForm(e); | |
} | |
}, | |
className: voucherLinkState | |
}), CTX.widgets.block({ | |
subType: 'div', | |
className: 'ctx_block ctx_block_voucherCode-form ' + voucherState, | |
content: [CTX.widgets.heading({ | |
level: 5, | |
text: 'Voucher code' | |
}), CTX.widgets.block({ | |
content: [feedback, voucherForm] | |
})] | |
})] | |
})); | |
var prices = CTX.basket.getPrices(); | |
totalsTable.rows.push({ | |
cells: [{ | |
content: 'Subtotal' | |
}, { | |
content: CTX.productPrice.getPriceString(prices.netPrice) | |
}] | |
}); | |
prices.netSaving = Number(prices.netSaving); | |
if (prices.netSaving > 0) { | |
totalsTable.rows.push({ | |
cells: [{ | |
content: 'Discounts' | |
}, { | |
content: CTX.productPrice.getPriceString(prices.netSaving) | |
}] | |
}); | |
} | |
if (Number(prices.netDiscount) > 0) { | |
totalsTable.rows.push({ | |
cells: [{ | |
content: 'Savings' | |
}, { | |
content: CTX.productPrice.getPriceString(prices.netDiscount) | |
}] | |
}); | |
} | |
totalsTable.rows.push({ | |
cells: [{ | |
content: 'Total (including VAT)' | |
}, { | |
content: CTX.productPrice.getPriceString(prices.grossPrice) | |
}] | |
}); | |
output.push(CTX.widgets.infoPod({ | |
content: [CTX.widgets.table({ | |
container: [totalsTable], | |
className: 'ctx_table_basket-totals' | |
})], | |
className: 'ctx_info-pod-basket' | |
})); | |
output.push(CTX.widgets.block({ | |
subType: 'div', | |
className: 'clearfix', | |
content: [CTX.widgets.button({ | |
action: { | |
URI: { | |
path: '/mobile/secure/order/checkout/checkout' | |
} | |
}, | |
text: 'Go to checkout', | |
className: ['ctx_button_cta', 'ctx_button_chevron-right', 'ctx_button_cta_basket'] | |
})] | |
})); | |
return [CTX.widgets.infoPod({ | |
className: 'ctx_info-pod_condensed', | |
content: output | |
})]; | |
}); | |
}(window.CTX, window.jQuery)); | |
(function (CTX, window) { | |
'use strict'; | |
CTX.widgets.helpers.registerClasses(); | |
History.Adapter.bind(window, 'statechange', function () { | |
var state = History.getState(); | |
if ('data' in state) { | |
CTX.handleAction(state.data); | |
} | |
}); | |
CTX.event.listen('action.callResponse', function () { | |
CTX.tracking.pageView(CTX.URI); | |
}); | |
$(window).load(function () { | |
var givenStash; | |
if ('stash' in CTX && null !== CTX.stash) { | |
givenStash = CTX.stash; | |
} | |
if ('firstAction' in CTX.data) { | |
CTX.loadAction({ | |
URI: CTX.data.firstAction | |
}, true, givenStash); | |
} | |
}); | |
}(window.CTX, window)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment