Skip to content

Commit

Permalink
Merge branch 'master' of github.com:aFarkas/webshim into master2
Browse files Browse the repository at this point in the history
  • Loading branch information
aFarkas committed Mar 19, 2013
2 parents 2a64a79 + e2d7b39 commit 9961868
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 35 deletions.
43 changes: 19 additions & 24 deletions grunt.js → Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,29 @@ module.exports = function(grunt){
},
//concat is changed through webshimscombos
concat: {},
//copy and min are changed through cfgcopymin
//copy and uglify are changed through cfgcopymin
copy: {},
min: {},
cssmin: getFiles('src', 'demos/js-webshim/minified', '**/*.css'),
uglify: {
codegen: {ascii_only: true}
}
});

grunt.registerTask('webshimscombos', 'create combos from polyfiller.js.', function() {
var phantomjs = require('phantomjs');
var done = this.async();
var combos = {};
grunt.utils.spawn({
cmd: 'phantomjs',
grunt.util.spawn({
cmd: phantomjs.path,
args: [
// PhantomJS options.
'--config={}',
// The main script file.
'build/combobuild.js',
// The temporary file used for communications.
'',
// The QUnit helper file to be injected.
'build/build.html'
]
},
function(err, result, code) {
result = result.toString();
if(!err && result.indexOf && result.indexOf('done') == -1){

try {
Expand All @@ -54,14 +51,6 @@ module.exports = function(grunt){
grunt.verbose.or.writeln();
grunt.log.write('Running PhantomJS...').error();
if (code === 127) {
grunt.log.errorlns(
'In order for this task to work properly, PhantomJS must be ' +
'installed and in the system PATH (if you can run "phantomjs" at' +
' the command line, this task should work). Unfortunately, ' +
'PhantomJS cannot be installed automatically via npm or grunt. ' +
'See the grunt FAQ for PhantomJS installation instructions: ' +
'https://github.com/gruntjs/grunt/blob/master/docs/faq.md'
);
grunt.warn('PhantomJS not found.');
} else {
result.split('\n').forEach(grunt.log.error, grunt.log);
Expand All @@ -80,27 +69,33 @@ module.exports = function(grunt){

for(var i in files){
file = files[i];
if(grunt.file.isMatch('*.*', file)){
if(grunt.file.isFile(file)){
minPath = path.join('demos/js-webshim/minified', i);
if(grunt.file.isMatch('*.js', file)){
minTask[minPath] = file;
if(/\.js$/.test(file)){
minTask[minPath] = [file];
found = true;
}
copyTask[minPath] = file;
copyTask[path.join('demos/js-webshim/dev', i)] = file;
copyTask[minPath] = [file];
copyTask[path.join('demos/js-webshim/dev', i)] = [file];
}
}
if(!found){
minTask[path.join('demos/js-webshim/minified', 'polyfiller.js')] = path.join('src', 'polyfiller.js');
}
grunt.config('min', minTask);
grunt.config('copy', copyTask);
var uglifyCfg = grunt.config('uglify');
var copyCfg = grunt.config('copy');
uglifyCfg.dist = { 'files': minTask };
copyCfg.dist = { 'files': copyTask };
grunt.config('uglify', uglifyCfg);
grunt.config('copy', copyCfg);
});

// Default task.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-css');
grunt.registerTask('default', 'webshimscombos concat cfgcopymin copy cssmin min');
grunt.registerTask('default', ['webshimscombos', 'concat', 'cfgcopymin', 'copy', 'cssmin', 'uglify']);



Expand Down
2 changes: 1 addition & 1 deletion demos/demos/webforms/3-webforms-widgets.html
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ <h3 id="configure-ui">Changing default-options for range and date</h3>
/*as you can see you can call this also later*/
</code>
<h3 id="ui-loading">Loading jQuery UI from another source</h3>
<p>Webshims lib trys to load the hole jQuery UI library. This isn't often usefull and can be changed by changing $.webshims.modules["jquery-ui"].src.</p>
<p>Webshims lib trys to load the whole jQuery UI library. This isn't often usefull and can be changed by changing $.webshims.modules["jquery-ui"].src.</p>
<code class="block">
// relative from shims-folder
$.webshims.modules["jquery-ui"].src = "../jquery-ui.custom.min.js";
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@
},
"main": "./master/demos/js-webshim/minified/",
"devDependencies": {
"grunt-css": ">=0.3.2",
"grunt-contrib-copy": ">=0.3.1",
"grunt": ">=0.3.1"
"phantomjs": ">=1.8.2"
"grunt-css": ">=0.5.4",
"grunt-contrib-concat": ">=0.1.3",
"grunt-contrib-copy": ">=0.4.0",
"grunt-contrib-uglify": ">=0.1.1",
"grunt": ">=0.4.1"
}
}
}
12 changes: 6 additions & 6 deletions src/shims/form-number-date-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,18 +451,18 @@ jQuery.webshims.register('form-number-date-ui', function($, webshims, window, do
min: function(orig, shim, value){
try {
value = $.datepicker.parseDate('yy-mm-dd', value);
} catch(e){value = false;}
if(value){
$(shim).datepicker('option', 'minDate', value);
} catch (e) {
value = null;
}
$(shim).datepicker('option', 'minDate', value);
},
max: function(orig, shim, value){
try {
value = $.datepicker.parseDate('yy-mm-dd', value);
} catch(e){value = false;}
if(value){
$(shim).datepicker('option', 'maxDate', value);
} catch (e) {
value = null;
}
$(shim).datepicker('option', 'maxDate', value);
},
'data-placeholder': function(orig, shim, value){
var hintValue = (value || '').split('-');
Expand Down

0 comments on commit 9961868

Please sign in to comment.