Skip to content

Commit

Permalink
Make refactoring of jquery-loader.js
Browse files Browse the repository at this point in the history
  • Loading branch information
vodkabears committed May 1, 2015
1 parent 0dfe69c commit b969407
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Gruntfile.js
Expand Up @@ -42,7 +42,7 @@ module.exports = function(grunt) {
src: 'src/**/*.js'
},
test: {
src: 'test/**/*.js'
src: ['test/**/*.js', 'libs/jquery-loader.js']
},
options: {
jshintrc: '.jshintrc'
Expand All @@ -57,7 +57,7 @@ module.exports = function(grunt) {
src: 'src/**/*.js'
},
test: {
src: 'test/**/*.js'
src: ['test/**/*.js', 'libs/jquery-loader.js']
}
},

Expand Down
14 changes: 10 additions & 4 deletions libs/jquery-loader.js
@@ -1,6 +1,12 @@
(function () {
// Get any jquery=___ param from the query string.
var jqversion = location.search.match(/[?&]jquery=(.*?)(?=&|$)/);
!(function() {

document.write("<script src='../libs/jquery" + jqversion[1] + "/dist/jquery.js'></script>");
// Get any lib=___ param from the query string.
var library = location.search.match(/[?&]lib=(.*?)(?=&|$)/);

/* jshint -W060 */
if (library) {
document.write('<script src="../libs/' + library[1] + '"></script>');
} else {
document.write('<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>');
}
}());

0 comments on commit b969407

Please sign in to comment.