1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-01 20:00:42 +02:00

Adds Bootstrap styling to builder app

This commit is contained in:
Steve Clay
2014-03-12 10:35:14 -04:00
parent ea7fe90554
commit 9231aed49f
3 changed files with 18 additions and 14 deletions

View File

@@ -1,5 +1,8 @@
Minify Release History Minify Release History
(master)
* Builder styled with Bootstrap (thanks to help from acidvertigo)
Version 2.2.0 Version 2.2.0
* Fix handling of RegEx in certain situations in JSMin * Fix handling of RegEx in certain situations in JSMin
* Thanks to Vovan-VE for reporting this * Thanks to Vovan-VE for reporting this

View File

@@ -26,8 +26,8 @@ var MUB = {
*/ */
newLi : function () { newLi : function () {
return '<li id="li' + MUB._uid + '">http://' + location.host + '/<input type=text size=20>' + return '<li id="li' + MUB._uid + '">http://' + location.host + '/<input type=text size=20>' +
' <button title="Remove">x</button> <button title="Include Earlier">&uarr;</button>' + ' <button class="btn btn-danger btn-sm" title="Remove">x</button> <button class="btn btn-default btn-sm" title="Include Earlier">&uarr;</button>' +
' <button title="Include Later">&darr;</button> <span></span></li>'; ' <button class="btn btn-default btn-sm" title="Include Later">&darr;</button> <span></span></li>';
}, },
/** /**
* Add new empty source LI and attach handlers to buttons * Add new empty source LI and attach handlers to buttons
@@ -36,13 +36,13 @@ var MUB = {
$('#sources').append(MUB.newLi()); $('#sources').append(MUB.newLi());
var li = $('#li' + MUB._uid)[0]; var li = $('#li' + MUB._uid)[0];
$('button[title=Remove]', li).click(function () { $('button[title=Remove]', li).click(function () {
$('#results').hide(); $('#results').addClass('hide');
var hadValue = !!$('input', li)[0].value; var hadValue = !!$('input', li)[0].value;
$(li).remove(); $(li).remove();
}); });
$('button[title$=Earlier]', li).click(function () { $('button[title$=Earlier]', li).click(function () {
$(li).prev('li').find('input').each(function () { $(li).prev('li').find('input').each(function () {
$('#results').hide(); $('#results').addClass('hide');
// this = previous li input // this = previous li input
var tmp = this.value; var tmp = this.value;
this.value = $('input', li).val(); this.value = $('input', li).val();
@@ -52,7 +52,7 @@ var MUB = {
}); });
$('button[title$=Later]', li).click(function () { $('button[title$=Later]', li).click(function () {
$(li).next('li').find('input').each(function () { $(li).next('li').find('input').each(function () {
$('#results').hide(); $('#results').addClass('hide');
// this = next li input // this = next li input
var tmp = this.value; var tmp = this.value;
this.value = $('input', li).val(); this.value = $('input', li).val();
@@ -77,9 +77,9 @@ var MUB = {
url : url, url : url,
complete : function (xhr, stat) { complete : function (xhr, stat) {
if ('success' === stat) if ('success' === stat)
$('span', li).html('&#x2713;'); $('span', li).html('<a href="#" class="btn btn-success btn-sm disabled">&#x2713;</a>');
else { else {
$('span', li).html('<button><b>404! </b> recheck</button>') $('span', li).html('<button class="btn btn-warning btn-sm"><b>404! </b> recheck</button>')
.find('button').click(function () { .find('button').click(function () {
MUB.liUpdateTestLink.call(li); MUB.liUpdateTestLink.call(li);
}); });
@@ -184,16 +184,16 @@ var MUB = {
markup = '<link type="text/css" rel="stylesheet" href="' + uriH + '" />'; markup = '<link type="text/css" rel="stylesheet" href="' + uriH + '" />';
} }
$('#uriHtml').val(markup); $('#uriHtml').val(markup);
$('#results').show(); $('#results').removeClass('hide');
}, },
/** /**
* Handler for the "Add file +" button * Handler for the "Add file +" button
*/ */
addButtonClick : function () { addButtonClick : function () {
$('#results').hide(); $('#results').addClass('hide');
MUB.addLi(); MUB.addLi();
MUB.updateAllTestLinks(); MUB.updateAllTestLinks();
$('#update').show().click(MUB.update); $('#update').removeClass('hide').click(MUB.update);
$('#sources li:last input')[0].focus(); $('#sources li:last input')[0].focus();
}, },
/** /**
@@ -201,7 +201,7 @@ var MUB = {
*/ */
init : function () { init : function () {
$('#jsDidntLoad').remove(); $('#jsDidntLoad').remove();
$('#app').show(); $('#app').removeClass('hide');
$('#sources').html(''); $('#sources').html('');
$('#add button').click(MUB.addButtonClick); $('#add button').click(MUB.addButtonClick);
// make easier to copy text out of // make easier to copy text out of
@@ -213,7 +213,7 @@ var MUB = {
$('a.ext').attr({target:'_blank'}); $('a.ext').attr({target:'_blank'});
if (location.hash) { if (location.hash) {
// make links out of URIs from bookmarklet // make links out of URIs from bookmarklet
$('#getBm').hide(); $('#getBm').addClass('hide');
var i = 0, found = location.hash.substr(1).split(','), l = found.length; var i = 0, found = location.hash.substr(1).split(','), l = found.length;
$('#bmUris').html('<p><strong>Found by bookmarklet:</strong> /</p>'); $('#bmUris').html('<p><strong>Found by bookmarklet:</strong> /</p>');
var $p = $('#bmUris p'); var $p = $('#bmUris p');
@@ -227,7 +227,7 @@ var MUB = {
MUB.addButtonClick(); MUB.addButtonClick();
$('#sources li:last input').val(this.innerHTML); $('#sources li:last input').val(this.innerHTML);
MUB.liUpdateTestLink.call($('#sources li:last')[0]); MUB.liUpdateTestLink.call($('#sources li:last')[0]);
$('#results').hide(); $('#results').addClass('hide');
return false; return false;
}).attr({title:'Add file +'}); }).attr({title:'Add file +'});
} else { } else {

View File

@@ -49,6 +49,7 @@ ob_start();
<!DOCTYPE html> <!DOCTYPE html>
<title>Minify URI Builder</title> <title>Minify URI Builder</title>
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW"> <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<style> <style>
body {margin:1em 60px;} body {margin:1em 60px;}
h1, h2, h3 {margin-left:-25px; position:relative;} h1, h2, h3 {margin-left:-25px; position:relative;}
@@ -111,7 +112,7 @@ and click [Update].</p>
<div id=bmUris></div> <div id=bmUris></div>
<p><button id=update class=hide>Update</button></p> <p><button class="btn btn-primary" id=update class=hide>Update</button></p>
<div id=results class=hide> <div id=results class=hide>