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
var scrollbarWidth; | |
function getScrollbarWidth() { | |
if (scrollbarWidth) { | |
return scrollbarWidth; | |
} | |
var inner = document.createElement('p'); | |
inner.style.width = '100%'; | |
inner.style.height = '200px'; | |
var outer = document.createElement('div'); |
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
javascript:(function(){function anc(e){var p='parentNode';e=$(e);var es=[];while(e=es[property])if(e.nodeType==1)es.push(e);return es;}function visible(el){el=$(el);if(!el){return false;}var a=anc(el);var c=a.length;var v=true;for(var i=0;i<c;i++){if(a[i].style.display=='none'||a[i].style.visibility=='hidden'){v=false;break;}}return v;}(function blinky(){var tmp=document.body.getElementsByTagName('*');tags=[];for(var j=0;j<tmp.length;j++)tags.push(tmp[j]);var fr=[];var ind=[];var l=tags.length;while(l--)var n=tags[l].tagName.toLowerCase();if(n=='iframe'||n=='script'||n=='link'){if(tags[l].tagName.toLowerCase()=='iframe')fr.push(tags[l]);tags[l]=null;ind.push(l);}while(ind.length)Array.splice.call(tags,ind.shift(),1);while(fr.length){try{tmp=fr.shift().contentWindow.document.body.getElementsByTagName('*');var tmp2=[];for(var j=0;j<tmp.length;j++)tmp2.push(tmp[j]);tags=Array.concat.apply(tags,tmp2);}catch(e){}}l=tags.length;if(typeof(lastTag)=='undefined')lastTag=null;if(lastTag)lastTag.style.visibility='';last |
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
function getObject(parts) | |
{ | |
if (typeof(parts) == 'string') | |
parts = parts.split('.'); | |
var obj = window; | |
for (var i = 0, p; obj && (p = parts[i]); i++) | |
{ | |
obj = (p in obj ? obj[p] : undefined); | |
} | |
return obj; |
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
//ported to prototype from http://www.csskarma.com/lab/slidinglabels/ | |
function formatSliderLabels(form) | |
{ | |
form = $(form); | |
var labelColor = '#999'; | |
var restingPosition = 5; | |
var topPosition = 6; | |
var duration = 0.2; | |
var labelAdjust = 10; | |
form.select('.slider label').each(function(el){ |
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
parseInt = parseInt.wrap(function(proceed, val, radix){ | |
if (typeof(radix) == 'undefined'){ | |
radix = 10; | |
} | |
return proceed(val, radix); | |
}); |
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
if (typeof(Autocompleter) != 'undefined') { // check if Autocompleter exists | |
Autocompleter.Base.addMethods({ // adds the listed functions to Autocompleter.Base | |
onKeyPress: Autocompleter.Base.prototype.onKeyPress.wrap(function(proceed, event){ // "wrap" the existing "onKeyPress" in this new function, exclude the "wrap" and just do onKeyPress: function(event) if you want to always overwrite the existing function | |
var args = $A(arguments); | |
args.shift(); // removes "proceed" from the arguments so only the original arguments will get passed to the original function | |
// place any code here you wish to execute before the original function | |
var returnVal = proceed.apply(this, args); // runs the original function | |
// place any code here you wish to execute after the original function | |
return returnVal; | |
}) |
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
Create an html page with a text area and a button. | |
The text area will accept a comma separated list of values. | |
When you click the button: | |
* Separate the values and add them to a styled list on the page and clear the text area. | |
+ Each element is displayed with alternating background color. | |
+ Clicking an item will remove it from the list. |
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
Array.prototype.pushReplace = function(pattern){ | |
var args = $A(arguments).slice(1); | |
this.push(pattern.replace(/\{(\d+)\}/g, function(pattern, index){ | |
return args[index].toString(); | |
})); | |
return this; | |
} |
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
$.extend({ | |
string: { | |
// public interface: $.tmpl | |
include: function(text, pattern){ | |
return text.indexOf(pattern) > -1; | |
}, | |
startsWith: function(text, pattern){ | |
return text.lastIndexOf(pattern, 0) === 0; | |
}, | |
endsWith: function(text, pattern){ |
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
Thu Mar 11 19:22:51 UTC 2021 |
OlderNewer