aboutsummaryrefslogtreecommitdiff
path: root/mod/minify/lib/min/builder/bm.js
diff options
context:
space:
mode:
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-12 01:07:33 +0000
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-12 01:07:33 +0000
commitfbc1fdd0b7244d2f03164b62eb893223ff930319 (patch)
tree2b1c79d2795ee2d1ecc3b019fe3643bcf52010ad /mod/minify/lib/min/builder/bm.js
parent3a6e0dc6e80434789abe5b98e2748a6fc79bf320 (diff)
downloadelgg-fbc1fdd0b7244d2f03164b62eb893223ff930319.tar.gz
elgg-fbc1fdd0b7244d2f03164b62eb893223ff930319.tar.bz2
Converted most forms to use elgg_view_form (therefore also moved the views to forms/*). Some views are left that _only_ do elgg_view_form, so I wonder if those should even be kept around.
git-svn-id: http://code.elgg.org/elgg/trunk@8127 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/minify/lib/min/builder/bm.js')
-rw-r--r--mod/minify/lib/min/builder/bm.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/mod/minify/lib/min/builder/bm.js b/mod/minify/lib/min/builder/bm.js
new file mode 100644
index 000000000..10d194381
--- /dev/null
+++ b/mod/minify/lib/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