Posted by skoch on 3. Januar 2012
$(function() { /******* extend jQuery library **/ (function( $ ) { $( “.ui-autocomplete-input” ).live( “autocompleteopen”, function() { var autocomplete = $( this ).data( “autocomplete” ); var menu = autocomplete.menu; if ( !autocomplete.options.selectFirst ) return; /* together with bgiframe this does not work as it should because bgiframe creates an iframe as the first child [...]
Filed under: JavaScript, jQuery
Kommentare deaktiviert
Posted by skoch on 8. November 2010
If a jQuery UI dialog is open centered and the browser is resized, than the diqlog is no longer placed in the center of the window. Therefor we have to move it back to the center of the window. var windowResizeTimeout; $(window).resize(function() { clearTimeout ( windowResizeTimeout ); windowResizeTimeout = setTimeout ( ‘$(“.ui-dialog-content”).dialog(“option”, “position”, “center”);’, 250 [...]
Filed under: JavaScript
No Comments »
Posted by skoch on 1. August 2010
ForEach für JavaScript: for ( var key in myArray ) { alert ( myArray [ key ] ); }
Filed under: JavaScript
No Comments »
Posted by skoch on 16. Juli 2009
/* * getWinSize ( window ) */ function getWinSize ( win ) { if ( !win ) win = window; var ret = new Object(); if ( typeof win.innerWidth != ‘undefined’ ) { ret.width = win.innerWidth; ret.height = win.innerHeight; } else { var obj = getBody ( win ); ret.width = parseInt ( obj.clientWidth ); ret.height = [...]
Filed under: JavaScript
No Comments »
Posted by skoch on 14. Juli 2009
zu einer bestimmte Stelle scrollen: var obj = document.getElementById(“myDIV”); obj.scrollTop = 0; zum Ende scrollen: var obj = document.getElementById(“myDIV”); obj.scrollTop = obj.scrollHeight;
Filed under: JavaScript
No Comments »
Posted by skoch on 23. April 2009
this.Typeof = function (object) { if (object == null) return ‘null’; if (typeof object == ‘undefined’) return ‘undefined’; if (object.nodeName && object.nodeType == 1) return ‘element’; if (object.nodeName && object.nodeType == 3 && (!/\S/).test(object.nodeValue)) return ‘textnode’; if (object instanceof Function) return ‘function’; if (object instanceof Array) return ‘array’; if (typeof object == ‘object’) return ‘object’; [...]
Filed under: JavaScript
No Comments »
Posted by skoch on 6. Februar 2009
window.location.href.replace(/?.*/, “”).replace(/(.+/).*/, “$1″); ———– // Funktion von Sebastian // ersetzt alle absoluten Pfade durch relative, sofern diese vom gleichen Verzeichnis ausgehen // dazu wird zuerst die aktuelle Location zerlegt und danach der Eintrag im Text gesucht und entfernt function switchAbsToRelURL ( object ) { // komplettes Textfeld durchsuchen und absolute Pfade durch relative ersetzen [...]
Filed under: JavaScript
No Comments »
Posted by skoch on
/* simulate obj.innerText / obj.textContent */ function getObjInnerText ( obj ) { if ( obj.innerText ) // IE; return obj.innerText; else if (obj.textContent) return obj.textContent; else return false; }
Filed under: JavaScript
No Comments »
Posted by skoch on
/* enhance string prototype */ String.prototype.leftTrim = function () { return ( this.replace ( /^s+/, “” ) ); }; String.prototype.rightTrim = function () { return ( this.replace ( /s+$/, “” ) ); }; // combines “leftTrim” and “rightTrim”; String.prototype.Trim = function () { return ( this.replace ( /s+$/, “” ).replace ( /^s+/, [...]
Filed under: JavaScript
No Comments »