Initial Commit
This commit is contained in:
2268
www/js/libs/bootstrap.js
vendored
Normal file
2268
www/js/libs/bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
www/js/libs/bootstrap.min.js
vendored
Normal file
6
www/js/libs/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
9597
www/js/libs/jquery-1.9.1.js
vendored
Normal file
9597
www/js/libs/jquery-1.9.1.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5
www/js/libs/jquery-1.9.1.min.js
vendored
Normal file
5
www/js/libs/jquery-1.9.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
www/js/libs/modernizr-2.0.6.min.js
vendored
Normal file
4
www/js/libs/modernizr-2.0.6.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
11
www/js/libs/modernizr-2.6.2-respond-1.1.0.min.js
vendored
Normal file
11
www/js/libs/modernizr-2.6.2-respond-1.1.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
www/js/main.js
Normal file
1
www/js/main.js
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
24
www/js/plugins.js
Normal file
24
www/js/plugins.js
Normal file
@@ -0,0 +1,24 @@
|
||||
// Avoid `console` errors in browsers that lack a console.
|
||||
(function() {
|
||||
var method;
|
||||
var noop = function () {};
|
||||
var methods = [
|
||||
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
|
||||
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
|
||||
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
|
||||
'timeStamp', 'trace', 'warn'
|
||||
];
|
||||
var length = methods.length;
|
||||
var console = (window.console = window.console || {});
|
||||
|
||||
while (length--) {
|
||||
method = methods[length];
|
||||
|
||||
// Only stub undefined methods.
|
||||
if (!console[method]) {
|
||||
console[method] = noop;
|
||||
}
|
||||
}
|
||||
}());
|
||||
|
||||
// Place any jQuery/helper plugins in here.
|
||||
222
www/js/script.js
Normal file
222
www/js/script.js
Normal file
@@ -0,0 +1,222 @@
|
||||
$(function(){
|
||||
|
||||
/************
|
||||
CONFIG
|
||||
************/
|
||||
var config = {
|
||||
|
||||
defaultModules:{
|
||||
blank: [
|
||||
'css-mode',
|
||||
'h5bp-content',
|
||||
'modernizr',
|
||||
'jquerymin',
|
||||
'h5bp-htaccess',
|
||||
'h5bp-chromeframe',
|
||||
'h5bp-analytics',
|
||||
'h5bp-iecond',
|
||||
'h5bp-favicon',
|
||||
'h5bp-appletouchicons',
|
||||
'h5bp-scripts',
|
||||
'h5bp-robots',
|
||||
'h5bp-humans',
|
||||
'h5bp-404',
|
||||
'h5bp-adobecrossdomain'
|
||||
],
|
||||
initializr: [
|
||||
'css-mode',
|
||||
'izr-responsive',
|
||||
'modernizr',
|
||||
'respond',
|
||||
'jquerymin',
|
||||
'h5bp-chromeframe',
|
||||
'h5bp-analytics',
|
||||
'h5bp-favicon',
|
||||
'h5bp-appletouchicons',
|
||||
'h5bp-iecond'
|
||||
],
|
||||
bootstrap: [
|
||||
'less-mode',
|
||||
'boot-hero',
|
||||
'modernizr',
|
||||
'respond',
|
||||
'jquerymin',
|
||||
'h5bp-chromeframe',
|
||||
'h5bp-analytics',
|
||||
'h5bp-favicon',
|
||||
'h5bp-appletouchicons',
|
||||
'h5bp-iecond',
|
||||
'less'
|
||||
]
|
||||
},
|
||||
baseUrl:'http://localhost:8888/builder?'
|
||||
};
|
||||
|
||||
/************
|
||||
VARIABLES
|
||||
************/
|
||||
|
||||
var params;
|
||||
var modules = [];
|
||||
var stylelang = '';
|
||||
|
||||
/**********
|
||||
EVENTS
|
||||
**********/
|
||||
|
||||
$('input').click(function(){
|
||||
update();
|
||||
});
|
||||
|
||||
|
||||
$('#preconfig-blank').click(function(){
|
||||
fillDefaultModules('blank');
|
||||
});
|
||||
|
||||
$('#preconfig-initializr').click(function(){
|
||||
fillDefaultModules('initializr');
|
||||
});
|
||||
|
||||
$('#preconfig-bootstrap').click(function(){
|
||||
fillDefaultModules('bootstrap');
|
||||
});
|
||||
|
||||
/*********
|
||||
LOGIC
|
||||
*********/
|
||||
|
||||
function fillDefaultModules(type){
|
||||
$('input').attr('checked', false);
|
||||
|
||||
for (var i = 0, curModule; curModule = config.defaultModules[type][i++];){
|
||||
$('input[value=' + curModule +']').attr('checked', true);
|
||||
};
|
||||
update();
|
||||
$('#hidden-section').fadeIn('slow');
|
||||
}
|
||||
|
||||
function update(){
|
||||
updateModules();
|
||||
updateUrls();
|
||||
}
|
||||
|
||||
function updateModules(){
|
||||
modules = [];
|
||||
$('input').each(function(){
|
||||
if ($(this).is(':checked'))
|
||||
modules.push($(this).val());
|
||||
});
|
||||
replaceSpecialModules();
|
||||
}
|
||||
|
||||
function replaceSpecialModules(){
|
||||
if (modules.indexOf('jquerymin') != -1 && modules.indexOf('jquerydev') != -1){
|
||||
modules.remove('jquerymin');
|
||||
modules.remove('jquerydev');
|
||||
modules.push('jquery');
|
||||
}
|
||||
|
||||
if (modules.indexOf('modernizr') != -1 && modules.indexOf('respond') != -1){
|
||||
modules.remove('modernizr');
|
||||
modules.remove('respond');
|
||||
modules.push('modernizrrespond');
|
||||
}
|
||||
|
||||
if (modules.indexOf('html5shiv') != -1 && modules.indexOf('respond') != -1){
|
||||
modules.remove('html5shiv');
|
||||
modules.remove('respond');
|
||||
modules.push('html5shivrespond');
|
||||
}
|
||||
|
||||
if (modules.indexOf('less-mode') != -1){
|
||||
modules.remove('less-mode');
|
||||
stylelang = 'less';
|
||||
}
|
||||
else
|
||||
stylelang = '';
|
||||
|
||||
if (modules.indexOf('css-mode') != -1){
|
||||
modules.remove('css-mode');
|
||||
}
|
||||
|
||||
if (modules.indexOf('h5bp-content') != -1 || modules.indexOf('izr-responsive') != -1){
|
||||
modules.push('h5bp-css');
|
||||
modules.push('h5bp-csshelpers');
|
||||
modules.push('h5bp-mediaqueryprint');
|
||||
}
|
||||
|
||||
if (modules.indexOf('h5bp-content') != -1){
|
||||
modules.push('h5bp-mediaqueries');
|
||||
}
|
||||
|
||||
if (modules.indexOf('h5bp-iecond') == -1){
|
||||
modules.push('simplehtmltag');
|
||||
}
|
||||
|
||||
if (modules.indexOf('h5bp-scripts') == -1){
|
||||
modules.push('izr-emptyscript');
|
||||
}
|
||||
|
||||
if (modules.indexOf('boot-hero') != -1){
|
||||
modules.push('boot-css');
|
||||
modules.push('boot-scripts');
|
||||
if (modules.indexOf('jquery') == -1 && modules.indexOf('jquerydev') == -1 && modules.indexOf('jquerymin') == -1){
|
||||
modules.push('jquerymin');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function updateUrls(){
|
||||
var modeParam = '';
|
||||
|
||||
if (stylelang != ''){
|
||||
modeParam = 'mode=' + stylelang + '&';
|
||||
}
|
||||
|
||||
params = '';
|
||||
|
||||
for (var i = 0, curModule; curModule = modules[i++];){
|
||||
params += curModule + '&';
|
||||
}
|
||||
|
||||
params = params.substring(0, params.length - 1);
|
||||
|
||||
$('#preview-url').val(config.baseUrl + 'print&' + modeParam + params);
|
||||
$('#download-url').val(config.baseUrl + modeParam + params);
|
||||
|
||||
$('#preview-link').attr('href', config.baseUrl + 'print&' + modeParam + params);
|
||||
$('#download-link').attr('href', config.baseUrl + modeParam + params);
|
||||
}
|
||||
|
||||
/***********
|
||||
HELPERS
|
||||
***********/
|
||||
|
||||
if (!Array.indexOf){
|
||||
Array.prototype.indexOf = function(searchedElement){
|
||||
for (var i = 0; i < this.length; i++){
|
||||
if (this[i] === searchedElement)
|
||||
return i;
|
||||
};
|
||||
return -1;
|
||||
};
|
||||
}
|
||||
|
||||
Array.prototype.remove = function(searchedElement){
|
||||
var i = this.indexOf(searchedElement);
|
||||
if (i != -1)
|
||||
this.splice(i, 1);
|
||||
};
|
||||
|
||||
/***********
|
||||
MAIN
|
||||
***********/
|
||||
|
||||
if ($('input:checked').length > 0)
|
||||
$('#hidden-section').fadeIn(0);
|
||||
update();
|
||||
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user