mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-26 12:21:29 +00:00
add dijit/dojo stuff; initial ui mockup
This commit is contained in:
52
lib/dojo/data/util/filter.js
Normal file
52
lib/dojo/data/util/filter.js
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dojo.data.util.filter"]){
|
||||
dojo._hasResource["dojo.data.util.filter"]=true;
|
||||
dojo.provide("dojo.data.util.filter");
|
||||
dojo.data.util.filter.patternToRegExp=function(_1,_2){
|
||||
var _3="^";
|
||||
var c=null;
|
||||
for(var i=0;i<_1.length;i++){
|
||||
c=_1.charAt(i);
|
||||
switch(c){
|
||||
case "\\":
|
||||
_3+=c;
|
||||
i++;
|
||||
_3+=_1.charAt(i);
|
||||
break;
|
||||
case "*":
|
||||
_3+=".*";
|
||||
break;
|
||||
case "?":
|
||||
_3+=".";
|
||||
break;
|
||||
case "$":
|
||||
case "^":
|
||||
case "/":
|
||||
case "+":
|
||||
case ".":
|
||||
case "|":
|
||||
case "(":
|
||||
case ")":
|
||||
case "{":
|
||||
case "}":
|
||||
case "[":
|
||||
case "]":
|
||||
_3+="\\";
|
||||
default:
|
||||
_3+=c;
|
||||
}
|
||||
}
|
||||
_3+="$";
|
||||
if(_2){
|
||||
return new RegExp(_3,"mi");
|
||||
}else{
|
||||
return new RegExp(_3,"m");
|
||||
}
|
||||
};
|
||||
}
|
||||
64
lib/dojo/data/util/simpleFetch.js
Normal file
64
lib/dojo/data/util/simpleFetch.js
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dojo.data.util.simpleFetch"]){
|
||||
dojo._hasResource["dojo.data.util.simpleFetch"]=true;
|
||||
dojo.provide("dojo.data.util.simpleFetch");
|
||||
dojo.require("dojo.data.util.sorter");
|
||||
dojo.data.util.simpleFetch.fetch=function(_1){
|
||||
_1=_1||{};
|
||||
if(!_1.store){
|
||||
_1.store=this;
|
||||
}
|
||||
var _2=this;
|
||||
var _3=function(_4,_5){
|
||||
if(_5.onError){
|
||||
var _6=_5.scope||dojo.global;
|
||||
_5.onError.call(_6,_4,_5);
|
||||
}
|
||||
};
|
||||
var _7=function(_8,_9){
|
||||
var _a=_9.abort||null;
|
||||
var _b=false;
|
||||
var _c=_9.start?_9.start:0;
|
||||
var _d=(_9.count&&(_9.count!==Infinity))?(_c+_9.count):_8.length;
|
||||
_9.abort=function(){
|
||||
_b=true;
|
||||
if(_a){
|
||||
_a.call(_9);
|
||||
}
|
||||
};
|
||||
var _e=_9.scope||dojo.global;
|
||||
if(!_9.store){
|
||||
_9.store=_2;
|
||||
}
|
||||
if(_9.onBegin){
|
||||
_9.onBegin.call(_e,_8.length,_9);
|
||||
}
|
||||
if(_9.sort){
|
||||
_8.sort(dojo.data.util.sorter.createSortFunction(_9.sort,_2));
|
||||
}
|
||||
if(_9.onItem){
|
||||
for(var i=_c;(i<_8.length)&&(i<_d);++i){
|
||||
var _f=_8[i];
|
||||
if(!_b){
|
||||
_9.onItem.call(_e,_f,_9);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_9.onComplete&&!_b){
|
||||
var _10=null;
|
||||
if(!_9.onItem){
|
||||
_10=_8.slice(_c,_d);
|
||||
}
|
||||
_9.onComplete.call(_e,_10,_9);
|
||||
}
|
||||
};
|
||||
this._fetchItems(_1,_7,_3);
|
||||
return _1;
|
||||
};
|
||||
}
|
||||
66
lib/dojo/data/util/sorter.js
Normal file
66
lib/dojo/data/util/sorter.js
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dojo.data.util.sorter"]){
|
||||
dojo._hasResource["dojo.data.util.sorter"]=true;
|
||||
dojo.provide("dojo.data.util.sorter");
|
||||
dojo.data.util.sorter.basicComparator=function(a,b){
|
||||
var r=-1;
|
||||
if(a===null){
|
||||
a=undefined;
|
||||
}
|
||||
if(b===null){
|
||||
b=undefined;
|
||||
}
|
||||
if(a==b){
|
||||
r=0;
|
||||
}else{
|
||||
if(a>b||a==null){
|
||||
r=1;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
};
|
||||
dojo.data.util.sorter.createSortFunction=function(_1,_2){
|
||||
var _3=[];
|
||||
function _4(_5,_6,_7,s){
|
||||
return function(_8,_9){
|
||||
var a=s.getValue(_8,_5);
|
||||
var b=s.getValue(_9,_5);
|
||||
return _6*_7(a,b);
|
||||
};
|
||||
};
|
||||
var _a;
|
||||
var _b=_2.comparatorMap;
|
||||
var bc=dojo.data.util.sorter.basicComparator;
|
||||
for(var i=0;i<_1.length;i++){
|
||||
_a=_1[i];
|
||||
var _c=_a.attribute;
|
||||
if(_c){
|
||||
var _d=(_a.descending)?-1:1;
|
||||
var _e=bc;
|
||||
if(_b){
|
||||
if(typeof _c!=="string"&&("toString" in _c)){
|
||||
_c=_c.toString();
|
||||
}
|
||||
_e=_b[_c]||bc;
|
||||
}
|
||||
_3.push(_4(_c,_d,_e,_2));
|
||||
}
|
||||
}
|
||||
return function(_f,_10){
|
||||
var i=0;
|
||||
while(i<_3.length){
|
||||
var ret=_3[i++](_f,_10);
|
||||
if(ret!==0){
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user