From 6ca0fbc6a306640800e1ada8de48342abc360172 Mon Sep 17 00:00:00 2001 From: ewinslow Date: Sat, 12 Feb 2011 21:01:07 +0000 Subject: Doh, how did this get here? git-svn-id: http://code.elgg.org/elgg/trunk@8172 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/minify/lib/min/builder/_index.js | 242 ------------------------------ mod/minify/lib/min/builder/bm.js | 36 ----- mod/minify/lib/min/builder/index.php | 182 ---------------------- mod/minify/lib/min/builder/ocCheck.php | 36 ----- mod/minify/lib/min/builder/rewriteTest.js | 1 - 5 files changed, 497 deletions(-) delete mode 100644 mod/minify/lib/min/builder/_index.js delete mode 100644 mod/minify/lib/min/builder/bm.js delete mode 100644 mod/minify/lib/min/builder/index.php delete mode 100644 mod/minify/lib/min/builder/ocCheck.php delete mode 100644 mod/minify/lib/min/builder/rewriteTest.js (limited to 'mod/minify/lib/min/builder') diff --git a/mod/minify/lib/min/builder/_index.js b/mod/minify/lib/min/builder/_index.js deleted file mode 100644 index 8e5313a3b..000000000 --- a/mod/minify/lib/min/builder/_index.js +++ /dev/null @@ -1,242 +0,0 @@ -var MUB = { - _uid : 0 - ,_minRoot : '/min/?' - ,checkRewrite : function () { - var testUri = location.pathname.replace(/\/[^\/]*$/, '/rewriteTest.js').substr(1); - function fail() { - $('#minRewriteFailed')[0].className = 'topNote'; - }; - $.ajax({ - url : '../f=' + testUri + '&' + (new Date()).getTime() - ,success : function (data) { - if (data === '1') { - MUB._minRoot = '/min/'; - $('span.minRoot').html('/min/'); - } else - fail(); - } - ,error : fail - }); - } - /** - * Get markup for new source LI element - */ - ,newLi : function () { - return '
  • http://' + location.host + '/' - + ' ' - + '
  • '; - } - /** - * Add new empty source LI and attach handlers to buttons - */ - ,addLi : function () { - $('#sources').append(MUB.newLi()); - var li = $('#li' + MUB._uid)[0]; - $('button[title=Remove]', li).click(function () { - $('#results').hide(); - var hadValue = !!$('input', li)[0].value; - $(li).remove(); - }); - $('button[title$=Earlier]', li).click(function () { - $(li).prev('li').find('input').each(function () { - $('#results').hide(); - // this = previous li input - var tmp = this.value; - this.value = $('input', li).val(); - $('input', li).val(tmp); - MUB.updateAllTestLinks(); - }); - }); - $('button[title$=Later]', li).click(function () { - $(li).next('li').find('input').each(function () { - $('#results').hide(); - // this = next li input - var tmp = this.value; - this.value = $('input', li).val(); - $('input', li).val(tmp); - MUB.updateAllTestLinks(); - }); - }); - ++MUB._uid; - } - /** - * In the context of a source LI element, this will analyze the URI in - * the INPUT and check the URL on the site. - */ - ,liUpdateTestLink : function () { // call in context of li element - if (! $('input', this)[0].value) - return; - var li = this; - $('span', this).html(''); - var url = 'http://' + location.host + '/' - + $('input', this)[0].value.replace(/^\//, ''); - $.ajax({ - url : url - ,complete : function (xhr, stat) { - if ('success' == stat) - $('span', li).html('✓'); - else { - $('span', li).html('') - .find('button').click(function () { - MUB.liUpdateTestLink.call(li); - }); - } - } - ,dataType : 'text' - }); - } - /** - * Check all source URLs - */ - ,updateAllTestLinks : function () { - $('#sources li').each(MUB.liUpdateTestLink); - } - /** - * In a given array of strings, find the character they all have at - * a particular index - * @param Array arr array of strings - * @param Number pos index to check - * @return mixed a common char or '' if any do not match - */ - ,getCommonCharAtPos : function (arr, pos) { - var i - ,l = arr.length - ,c = arr[0].charAt(pos); - if (c === '' || l === 1) - return c; - for (i = 1; i < l; ++i) - if (arr[i].charAt(pos) !== c) - return ''; - return c; - } - /** - * Get the shortest URI to minify the set of source files - * @param Array sources URIs - */ - ,getBestUri : function (sources) { - var pos = 0 - ,base = '' - ,c; - while (true) { - c = MUB.getCommonCharAtPos(sources, pos); - if (c === '') - break; - else - base += c; - ++pos; - } - base = base.replace(/[^\/]+$/, ''); - var uri = MUB._minRoot + 'f=' + sources.join(','); - if (base.charAt(base.length - 1) === '/') { - // we have a base dir! - var basedSources = sources - ,i - ,l = sources.length; - for (i = 0; i < l; ++i) { - basedSources[i] = sources[i].substr(base.length); - } - base = base.substr(0, base.length - 1); - var bUri = MUB._minRoot + 'b=' + base + '&f=' + basedSources.join(','); - //window.console && console.log([uri, bUri]); - uri = uri.length < bUri.length - ? uri - : bUri; - } - return uri; - } - /** - * Create the Minify URI for the sources - */ - ,update : function () { - MUB.updateAllTestLinks(); - var sources = [] - ,ext = false - ,fail = false; - $('#sources input').each(function () { - var m, val; - if (! fail && this.value && (m = this.value.match(/\.(css|js)$/))) { - var thisExt = m[1]; - if (ext === false) - ext = thisExt; - else if (thisExt !== ext) { - fail = true; - return alert('extensions must match!'); - } - this.value = this.value.replace(/^\//, ''); - if (-1 != $.inArray(this.value, sources)) { - fail = true; - return alert('duplicate file!'); - } - sources.push(this.value); - } - }); - if (fail || ! sources.length) - return; - $('#groupConfig').val(" 'keyName' => array('//" + sources.join("', '//") + "'),"); - var uri = MUB.getBestUri(sources) - ,uriH = uri.replace(//, '>').replace(/&/, '&'); - $('#uriA').html(uriH)[0].href = uri; - $('#uriHtml').val( - ext === 'js' - ? '' - : '' - ); - $('#results').show(); - } - /** - * Handler for the "Add file +" button - */ - ,addButtonClick : function () { - $('#results').hide(); - MUB.addLi(); - MUB.updateAllTestLinks(); - $('#update').show().click(MUB.update); - $('#sources li:last input')[0].focus(); - } - /** - * Runs on DOMready - */ - ,init : function () { - $('#app').show(); - $('#sources').html(''); - $('#add button').click(MUB.addButtonClick); - // make easier to copy text out of - $('#uriHtml, #groupConfig').click(function () { - this.select(); - }).focus(function () { - this.select(); - }); - $('a.ext').attr({target:'_blank'}); - if (location.hash) { - // make links out of URIs from bookmarklet - $('#getBm').hide(); - $('#bmUris').html('

    Found by bookmarklet: /' - + location.hash.substr(1).split(',').join(' | /') - + '

    ' - ); - $('#bmUris a').click(function () { - MUB.addButtonClick(); - $('#sources li:last input').val(this.innerHTML) - MUB.liUpdateTestLink.call($('#sources li:last')[0]); - $('#results').hide(); - return false; - }).attr({title:'Add file +'}); - } else { - // copy bookmarklet code into href - var bmUri = location.pathname.replace(/\/[^\/]*$/, '/bm.js').substr(1); - $.ajax({ - url : '../?f=' + bmUri - ,success : function (code) { - $('#bm')[0].href = code - .replace('%BUILDER_URL%', location.href) - .replace(/\n/g, ' '); - } - ,dataType : 'text' - }); - $.browser.msie && $('#getBm p:last').append(' Sorry, not supported in MSIE!'); - MUB.addButtonClick(); - } - MUB.checkRewrite(); - } -}; -window.onload = MUB.init; \ No newline at end of file diff --git a/mod/minify/lib/min/builder/bm.js b/mod/minify/lib/min/builder/bm.js deleted file mode 100644 index 10d194381..000000000 --- a/mod/minify/lib/min/builder/bm.js +++ /dev/null @@ -1,36 +0,0 @@ -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 diff --git a/mod/minify/lib/min/builder/index.php b/mod/minify/lib/min/builder/index.php deleted file mode 100644 index b24286f09..000000000 --- a/mod/minify/lib/min/builder/index.php +++ /dev/null @@ -1,182 +0,0 @@ - - - - - Minify URI Builder - - - - -

    Note: Please set $min_cachePath -in /min/config.php to improve performance.

    - - -

    Note: Your webserver does not seem to -support mod_rewrite (used in /min/.htaccess). Your Minify URIs will contain "?", which -may reduce the benefit of proxy cache servers.

    - -

    Minify URI Builder

    - - - -
    - -

    Create a list of Javascript or CSS files (or 1 is fine) you'd like to combine -and click [Update].

    - -
    -
    - -
    - -

    - -
    - -

    Minify URI

    -

    Place this URI in your HTML to serve the files above combined, minified, compressed and -with cache headers.

    - - - -
    URI/min (opens in new window)
    HTML
    - -

    How to serve these files as a group

    -

    For the best performance you can serve these files as a pre-defined group with a URI -like: /min/?g=keyName

    -

    To do this, add a line like this to /min/groupsConfig.php:

    - -
    return array(
    -	... your existing groups here ...
    -
    -);
    - -

    Make sure to replace keyName with a unique key for this group.

    -
    - -
    -

    Find URIs on a Page

    -

    You can use the bookmarklet below to fetch all CSS & Javascript URIs from a page -on your site. When you active it, this page will open in a new window with a list of -available URIs to add.

    - -

    Create Minify URIs (right-click, add to bookmarks)

    -
    - -

    Combining CSS files that contain @import

    -

    If your CSS files contain @import declarations, Minify will not -remove them. Therefore, you will want to remove those that point to files already -in your list, and move any others to the top of the first file in your list -(imports below any styles will be ignored by browsers as invalid).

    -

    If you desire, you can use Minify URIs in imports and they will not be touched -by Minify. E.g. @import "/min/?g=css2";

    - -
    - -
    -

    Need help? Search or post to the Minify discussion list.

    -

    This app is minified :) view -source

    - - - - - - - ob_get_contents() - ,'id' => __FILE__ - ,'lastModifiedTime' => max( - // regenerate cache if either of these change - filemtime(__FILE__) - ,filemtime(dirname(__FILE__) . '/../config.php') - ) - ,'minifyAll' => true - ,'encodeOutput' => $encodeOutput -); -ob_end_clean(); - -set_include_path(dirname(__FILE__) . '/../lib' . PATH_SEPARATOR . get_include_path()); - -require 'Minify.php'; - -if (0 === stripos(PHP_OS, 'win')) { - Minify::setDocRoot(); // we may be on IIS -} -Minify::setCache(isset($min_cachePath) ? $min_cachePath : null); -Minify::$uploaderHoursBehind = $min_uploaderHoursBehind; - -Minify::serve('Page', $serveOpts); diff --git a/mod/minify/lib/min/builder/ocCheck.php b/mod/minify/lib/min/builder/ocCheck.php deleted file mode 100644 index 8cc19af8b..000000000 --- a/mod/minify/lib/min/builder/ocCheck.php +++ /dev/null @@ -1,36 +0,0 @@ - 'World!' - ,'method' => 'deflate' - )); - $he->encode(); - $he->sendAll(); - -} else { - // echo status "0" or "1" - header('Content-Type: text/plain'); - echo (int)$_oc; -} diff --git a/mod/minify/lib/min/builder/rewriteTest.js b/mod/minify/lib/min/builder/rewriteTest.js deleted file mode 100644 index 56a6051ca..000000000 --- a/mod/minify/lib/min/builder/rewriteTest.js +++ /dev/null @@ -1 +0,0 @@ -1 \ No newline at end of file -- cgit v1.2.3