Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated build file and added LICENSE
- Loading branch information
1 parent
44e1262
commit bb93411
Showing
9 changed files
with
134 additions
and
47 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Copyright (c) Bjarki Gudlaugsson (codehugger at codehuggers.com) | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, are | ||
* permitted provided that the following conditions are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright notice, this list of | ||
* conditions and the following disclaimer. | ||
* | ||
* * Redistributions in binary form must reproduce the above copyright notice, this | ||
* list of conditions and the following disclaimer in the documentation and/or other | ||
* materials provided with the distribution. | ||
* | ||
* * Neither the name of the <ORGANIZATION> nor the names of its contributors may be | ||
* used to endorse or promote products derived from this software without specific | ||
* prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY | ||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT | ||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ |
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 |
---|---|---|
@@ -1,28 +1,50 @@ | ||
var compressor = require('node-minify'); | ||
var fs = require('fs'); | ||
|
||
fs.exists('./build', function (exists) { | ||
if (!exists) { | ||
fs.mkdirSync('./build'); | ||
} | ||
}); | ||
|
||
/* | ||
* jquery-categorypicker.min.js | ||
*/ | ||
new compressor.minify({ | ||
type: 'yui-js', | ||
fileIn: ['./jquery-categorypicker.js'], | ||
fileOut: './build/categorypicker.min.js', | ||
callback: function(err){ | ||
fileIn: './src/jquery-categorypicker.js', | ||
fileOut: './jquery-categorypicker.min.js', | ||
callback: function(err) { | ||
if (err) { console.log(err); } | ||
else { console.log(this.fileOut); } | ||
else { | ||
// include LICENSE | ||
new compressor.minify({ | ||
type: 'no-compress', | ||
fileIn: [ | ||
'LICENSE', | ||
'./jquery-categorypicker.min.js'], | ||
fileOut: './jquery-categorypicker.min.js', | ||
callback: function(err) { | ||
console.log(this.fileOut); | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
|
||
/* | ||
* jquery-categorypicker-ko.min.js | ||
*/ | ||
new compressor.minify({ | ||
type: 'yui-js', | ||
fileIn: ['./jquery-categorypicker.js', './jquery-categorypicker-ko.js'], | ||
fileOut: './build/categorypicker-ko.min.js', | ||
callback: function(err){ | ||
fileIn: './src/jquery-categorypicker-ko.js', | ||
fileOut: './jquery-categorypicker-ko.min.js', | ||
callback: function(err) { | ||
if (err) { console.log(err); } | ||
else { console.log(this.fileOut); } | ||
else { | ||
// include LICENSE | ||
new compressor.minify({ | ||
type: 'no-compress', | ||
fileIn: ['LICENSE', './jquery-categorypicker-ko.min.js'], | ||
fileOut: './jquery-categorypicker-ko.min.js', | ||
callback: function(err) { | ||
console.log(this.fileOut); | ||
} | ||
}); | ||
} | ||
} | ||
}); |
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
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,30 @@ | ||
/** | ||
* Copyright (c) Bjarki Gudlaugsson (codehugger at codehuggers.com) | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, are | ||
* permitted provided that the following conditions are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright notice, this list of | ||
* conditions and the following disclaimer. | ||
* | ||
* * Redistributions in binary form must reproduce the above copyright notice, this | ||
* list of conditions and the following disclaimer in the documentation and/or other | ||
* materials provided with the distribution. | ||
* | ||
* * Neither the name of the <ORGANIZATION> nor the names of its contributors may be | ||
* used to endorse or promote products derived from this software without specific | ||
* prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY | ||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT | ||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
ko.bindingHandlers.categorypicker={update:function(e,h,c){var j=h(),f=c();var d=ko.utils.unwrapObservable(j);var b=ko.utils.unwrapObservable(f.availableCategories);var a=ko.utils.unwrapObservable(f.idField);var i=ko.utils.unwrapObservable(f.sortField);var k=ko.utils.unwrapObservable(f.valueField);var g=ko.utils.unwrapObservable(f.displayField);$(e).categorypicker({selectedCategories:d,availableCategories:b,idField:a,sortField:i,valueField:k,displayField:g,onUpdate:function(l){j(l)}})}}; |
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,30 @@ | ||
/** | ||
* Copyright (c) Bjarki Gudlaugsson (codehugger at codehuggers.com) | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, are | ||
* permitted provided that the following conditions are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright notice, this list of | ||
* conditions and the following disclaimer. | ||
* | ||
* * Redistributions in binary form must reproduce the above copyright notice, this | ||
* list of conditions and the following disclaimer in the documentation and/or other | ||
* materials provided with the distribution. | ||
* | ||
* * Neither the name of the <ORGANIZATION> nor the names of its contributors may be | ||
* used to endorse or promote products derived from this software without specific | ||
* prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY | ||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT | ||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
(function(a){a.fn.categorypicker=function(i,b){var m=this;var h,f;var g;function j(p){var q=p.target.id;var o=p.target.checked;var n=[];a.each(f,function(r,s){if(q!==s[idField]){n.push(s)}});if(o){a.each(h,function(r,s){if(q===s[idField]){n.push(s)}})}f=n;f.sort(function(s,r){return s[sortField]>r[sortField]});e()}function e(){if(onUpdate){onUpdate(f)}}function d(o){var n=a(itemTemplate);var p=a('<input type="checkbox">');p.attr("id",o[idField]);p.attr("value",o[valueField]);a.each(f,function(q,r){if(r[idField]===o[idField]){p.attr("checked",true)}});p.on("click",j);n.html(p);n.append(o[displayField]);return n}function k(){var n=a(listTemplate);a.each(h,function(o,p){n.append(d(p))});return n}function c(){var n=a(g);n.append(k());m.html(n)}function l(n){if(n===undefined){n={}}h=n.availableCategories||[];f=n.selectedCategories||[];idField=n.idField||"id";sortField=n.sortField||idField;valueField=n.valueField||"value";displayField=n.displayField||"value";onUpdate=n.onUpdate;g=n.rootTemplate||'<div class="categorypicker"></div>';listTemplate=n.listTemplate||'<ul class="list"></ul>';itemTemplate=n.itemTemplate||'<li class="item"></li>';c();e();return m}return l(i,b)}})(jQuery); |
File renamed without changes.
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