diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2014-03-15 15:11:12 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2014-03-15 15:11:12 -0300 |
commit | d42607998482e36865c1d8a443f92a457f6b2f3b (patch) | |
tree | 9840be82dbf1b58da42d0a66f20b23ea0b01cf55 /vendors/min/builder/bm.js | |
download | elgg-d42607998482e36865c1d8a443f92a457f6b2f3b.tar.gz elgg-d42607998482e36865c1d8a443f92a457f6b2f3b.tar.bz2 |
Squashed 'mod/minify/' content from commit 5949018
git-subtree-dir: mod/minify
git-subtree-split: 594901859d5afc1fa364322428bd7a6d5c6a3f96
Diffstat (limited to 'vendors/min/builder/bm.js')
-rw-r--r-- | vendors/min/builder/bm.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/vendors/min/builder/bm.js b/vendors/min/builder/bm.js new file mode 100644 index 000000000..10d194381 --- /dev/null +++ b/vendors/min/builder/bm.js @@ -0,0 +1,36 @@ +javascript:(function() { + var d = document + ,uris = [] + ,i = 0 + ,o + ,home = (location + '').split('/').splice(0, 3).join('/') + '/'; + function add(uri) { + return (0 === uri.indexOf(home)) + && (!/[\?&]/.test(uri)) + && uris.push(escape(uri.substr(home.length))); + }; + function sheet(ss) { + // we must check the domain with add() before accessing ss.cssRules + // otherwise a security exception will be thrown + if (ss.href && add(ss.href) && ss.cssRules) { + var i = 0, r; + while (r = ss.cssRules[i++]) + r.styleSheet && sheet(r.styleSheet); + } + }; + while (o = d.getElementsByTagName('script')[i++]) + o.src && !(o.type && /vbs/i.test(o.type)) && add(o.src); + i = 0; + while (o = d.styleSheets[i++]) + /* http://www.w3.org/TR/DOM-Level-2-Style/stylesheets.html#StyleSheets-DocumentStyle-styleSheets + document.styleSheet is a list property where [0] accesses the 1st element and + [outOfRange] returns null. In IE, styleSheets is a function, and also throws an + exception when you check the out of bounds index. (sigh) */ + sheet(o); + if (uris.length) + window.open('%BUILDER_URL%#' + uris.join(',')); + else + alert('No js/css files found with URLs within "' + + home.split('/')[2] + + '".\n(This tool is limited to URLs with the same domain.)'); +})();
\ No newline at end of file |