Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Jakefile for creating distributables.
- Loading branch information
Showing
7 changed files
with
130 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.settings | ||
.project | ||
.project | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
desc("This is the default task."); | ||
task("default", function (params) { | ||
var fs = require("fs"); | ||
var dot = require("dot"); | ||
var jsp = require("uglify-js").parser; | ||
var pro = require("uglify-js").uglify; | ||
|
||
console.log("Reading package.json"); | ||
fs.readFile("./package.json", "utf8", function(err, data) { | ||
if (err) throw err; | ||
|
||
console.log("Parsing package.json"); | ||
var pkg = JSON.parse(data); | ||
console.log("Building " + pkg.name + " " + pkg.version); | ||
fs.readFile("./jquery.fileinput.js", "utf8", function(err, data) { | ||
if (err) throw err; | ||
var cmp = dot.template(data, {evaluate: /\{\{([\s\S]+?)\}\}/g, | ||
interpolate: /\{\{=([\s\S]+?)\}\}/g, | ||
encode: /\{\{!([\s\S]+?)\}\}/g, | ||
use: /\{\{#([\s\S]+?)\}\}/g, //compile time evaluation | ||
define: /\{\{##\s*([\w\.$]+)\s*(\:|=)([\s\S]+?)#\}\}/g, //compile time defs | ||
strip: false, | ||
varname: "pkg"})(pkg); | ||
var ast = jsp.parse(cmp); | ||
ast = pro.ast_mangle(ast); | ||
ast = pro.ast_squeeze(ast); | ||
var min = pro.gen_code(ast); | ||
console.log("Writing to dist"); | ||
fs.writeFileSync("./dist/jquery.fileinput-" + pkg.version + ".min.js", min); | ||
fs.writeFileSync("./dist/jquery.fileinput-" + pkg.version + ".js", cmp); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* jQuery Fileinput Plugin v1.0 | ||
* | ||
* Copyright 2011, Hannu Leinonen <hleinone@gmail.com> | ||
* Dual licensed under the MIT and GPL licenses: | ||
* http://www.opensource.org/licenses/mit-license.php | ||
* http://www.gnu.org/licenses/gpl.html | ||
*/ | ||
(function($) { | ||
$.fn.fileinput = function(replacement) { | ||
var selector = this; | ||
var replacementHtml = "<button class=\"fileinput\">Browse...</button>"; | ||
if (replacement) { | ||
replacementHtml = $(replacement).removeAttr("id").addClass("fileinput").clone().wrap("<div />").parent().html(); | ||
$(replacement).remove(); | ||
} | ||
selector.each(function() { | ||
var element = $(this); | ||
element.wrap("<div class=\"fileinput-wrapper\" style=\"position: relative; display: inline-block;\" />"); | ||
element.attr("tabindex", "-1").css({"font-size": "100px", height: "100%", filter: "alpha(opacity=0)", "-moz-opacity": 0, opacity: 0, position: "absolute", right: 0, top: 0, "z-index": -1}); | ||
element.before(replacementHtml); | ||
var ua = $.browser; | ||
if (ua.opera || (ua.mozilla && ua.version < "2.0")) { | ||
element.css("z-index", "auto"); | ||
element.prev(".fileinput").css("z-index", -1); | ||
element.removeAttr("tabindex"); | ||
element.prev(".fileinput").attr("tabindex", "-1"); | ||
element.hover(function() { | ||
$(this).prev(".fileinput").addClass("hover"); | ||
}, function() { | ||
$(this).prev(".fileinput").removeClass("hover"); | ||
}).focusin(function() { | ||
$(this).prev(".fileinput").addClass("focus"); | ||
}).focusout(function() { | ||
$(this).prev(".fileinput").removeClass("focus"); | ||
}).mousedown(function() { | ||
$(this).prev(".fileinput").addClass("active"); | ||
}).mouseup(function() { | ||
$(this).prev(".fileinput").removeClass("active"); | ||
}); | ||
} else { | ||
element.prev(".fileinput").click(function() { | ||
element.click(); | ||
}); | ||
} | ||
}); | ||
return selector; | ||
}; | ||
})(jQuery); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "jQuery Fileinput Plugin", | ||
"description": "Stylable <input type=\"file\"> for jQuery", | ||
"version": "1.0", | ||
"author": "Hannu Leinonen <hleinone@gmail.com>", | ||
"homepage": "http://github.com/hleinone/jquery-fileinput", | ||
"keywords": ["jquery", "input", "file", "javascript", "style", "css", "fileinput"], | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/hleinone/jquery-fileinput.git" | ||
}, | ||
"licences": [ | ||
{ | ||
"type": "MIT", | ||
"url": "http://www.opensource.org/licenses/mit-license.php" | ||
}, | ||
{ | ||
"type": "GPL", | ||
"url": "http://www.gnu.org/licenses/gpl.html" | ||
} | ||
] | ||
} |