Skip to content
This repository was archived by the owner on Jun 11, 2024. It is now read-only.

Commit 81aba20

Browse files
committed
0 parents  commit 81aba20

22 files changed

+4376
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

.jshintrc

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"boss": true,
3+
"eqeqeq": true,
4+
"eqnull": true,
5+
"expr": true,
6+
"immed": true,
7+
"noarg": true,
8+
"onevar": false,
9+
"quotmark": "double",
10+
"smarttabs": true,
11+
"trailing": true,
12+
"undef": true,
13+
"unused": true,
14+
15+
"node": true
16+
}

CONTRIBUTING.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Welcome! Thanks for your interest in contributing to download.jqueryui.com. You're **almost** in the right place. More information on how to contribute to this and all other jQuery Foundation projects is over at [contribute.jquery.org](http://contribute.jquery.org). You'll definitely want to take a look at the articles on contributing [to our websites](http://contribute.jquery.org/web-sites/).
2+
3+
You may also want to take a look at our [commit & pull request guide](http://contribute.jquery.org/commits-and-pull-requests/) and [style guides](http://contribute.jquery.org/style-guide/) for instructions on how to maintain your fork and submit your code. Before we can merge any pull request, we'll also need you to sign our [contributor license agreement](http://contribute.jquery.org/cla).
4+
5+
You can find us on [IRC](http://irc.jquery.org), specifically in #jqueryui-dev should you have any questions. If you've never contributed to open source before, we've put together [a short guide with tips, tricks, and ideas on getting started](http://contribute.jquery.org/open-source/).

LICENSE.txt

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Copyright jQuery Foundation and other contributors, https://jquery.org/
2+
3+
This software consists of voluntary contributions made by many
4+
individuals. For exact contribution history, see the revision history
5+
available at https://github.com/jquery/download.jqueryui.com
6+
7+
The following license applies to all parts of this software except as
8+
documented below:
9+
10+
====
11+
12+
Permission is hereby granted, free of charge, to any person obtaining
13+
a copy of this software and associated documentation files (the
14+
"Software"), to deal in the Software without restriction, including
15+
without limitation the rights to use, copy, modify, merge, publish,
16+
distribute, sublicense, and/or sell copies of the Software, and to
17+
permit persons to whom the Software is furnished to do so, subject to
18+
the following conditions:
19+
20+
The above copyright notice and this permission notice shall be
21+
included in all copies or substantial portions of the Software.
22+
23+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30+
31+
====
32+
33+
All files located in the node_modules and external directories are
34+
externally maintained libraries used by this software which have their
35+
own licenses; we recommend you read them, as their terms may differ from
36+
the terms above.

README.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## Why jquery-ui-themeroller?
2+
3+
Use `jquery-ui-themeroller` to generate the CSS of your jQuery UI theme.
4+
5+
## Usage
6+
7+
npm install jquery-ui-themeroller
8+
9+
```javascript
10+
var fs = require( "js" );
11+
var ThemeRoller = require( "jquery-ui-themeroller" );
12+
13+
var baseThemeCss = fs.readFileSync( "./jquery-ui/base/theme.css" );
14+
15+
var themeroller = new ThemeRoller( baseThemeCss, myThemeVars );
16+
var myThemeCss = themeroller.css();
17+
```
18+
19+
## API
20+
21+
- **`ThemeRoller( baseThemeCss, vars )`**
22+
23+
**baseThemeCss** *String/Buffer* containing jQuery UI's `./base/theme.css`.
24+
25+
**vars** *Object* containing (theme property, value) key-value pairs. See
26+
https://github.com/jquery/download.jqueryui.com/blob/master/lib/themeroller-themegallery.js
27+
for more details.
28+
29+
## Test
30+
31+
npm test
32+

lib/cache.js

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
var Cache, cacheCron, cacheCronTimeout, cacheExpiresTime, caches;
2+
3+
cacheExpiresTime = 0;
4+
caches = [];
5+
6+
cacheCron = function() {
7+
var currentTime = Date.now();
8+
caches.forEach(function( cache ) {
9+
var count = {
10+
cached: 0,
11+
deleted: 0
12+
};
13+
14+
cache.each(function( value, key ) {
15+
count.cached++;
16+
if ( cache.expires[ key ] < currentTime ) {
17+
cache.destroy( key );
18+
count.deleted++;
19+
}
20+
});
21+
});
22+
cacheCronTimeout = setTimeout( cacheCron, cacheExpiresTime );
23+
};
24+
25+
Cache = function( name ) {
26+
this.cache = {};
27+
this.expires = {};
28+
this.name = name;
29+
caches.push( this );
30+
};
31+
32+
Cache.on = function( expiresTime ) {
33+
cacheExpiresTime = expiresTime;
34+
clearTimeout( cacheCronTimeout );
35+
cacheCron();
36+
};
37+
38+
Cache.prototype = {
39+
destroy: function( key ) {
40+
delete this.cache[ key ];
41+
},
42+
43+
each: function( callback ) {
44+
var key;
45+
for ( key in this.cache ) {
46+
callback( this.cache[ key ], key );
47+
}
48+
},
49+
50+
get: function( key ) {
51+
var value = this.cache[ key ];
52+
if ( value ) {
53+
this.setExpire( key );
54+
}
55+
return value;
56+
},
57+
58+
set: function( key, value ) {
59+
if ( cacheExpiresTime ) {
60+
this.cache[ key ] = value;
61+
this.setExpire( key );
62+
}
63+
},
64+
65+
setExpire: function( key ) {
66+
this.expires[ key ] = Date.now() + cacheExpiresTime;
67+
}
68+
};
69+
70+
module.exports = Cache;

0 commit comments

Comments
 (0)