CGI-WebToolkit
view release on metacpan or search on metacpan
t/private/javascripts/jscolor.js view on Meta::CPAN
if(e[i].href) base = e[i].href
}
var e = document.getElementsByTagName('script')
for(var i=0; i<e.length; i++) {
if(e[i].src && /(^|\/)jscolor\.js([?#].*)?$/i.test(e[i].src)) {
var src = new jscolor.URI(e[i].src)
var srcAbs = src.toAbsolute(base)
srcAbs.path = srcAbs.path.replace(/[^\/]+$/, '') // remove filename
delete srcAbs.query
delete srcAbs.fragment
return srcAbs.toString()
}
}
return false
},
bind : function() {
var matchClass = new RegExp('(^|\\s)('+jscolor.bindClass+')\\s*(\\{[^}]*\\})?', 'i')
var e = document.getElementsByTagName('input')
t/private/javascripts/jscolor.js view on Meta::CPAN
}
},
URI : function(uri) { // See RFC3986
this.scheme = null
this.authority = null
this.path = ''
this.query = null
this.fragment = null
this.parse = function(uri) {
var m = uri.match(/^(([A-Za-z][0-9A-Za-z+.-]*)(:))?((\/\/)([^\/?#]*))?([^?#]*)((\?)([^#]*))?((#)(.*))?/)
this.scheme = m[3] ? m[2] : null
this.authority = m[5] ? m[6] : null
this.path = m[7]
this.query = m[9] ? m[10] : null
this.fragment = m[12] ? m[13] : null
return this
}
this.toString = function() {
var result = ''
if(this.scheme != null) result = result + this.scheme + ':'
if(this.authority != null) result = result + '//' + this.authority
if(this.path != null) result = result + this.path
if(this.query != null) result = result + '?' + this.query
if(this.fragment != null) result = result + '#' + this.fragment
return result
}
this.toAbsolute = function(base) {
var base = new jscolor.URI(base)
var r = this
var t = new jscolor.URI
if(base.scheme == null) return false
t/private/javascripts/jscolor.js view on Meta::CPAN
t.path = base.path.replace(/[^\/]+$/,'')+r.path
}
t.path = removeDotSegments(t.path)
}
t.query = r.query
}
t.authority = base.authority
}
t.scheme = base.scheme
}
t.fragment = r.fragment
return t
}
function removeDotSegments(path) {
var out = ''
while(path) {
if(path.substr(0,3)=='../' || path.substr(0,2)=='./') {
path = path.replace(/^\.+/,'').substr(1)
} else if(path.substr(0,3)=='/./' || path=='/.') {
t/private/javascripts/prototype.js view on Meta::CPAN
if (Object.isElement(content)) {
element.parentNode.replaceChild(content, element);
return element;
}
content = Object.toHTML(content);
var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
if (Element._insertionTranslations.tags[tagName]) {
var nextSibling = element.next();
var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
parent.removeChild(element);
if (nextSibling)
fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
else
fragments.each(function(node) { parent.appendChild(node) });
}
else element.outerHTML = content.stripScripts();
content.evalScripts.bind(content).defer();
return element;
};
}
Element._returnOffset = function(l, t) {
var result = [l, t];
t/private/javascripts/prototype.js view on Meta::CPAN
},
'first-of-type': function(m) {
m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
},
'last-of-type': function(m) {
m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
},
'only-of-type': function(m) {
var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
},
nth: function(fragment, m) {
var mm, formula = m[6], predicate;
if (formula == 'even') formula = '2n+0';
if (formula == 'odd') formula = '2n+1';
if (mm = formula.match(/^(\d+)$/)) // digit only
return '[' + fragment + "= " + mm[1] + ']';
if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
if (mm[1] == "-") mm[1] = -1;
var a = mm[1] ? Number(mm[1]) : 1;
var b = mm[2] ? Number(mm[2]) : 0;
predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
"((#{fragment} - #{b}) div #{a} >= 0)]";
return new Template(predicate).evaluate({
fragment: fragment, a: a, b: b });
}
}
}
},
criteria: {
tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;',
className: 'n = h.className(n, r, "#{1}", c); c = false;',
id: 'n = h.id(n, r, "#{1}", c); c = false;',
attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;',
( run in 1.670 second using v1.01-cache-2.11-cpan-364913b4093 )