This file contains hidden or 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
| if (!/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(ths.value)) { | |
| alert("你选择的不是图片文件"); | |
| ths.value = ""; | |
| return false; | |
| } |
This file contains hidden or 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
| var match = ko.utils.arrayFirst(self.dialogboxArray(), function(item) { | |
| return newMessage.target === item.name; | |
| }); |
This file contains hidden or 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
| ko.observableArray.fn.filterByProperty = function(propName, matchValue) { | |
| return ko.computed(function() { | |
| var allItems = this(), matchingItems = []; | |
| for (var i = 0; i < allItems.length; i++) { | |
| var current = allItems[i]; | |
| if (ko.utils.unwrapObservable(current[propName]) === matchValue) | |
| matchingItems.push(current); | |
| } | |
| return matchingItems; | |
| }, this); |
This file contains hidden or 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
| ko.extenders.paging = function (target, pageSize) { | |
| var _pageSize = ko.observable(pageSize || 10), // default pageSize to 10 | |
| _currentPage = ko.observable(1); // default current page to 1 | |
| target.pageSize = ko.computed({ | |
| read: _pageSize, | |
| write: function (newValue) { | |
| if (newValue > 0) { | |
| _pageSize(newValue); | |
| } |
This file contains hidden or 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
| <!--[if lte IE 7]> | |
| <![endif]--> |
This file contains hidden or 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
| width: 200px; | |
| white-space: nowrap; | |
| overflow: hidden; | |
| text-overflow: ellipsis; |
This file contains hidden or 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
| Array.prototype.dedupe=function () { | |
| var hash={},result=[], | |
| hasown=Object.prototype.hasOwnProperty; | |
| for (var i = this.length - 1; i >= 0; i--) { | |
| if(!hasown.call(hash,this[i])){ | |
| hash[this[i]]=1; | |
| result.push(this[i]); | |
| } | |
| }; | |
| return result; |
This file contains hidden or 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
| function S4() { | |
| return (((1+Math.random())*0x10000)|0).toString(16).substring(1); | |
| } | |
| function guid() { | |
| return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4()); | |
| } |
This file contains hidden or 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
| Sublime Text 2 - Default shortcuts cheatsheet (PC keyboard) | |
| ----------------- | |
| General | |
| ----------------- | |
| * Go to file (CTRL + P) | |
| * Go to project (CTRL + ALT + P) | |
| * Go to methods (CTRL + R) | |
| * Go to line (CTRL + G) | |
| * Toggle side bar (CTRL + KB) |
This file contains hidden or 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
| bind: window.dispatchEvent ? function(el, type, fn, phase) { | |
| el.addEventListener(type, fn, !!phase); | |
| return fn; | |
| } : function(el, type, fn) { | |
| el.attachEvent && el.attachEvent("on" + type, fn); | |
| return fn; | |
| } |
OlderNewer