Permalink
Browse files

Deleted demo.html.

Added @icio's suggested ammendment to the documentation.
Fixed a million bugs todo with what's an array, what's a string.
Added proper delimited string support (converts to array).
Re-added $j(); to show version.
Enabled non-library additions inside an array.
  • Loading branch information...
1 parent 05e9b0e commit 3efc594727b59fd2ec5b010cbda2a5fd80764c75 @johnhamelink johnhamelink committed Nov 10, 2010
Showing with 49 additions and 56 deletions.
  1. +2 −7 README.md
  2. +0 −17 demo.html
  3. +1 −1 index.html
  4. +46 −31 latest.js
View
@@ -10,19 +10,14 @@ More specifically, jQuewy collects the latest libraries online, and automaticall
$j("jquery","ui","tools",function(){
// The scripts are ready to use
});
-
-or
- $j(("jquery","ui","tools"),function(){
- // The scripts are ready to use
- });
-
+
or
$j(["jquery","ui","tools"],function(){
// The scripts are ready to use
});
or
- $j("jquery,ui,tools"],function(){
+ $j("jquery,ui,tools",function(){
// The scripts are ready to use
});
View
@@ -1,17 +0,0 @@
-<!DOCTYPE HTML>
-<html lang="en-US">
- <head>
- <meta charset="UTF-8">
- <title></title>
- <script type="text/javascript" src="latest.js"></script>
- <script type="text/javascript">
- $j(["jquery","ui"],function(){
- alert(jQuery.ui.version);
- });
- $j.list();
- </script>
- </head>
- <body>
-
- </body>
-</html>
View
@@ -2,7 +2,7 @@
<head>
<script src="latest.js"></script>
<script>
- $j("http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js",("jquery","ui"),function(){
+ $j("http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js,jquery,ui",function(){
alert('jQuery version ' + $.ui.version + ' is running.');
$j.list();
});
View
@@ -21,7 +21,7 @@
* THE SOFTWARE.
*
*/
-
+var version='0.4';
(function(){
function get_type(thing){
if(thing===null)return "[object Null]"; // special case
@@ -30,43 +30,58 @@ function get_type(thing){
var jQuewy = function(){
var callback = null;
var lib_file = jQuewy.data();
-
- for (var i = 0; i < arguments.length; i++) {
-
- var arg = arguments[i];
-
- //Check that the parameter is not a local function, if it is,
- //then call it and continue, else, check for other types.
- if ((typeof arg == 'string') && (jQuewy.ifhttp(arg) !== false)){
- continue;
- }
- // Check to see if the parameter is a callback function
- else if (arg instanceof Function) {
- callback = arg;
- continue;
- }
- // Check to see if the parameter is a library
- else if (typeof arg == 'string') {
- lib = lib_file[arg.toLowerCase()];
- if(lib){
- jQuewy.addScript(lib.url);
- if(lib.stylesheet){
- jQuewy.addStylesheet(lib.stylesheet);
+ if (arguments.length > 0){
+ for (var i = 0; i < arguments.length; i++) {
+
+ var arg = arguments[i];
+
+ //Cut a delimited string into an array.
+ if ( (typeof arg == 'string') && ((arg.indexOf(',')!==-1) || (arg.indexOf(', ')!==-1)) ){
+ if (arg.indexOf(',')!==-1){
+ arg=arg.split(',');
+ } else {
+ arg=arg.split(', ');
}
- } else throw 'jQuewy does not support ' + arg[i];
- continue;
- } else if (arg instanceof Array) {
- for (var i = 0; i < arg.length; i++){
- lib = lib_file[arg[i].toLowerCase()];
+ }
+ // Check to see if the parameter is a callback function
+ if (arg instanceof Function) {
+
+ callback = arg;
+ continue;
+ }
+ // Check to see if the parameter is a library
+ else if (typeof arg == 'string') {
+
+
+ lib = lib_file[arg.toLowerCase()];
if(lib){
+
jQuewy.addScript(lib.url);
if(lib.stylesheet){
jQuewy.addStylesheet(lib.stylesheet);
}
- } else throw 'jQuewy does not support ' + arg[i];
+ } else if( jQuewy.ifhttp(arg) == false ){
+ console.log(arg);
+ throw 'jQuewy does not support ' + arg;
+ }
continue;
+ } else if (arg instanceof Array) {
+ for (var i = 0; i < arg.length; i++){
+ lib = lib_file[arg[i].toLowerCase()];
+ if(lib){
+ jQuewy.addScript(lib.url);
+ if(lib.stylesheet){
+ jQuewy.addStylesheet(lib.stylesheet);
+ }
+ } else if( jQuewy.ifhttp(arg[i]) == false ){
+ throw 'jQuewy does not support ' + arg[i];
+ }
+ continue;
+ }
}
}
+ } else {
+ return 'jQuewy '+version;
}
jQuewy.addEvent(window,'load',callback);
@@ -78,7 +93,7 @@ function get_type(thing){
}
jQuewy.extend(jQuewy, {
- libFile: "http://dev.johnhamelink.com/jquery/jquewy/libs.php",
+ libFile: "http://jquewy.com/libs.php",
data: false,
addScript: function(src){
@@ -98,7 +113,7 @@ function get_type(thing){
},
ifhttp: function(lib){
- if(lib.indexOf('http://')==-1){
+ if(lib.indexOf('htt')==-1){
return false;
} else {
return jQuewy.addScript(lib);

0 comments on commit 3efc594

Please sign in to comment.