This file contains hidden or 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 getCSSSelector(el) { | |
| var names = []; | |
| while (el.parentNode) { | |
| if (el.id) { | |
| names.unshift('#' + el.id); | |
| break; | |
| } else { | |
| if (el == el.ownerDocument.documentElement) { | |
| names.unshift(el.tagName); | |
| } else { |
This file contains hidden or 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
| /** | |
| * Vertically center an element (popup modal) to the viewport | |
| * If the element is taller than the window height absolute positioning is | |
| * used so that the element will scroll with the docuemnt | |
| * | |
| * @param {boolean} animate Animate to new position or move immediately? Defaults true | |
| * @param {boolean} centerHorizontal Center the element horizontally? Defaults true | |
| * @param {boolean} centerVertical Center the element vertically? Defaults true | |
| * | |
| * @chainable |
This file contains hidden or 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
| /** | |
| * Add a soft hypen (­) to any words in the string longer than the given character length | |
| * | |
| * @param {string} str Input string | |
| * @param {int} maxWordSize Max character length of a word | |
| * @param {int} minFragmentSize [optional] Minimum chars to leave after a hyphen | |
| * @return {string} | |
| */ | |
| var hyphenateLongWords = function (str, maxWordSize, minFragmentSize) { | |
| // TODO: Find out char codes of word break chars |
NewerOlder