ninjs 0.13.6 → 0.13.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/ninjs.gemspec +5 -290
- metadata +52 -345
- data/.bundle/config +0 -2
- data/CNAME +0 -1
- data/Gemfile +0 -16
- data/Gemfile.lock +0 -36
- data/LICENSE +0 -29
- data/README.md +0 -348
- data/bin/ninjs +0 -218
- data/lib/ninjs.rb +0 -10
- data/lib/ninjs/command.rb +0 -91
- data/lib/ninjs/configuration.rb +0 -72
- data/lib/ninjs/dependencies.rb +0 -16
- data/lib/ninjs/generator.rb +0 -57
- data/lib/ninjs/helpers.rb +0 -17
- data/lib/ninjs/manifest.rb +0 -9
- data/lib/ninjs/notification.rb +0 -37
- data/lib/ninjs/project.rb +0 -233
- data/repository/jquery/1.1.4.js +0 -2508
- data/repository/jquery/1.2.6.js +0 -32
- data/repository/jquery/1.3.2.js +0 -19
- data/repository/jquery/1.4.2.js +0 -154
- data/repository/jquery/1.4.3.js +0 -166
- data/repository/jquery/1.4.4.js +0 -167
- data/repository/jquery/1.5.js +0 -16
- data/repository/jquery/fancybox/1.3.1.js +0 -1079
- data/repository/jquery/fancybox/assets/1.3.1/css/fancybox.css +0 -363
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/blank.gif +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_close.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_loading.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_nav_left.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_nav_right.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_e.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_n.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_ne.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_nw.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_s.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_se.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_sw.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_w.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_left.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_main.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_over.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_right.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancybox-x.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancybox-y.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancybox.png +0 -0
- data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/jquery.easing-1.3.pack.js +0 -72
- data/repository/jquery/fancybox/latest.js +0 -1
- data/repository/jquery/latest.js +0 -1
- data/repository/jquery/mobile/1.0a3.js +0 -123
- data/repository/jquery/mobile/1.0a3/assets/css/jquery.mobile.css +0 -1652
- data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/ajax-loader.png +0 -0
- data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/form-check-off.png +0 -0
- data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/form-check-on.png +0 -0
- data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/form-radio-off.png +0 -0
- data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/form-radio-on.png +0 -0
- data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icon-search-black.png +0 -0
- data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icons-18-black.png +0 -0
- data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icons-18-white.png +0 -0
- data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icons-36-black.png +0 -0
- data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icons-36-white.png +0 -0
- data/repository/jquery/mobile/latest.js +0 -1
- data/repository/jquery/mousewheel/3.0.2.js +0 -11
- data/repository/jquery/mousewheel/latest.js +0 -1
- data/repository/jquery/ui/1.8.7.js +0 -783
- data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.accordion.css +0 -19
- data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.all.css +0 -11
- data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.autocomplete.css +0 -53
- data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.base.css +0 -11
- data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.button.css +0 -38
- data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.core.css +0 -41
- data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.datepicker.css +0 -68
- data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.dialog.css +0 -21
- data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.progressbar.css +0 -11
- data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.resizable.css +0 -20
- data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.selectable.css +0 -10
- data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.slider.css +0 -24
- data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.tabs.css +0 -18
- data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.theme.css +0 -252
- data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_222222_256x240.png +0 -0
- data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_2e83ff_256x240.png +0 -0
- data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_454545_256x240.png +0 -0
- data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_888888_256x240.png +0 -0
- data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_cd0a0a_256x240.png +0 -0
- data/repository/jquery/ui/latest.js +0 -1
- data/repository/json2.js +0 -482
- data/repository/modernizr/1.5.js +0 -28
- data/repository/modernizr/latest.js +0 -1
- data/repository/ninjs/core/.core.pdoc.yaml +0 -0
- data/repository/ninjs/core/.existence.pdoc.yaml +0 -12
- data/repository/ninjs/core/.extend.pdoc.yaml +0 -0
- data/repository/ninjs/core/.nin.pdoc.yaml +0 -0
- data/repository/ninjs/core/application.js +0 -47
- data/repository/ninjs/core/existence.js +0 -277
- data/repository/ninjs/core/extend.js +0 -77
- data/repository/ninjs/core/module.js +0 -135
- data/repository/ninjs/core/nin.js +0 -4
- data/repository/ninjs/docs/Data/ClassHierarchy.nd +0 -0
- data/repository/ninjs/docs/Data/ConfigFileInfo.nd +0 -0
- data/repository/ninjs/docs/Data/FileInfo.nd +0 -16
- data/repository/ninjs/docs/Data/ImageFileInfo.nd +0 -0
- data/repository/ninjs/docs/Data/ImageReferenceTable.nd +0 -0
- data/repository/ninjs/docs/Data/IndexInfo.nd +0 -0
- data/repository/ninjs/docs/Data/PreviousMenuState.nd +0 -0
- data/repository/ninjs/docs/Data/PreviousSettings.nd +0 -0
- data/repository/ninjs/docs/Data/SymbolTable.nd +0 -0
- data/repository/ninjs/docs/Languages.txt +0 -113
- data/repository/ninjs/docs/Menu.txt +0 -63
- data/repository/ninjs/docs/Topics.txt +0 -81
- data/repository/ninjs/docs/files/core/application-js.html +0 -44
- data/repository/ninjs/docs/files/core/existence-js.html +0 -60
- data/repository/ninjs/docs/files/core/extend-js.html +0 -55
- data/repository/ninjs/docs/files/core/module-js.html +0 -80
- data/repository/ninjs/docs/files/core/nin-js.html +0 -38
- data/repository/ninjs/docs/index.html +0 -1
- data/repository/ninjs/docs/index/Classes.html +0 -33
- data/repository/ninjs/docs/index/Files.html +0 -45
- data/repository/ninjs/docs/index/Functions.html +0 -65
- data/repository/ninjs/docs/index/General.html +0 -85
- data/repository/ninjs/docs/index/Variables.html +0 -45
- data/repository/ninjs/docs/javascript/main.js +0 -841
- data/repository/ninjs/docs/javascript/prettify.js +0 -1526
- data/repository/ninjs/docs/javascript/searchdata.js +0 -152
- data/repository/ninjs/docs/search/ClassesN.html +0 -20
- data/repository/ninjs/docs/search/FilesA.html +0 -20
- data/repository/ninjs/docs/search/FilesE.html +0 -20
- data/repository/ninjs/docs/search/FilesM.html +0 -20
- data/repository/ninjs/docs/search/FilesN.html +0 -20
- data/repository/ninjs/docs/search/FunctionsA.html +0 -20
- data/repository/ninjs/docs/search/FunctionsC.html +0 -20
- data/repository/ninjs/docs/search/FunctionsE.html +0 -20
- data/repository/ninjs/docs/search/FunctionsI.html +0 -20
- data/repository/ninjs/docs/search/FunctionsM.html +0 -20
- data/repository/ninjs/docs/search/FunctionsR.html +0 -20
- data/repository/ninjs/docs/search/FunctionsS.html +0 -20
- data/repository/ninjs/docs/search/FunctionsSymbols.html +0 -20
- data/repository/ninjs/docs/search/FunctionsU.html +0 -20
- data/repository/ninjs/docs/search/GeneralA.html +0 -20
- data/repository/ninjs/docs/search/GeneralC.html +0 -20
- data/repository/ninjs/docs/search/GeneralD.html +0 -20
- data/repository/ninjs/docs/search/GeneralE.html +0 -20
- data/repository/ninjs/docs/search/GeneralF.html +0 -20
- data/repository/ninjs/docs/search/GeneralI.html +0 -20
- data/repository/ninjs/docs/search/GeneralM.html +0 -20
- data/repository/ninjs/docs/search/GeneralN.html +0 -20
- data/repository/ninjs/docs/search/GeneralR.html +0 -20
- data/repository/ninjs/docs/search/GeneralS.html +0 -20
- data/repository/ninjs/docs/search/GeneralSymbols.html +0 -20
- data/repository/ninjs/docs/search/GeneralT.html +0 -20
- data/repository/ninjs/docs/search/GeneralU.html +0 -20
- data/repository/ninjs/docs/search/GeneralV.html +0 -20
- data/repository/ninjs/docs/search/NoResults.html +0 -15
- data/repository/ninjs/docs/search/VariablesD.html +0 -20
- data/repository/ninjs/docs/search/VariablesN.html +0 -20
- data/repository/ninjs/docs/search/VariablesR.html +0 -20
- data/repository/ninjs/docs/search/VariablesT.html +0 -20
- data/repository/ninjs/docs/styles/main.css +0 -828
- data/repository/ninjs/extensions/jquery.elements.js +0 -60
- data/repository/ninjs/tests/index.html +0 -21
- data/repository/ninjs/tests/ninjs.test.js +0 -188
- data/repository/ninjs/tests/ninjs.utilities.test.js +0 -137
- data/repository/ninjs/tests/qunit/qunit.css +0 -197
- data/repository/ninjs/tests/qunit/qunit.js +0 -1415
- data/repository/ninjs/utilities/all.js +0 -5
- data/repository/ninjs/utilities/array.js +0 -29
- data/repository/ninjs/utilities/cookie.js +0 -0
- data/repository/ninjs/utilities/css.js +0 -51
- data/repository/ninjs/utilities/number.js +0 -11
- data/repository/ninjs/utilities/string.js +0 -61
- data/repository/nullconsole.js +0 -7
- data/repository/qunit/assets/css/qunit.css +0 -196
- data/repository/qunit/qunit.js +0 -1374
- data/repository/selectivizr/1.0.js +0 -5
- data/repository/selectivizr/latest.js +0 -1
- data/repository/syntaxhighlighter/all.js +0 -11
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCore.css +0 -226
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreDefault.css +0 -328
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreDjango.css +0 -331
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreEclipse.css +0 -339
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreEmacs.css +0 -324
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreFadeToGrey.css +0 -328
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreMDUltra.css +0 -324
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreMidnight.css +0 -324
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreRDark.css +0 -324
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeDefault.css +0 -117
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeDjango.css +0 -120
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeEclipse.css +0 -128
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeEmacs.css +0 -113
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeFadeToGrey.css +0 -117
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeMDUltra.css +0 -113
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeMidnight.css +0 -113
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeRDark.css +0 -113
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCore.scss +0 -216
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreDefault.scss +0 -2
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreDjango.scss +0 -2
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreEclipse.scss +0 -2
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreEmacs.scss +0 -2
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreFadeToGrey.scss +0 -2
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreMDUltra.scss +0 -2
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreMidnight.scss +0 -2
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreRDark.scss +0 -2
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeDefault.scss +0 -7
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeDjango.scss +0 -36
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeEclipse.scss +0 -48
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeEmacs.scss +0 -32
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeFadeToGrey.scss +0 -36
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeMDUltra.scss +0 -32
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeMidnight.scss +0 -32
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeRDark.scss +0 -32
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_theme_template.scss +0 -120
- data/repository/syntaxhighlighter/shAutoloader.js +0 -17
- data/repository/syntaxhighlighter/shBrushAS3.js +0 -59
- data/repository/syntaxhighlighter/shBrushAppleScript.js +0 -75
- data/repository/syntaxhighlighter/shBrushBash.js +0 -59
- data/repository/syntaxhighlighter/shBrushCSharp.js +0 -65
- data/repository/syntaxhighlighter/shBrushColdFusion.js +0 -100
- data/repository/syntaxhighlighter/shBrushCpp.js +0 -97
- data/repository/syntaxhighlighter/shBrushCss.js +0 -91
- data/repository/syntaxhighlighter/shBrushDelphi.js +0 -55
- data/repository/syntaxhighlighter/shBrushDiff.js +0 -41
- data/repository/syntaxhighlighter/shBrushErlang.js +0 -52
- data/repository/syntaxhighlighter/shBrushGroovy.js +0 -67
- data/repository/syntaxhighlighter/shBrushJScript.js +0 -52
- data/repository/syntaxhighlighter/shBrushJava.js +0 -57
- data/repository/syntaxhighlighter/shBrushJavaFX.js +0 -58
- data/repository/syntaxhighlighter/shBrushPerl.js +0 -72
- data/repository/syntaxhighlighter/shBrushPhp.js +0 -88
- data/repository/syntaxhighlighter/shBrushPlain.js +0 -33
- data/repository/syntaxhighlighter/shBrushPowerShell.js +0 -74
- data/repository/syntaxhighlighter/shBrushPython.js +0 -64
- data/repository/syntaxhighlighter/shBrushRuby.js +0 -55
- data/repository/syntaxhighlighter/shBrushSass.js +0 -94
- data/repository/syntaxhighlighter/shBrushScala.js +0 -51
- data/repository/syntaxhighlighter/shBrushSql.js +0 -66
- data/repository/syntaxhighlighter/shBrushVb.js +0 -56
- data/repository/syntaxhighlighter/shBrushXml.js +0 -69
- data/repository/syntaxhighlighter/shCore.js +0 -17
- data/repository/syntaxhighlighter/shLegacy.js +0 -17
- data/spec/fixtures/global.js +0 -7
- data/spec/fixtures/global.module.js +0 -7
- data/spec/fixtures/myapplication.js +0 -576
- data/spec/fixtures/nin.js +0 -573
- data/spec/fixtures/ninjs.conf +0 -6
- data/spec/fixtures/test.elements.js +0 -4
- data/spec/fixtures/test.js +0 -15
- data/spec/fixtures/test.model.js +0 -3
- data/spec/fixtures/test.module.js +0 -10
- data/spec/fixtures/updated.myapplication.js +0 -27
- data/spec/fixtures/utilities.js +0 -162
- data/spec/helpers_spec.rb +0 -11
- data/spec/integration_spec.rb +0 -257
- data/spec/manifest_spec.rb +0 -8
- data/spec/ninjs_spec.rb +0 -36
- data/spec/notification_spec.rb +0 -27
- data/spec/spec_helper.rb +0 -5
- data/tmp/ff9e83aa019b712b90200b8d1b8fa0c7e14576af.json +0 -1
- data/tmp/metric_fu/_data/20110305.yml +0 -1548
- data/tmp/metric_fu/output/bluff-min.js +0 -1
- data/tmp/metric_fu/output/excanvas.js +0 -35
- data/tmp/metric_fu/output/js-class.js +0 -1
- data/tmp/metric_fu/output/lib_ninjs_dependencies.rb.html +0 -34
- data/tmp/metric_fu/output/lib_ninjs_helpers.rb.html +0 -34
- data/tmp/metric_fu/output/lib_ninjs_manifest.rb.html +0 -27
- data/tmp/metric_fu/output/rails_best_practices.js +0 -11
- data/tmp/metric_fu/scratch/rcov/rcov.txt +0 -1
data/spec/fixtures/nin.js
DELETED
@@ -1,573 +0,0 @@
|
|
1
|
-
/* File: nin.js */
|
2
|
-
/* File: extend.js */
|
3
|
-
/* File: existence.js */
|
4
|
-
if (is_defined === undefined) {
|
5
|
-
/*
|
6
|
-
Function: is_defined
|
7
|
-
Checks if a variable is undefined.
|
8
|
-
|
9
|
-
Parameters:
|
10
|
-
suspect - suspect variable to test
|
11
|
-
|
12
|
-
Returns:
|
13
|
-
bool
|
14
|
-
|
15
|
-
See Also:
|
16
|
-
|
17
|
-
<is_undefined>
|
18
|
-
*/
|
19
|
-
var is_defined = function(suspect) {
|
20
|
-
return (suspect === undefined) ? false : true;
|
21
|
-
};
|
22
|
-
}
|
23
|
-
|
24
|
-
if (!is_defined(is_undefined)) {
|
25
|
-
/*
|
26
|
-
Function: is_undefined
|
27
|
-
Checks if a variable is defined.
|
28
|
-
|
29
|
-
Parameters:
|
30
|
-
suspect - suspect variable to test
|
31
|
-
|
32
|
-
Returns:
|
33
|
-
bool
|
34
|
-
|
35
|
-
See Also:
|
36
|
-
|
37
|
-
<is_defined>
|
38
|
-
*/
|
39
|
-
var is_undefined = function(suspect) {
|
40
|
-
return (suspect === undefined) ? true : false;
|
41
|
-
};
|
42
|
-
}
|
43
|
-
|
44
|
-
if (is_undefined(is_typeof)) {
|
45
|
-
/*
|
46
|
-
Function: is_typeof
|
47
|
-
Determine an object's type strictly by comparing constructors.
|
48
|
-
|
49
|
-
Parameters:
|
50
|
-
type - The type you expect (ie. String, Number, Array without quotes: is_typeof(String, 'hello'): // true)
|
51
|
-
suspect - The variable to check against type
|
52
|
-
|
53
|
-
Returns:
|
54
|
-
bool
|
55
|
-
|
56
|
-
See Also:
|
57
|
-
<is_numeric>,
|
58
|
-
<is_string>,
|
59
|
-
<is_array>,
|
60
|
-
<is_number>,
|
61
|
-
<is_date>,
|
62
|
-
<is_bool>,
|
63
|
-
<is_regex>
|
64
|
-
*/
|
65
|
-
var is_typeof = function(type, suspect) {
|
66
|
-
try {
|
67
|
-
if (is_undefined(type)) {
|
68
|
-
throw new SyntaxError("is_typeof(Type, suspect): type is undefined");
|
69
|
-
}
|
70
|
-
if (is_undefined(suspect)) {
|
71
|
-
throw new SyntaxError("is_typeof(Type, suspect): suspect is undefined");
|
72
|
-
}
|
73
|
-
|
74
|
-
return (suspect.constructor == type) ? true : false;
|
75
|
-
}
|
76
|
-
catch(error) {
|
77
|
-
alert(error.message);
|
78
|
-
}
|
79
|
-
};
|
80
|
-
}
|
81
|
-
|
82
|
-
if (is_undefined(is_numeric)) {
|
83
|
-
/*
|
84
|
-
Function: is_numeric
|
85
|
-
Determine if the suspect string represents a numeric value.
|
86
|
-
|
87
|
-
Parameters:
|
88
|
-
suspect - variable to check for numeric value
|
89
|
-
|
90
|
-
Returns:
|
91
|
-
bool
|
92
|
-
|
93
|
-
See Also:
|
94
|
-
<is_number>
|
95
|
-
*/
|
96
|
-
var is_numeric = function(suspect) {
|
97
|
-
if(is_typeof(Number, suspect)) {
|
98
|
-
return true;
|
99
|
-
}
|
100
|
-
else {
|
101
|
-
var pattern = /^-?\d+(?:\.\d*)?(?:e[+\-]?\d+)?$/i;
|
102
|
-
return pattern.test(suspect);
|
103
|
-
}
|
104
|
-
};
|
105
|
-
}
|
106
|
-
|
107
|
-
if (is_undefined(is_string)) {
|
108
|
-
/*
|
109
|
-
Function: is_string
|
110
|
-
Determine the suspect is a String. This is a proxy method for is_typeof(String, suspect).
|
111
|
-
|
112
|
-
Parameters:
|
113
|
-
suspect - supect variable to test
|
114
|
-
|
115
|
-
Returns:
|
116
|
-
bool
|
117
|
-
|
118
|
-
See Also:
|
119
|
-
<is_typeof>,
|
120
|
-
<is_numeric>,
|
121
|
-
<is_array>,
|
122
|
-
<is_number>,
|
123
|
-
<is_date>,
|
124
|
-
<is_bool>,
|
125
|
-
<is_regex>
|
126
|
-
*/
|
127
|
-
var is_string = function(suspect) {
|
128
|
-
return is_typeof(String, suspect);
|
129
|
-
};
|
130
|
-
}
|
131
|
-
|
132
|
-
if (is_undefined(is_array)) {
|
133
|
-
/*
|
134
|
-
Function: is_array
|
135
|
-
Determine if the suspect is an Array. This is a proxy method for is_typeof(Array, suspect).
|
136
|
-
|
137
|
-
Parameters:
|
138
|
-
suspect - suspect variable to test
|
139
|
-
|
140
|
-
Returns:
|
141
|
-
bool
|
142
|
-
|
143
|
-
See Also:
|
144
|
-
<is_typeof>,
|
145
|
-
<is_numeric>,
|
146
|
-
<is_string>,
|
147
|
-
<is_number>,
|
148
|
-
<is_date>,
|
149
|
-
<is_bool>,
|
150
|
-
<is_regex>
|
151
|
-
*/
|
152
|
-
var is_array = function(suspect) {
|
153
|
-
return is_typeof(Array, suspect);
|
154
|
-
};
|
155
|
-
}
|
156
|
-
|
157
|
-
if (is_undefined(is_number)) {
|
158
|
-
/*
|
159
|
-
Function: is_number
|
160
|
-
Determines if the suspect is a Number. This is a proxy method for is_typeof(Number, suspect).
|
161
|
-
|
162
|
-
Parameters:
|
163
|
-
suspect - suspect variable to test
|
164
|
-
|
165
|
-
Returns:
|
166
|
-
bool
|
167
|
-
|
168
|
-
See Also:
|
169
|
-
<is_typeof>,
|
170
|
-
<is_numeric>,
|
171
|
-
<is_string>,
|
172
|
-
<is_array>,
|
173
|
-
<is_date>,
|
174
|
-
<is_bool>,
|
175
|
-
<is_regex>
|
176
|
-
*/
|
177
|
-
var is_number = function(suspect) {
|
178
|
-
return is_typeof(Number, suspect);
|
179
|
-
};
|
180
|
-
}
|
181
|
-
|
182
|
-
if (is_undefined(is_date)) {
|
183
|
-
/*
|
184
|
-
Function: is_date
|
185
|
-
Determines if the suspect is a Date. This is a proxy method for is_typeof(Date, suspect).
|
186
|
-
|
187
|
-
Parameters:
|
188
|
-
suspect - suspect variable to test
|
189
|
-
|
190
|
-
Returns:
|
191
|
-
bool
|
192
|
-
|
193
|
-
See Also:
|
194
|
-
<is_typeof>,
|
195
|
-
<is_numeric>,
|
196
|
-
<is_string>,
|
197
|
-
<is_array>,
|
198
|
-
<is_number>,
|
199
|
-
<is_bool>,
|
200
|
-
<is_regex>
|
201
|
-
*/
|
202
|
-
var is_date = function(suspect) {
|
203
|
-
return is_typeof(Date, suspect);
|
204
|
-
};
|
205
|
-
}
|
206
|
-
|
207
|
-
if (is_undefined(is_bool)) {
|
208
|
-
/*
|
209
|
-
Function: is_bool
|
210
|
-
Determines if the suspect is a Boolean. This is a proxy method for is_typeof(Boolean, suspect).
|
211
|
-
|
212
|
-
Parameters:
|
213
|
-
suspect - suspect variable to test
|
214
|
-
|
215
|
-
Returns:
|
216
|
-
bool
|
217
|
-
|
218
|
-
See Also:
|
219
|
-
<is_typeof>,
|
220
|
-
<is_numeric>,
|
221
|
-
<is_string>,
|
222
|
-
<is_array>,
|
223
|
-
<is_number>,
|
224
|
-
<is_regex>
|
225
|
-
*/
|
226
|
-
var is_bool = function(suspect) {
|
227
|
-
return is_typeof(Boolean, suspect);
|
228
|
-
};
|
229
|
-
}
|
230
|
-
|
231
|
-
if (is_undefined(is_regex)) {
|
232
|
-
/*
|
233
|
-
Function: is_regex
|
234
|
-
Determines if the suspect is a RegExp. This is a proxy method for is_typeof(RegExp, suspect).
|
235
|
-
|
236
|
-
Parameters:
|
237
|
-
suspect - suspect variable to test
|
238
|
-
|
239
|
-
Returns:
|
240
|
-
bool
|
241
|
-
|
242
|
-
See Also:
|
243
|
-
<is_typeof>,
|
244
|
-
<is_numeric>,
|
245
|
-
<is_string>,
|
246
|
-
<is_array>,
|
247
|
-
<is_number>,
|
248
|
-
<is_bool>
|
249
|
-
*/
|
250
|
-
var is_regex = function(suspect) {
|
251
|
-
return is_typeof(RegExp, suspect);
|
252
|
-
};
|
253
|
-
}
|
254
|
-
|
255
|
-
if (is_undefined(Function.prototype['method'])) {
|
256
|
-
/*
|
257
|
-
Function: method
|
258
|
-
Method to add a method to an object (ie. String.method('my_method', my_func); //-> 'hello'.my_func())
|
259
|
-
|
260
|
-
Parameters:
|
261
|
-
name - name of the method
|
262
|
-
func - function definition
|
263
|
-
|
264
|
-
Returns:
|
265
|
-
this === Function
|
266
|
-
|
267
|
-
> String.method('custom_method', function() {
|
268
|
-
> // define custom_method
|
269
|
-
> });
|
270
|
-
>
|
271
|
-
> "hello".custom_method();
|
272
|
-
*/
|
273
|
-
Function.prototype.method = function(name, func) {
|
274
|
-
try {
|
275
|
-
if (is_undefined(name)) {
|
276
|
-
throw new SyntaxError("Object.method(name, func): name is undefined");
|
277
|
-
}
|
278
|
-
if (is_undefined(func)) {
|
279
|
-
throw new SyntaxError("Object.method(name, func): func is undefined");
|
280
|
-
}
|
281
|
-
|
282
|
-
if (is_undefined(this.prototype[name])) {
|
283
|
-
this.prototype[name] = func;
|
284
|
-
return this;
|
285
|
-
}
|
286
|
-
}
|
287
|
-
catch(error) {
|
288
|
-
alert(error.message);
|
289
|
-
}
|
290
|
-
};
|
291
|
-
}
|
292
|
-
/*
|
293
|
-
File: module.js
|
294
|
-
|
295
|
-
Class: NinjsModule
|
296
|
-
A NinjsModule is an object which encapsulates a certain behavior or functionality.
|
297
|
-
|
298
|
-
Parameters:
|
299
|
-
name - the name of the module
|
300
|
-
|
301
|
-
See Also:
|
302
|
-
<NinjsApplication>
|
303
|
-
*/
|
304
|
-
var NinjsModule = function(name) {
|
305
|
-
/*
|
306
|
-
Variable: data
|
307
|
-
The module's data object
|
308
|
-
*/
|
309
|
-
this.data = {};
|
310
|
-
/*
|
311
|
-
Variable: name
|
312
|
-
The module's name (string)
|
313
|
-
*/
|
314
|
-
this.name = name;
|
315
|
-
/*
|
316
|
-
Variable: run_tests (beta)
|
317
|
-
Boolean to turn tests on/off
|
318
|
-
*/
|
319
|
-
this.run_tests = false;
|
320
|
-
/*
|
321
|
-
Variable: tests (beta)
|
322
|
-
Array of test files to run
|
323
|
-
*/
|
324
|
-
this.tests = [];
|
325
|
-
};
|
326
|
-
|
327
|
-
/*
|
328
|
-
Method: actions
|
329
|
-
The actions method contains code to be executed when run is called. This method is a placeholder to be overwritten.
|
330
|
-
|
331
|
-
> MyModule.actions = function() {
|
332
|
-
> // define actions here
|
333
|
-
>};
|
334
|
-
*/
|
335
|
-
NinjsModule.method('actions', function() {});
|
336
|
-
|
337
|
-
|
338
|
-
/*
|
339
|
-
Method: run
|
340
|
-
Waits for the DOM to load then calls execute.
|
341
|
-
|
342
|
-
> MyModule.run();
|
343
|
-
*/
|
344
|
-
NinjsModule.method('run', function() {
|
345
|
-
this.call_on_ready(this.execute);
|
346
|
-
});
|
347
|
-
|
348
|
-
/*
|
349
|
-
Method: call_on_ready
|
350
|
-
Waits for the DOM to be ready and then executes a callback.
|
351
|
-
|
352
|
-
Parameters:
|
353
|
-
callback - function to be called when the DOM is ready
|
354
|
-
|
355
|
-
> MyModule.call_on_ready(function() {
|
356
|
-
> // some code to execute when the DOM is ready
|
357
|
-
> });
|
358
|
-
*/
|
359
|
-
NinjsModule.method('call_on_ready', function(callback) {
|
360
|
-
var timer;
|
361
|
-
var module = this;
|
362
|
-
|
363
|
-
function check_ready() {
|
364
|
-
timer = setInterval(is_ready, 13);
|
365
|
-
}
|
366
|
-
|
367
|
-
function is_ready() {
|
368
|
-
if (document && document.getElementsByTagName && document.getElementById && document.body) {
|
369
|
-
clearInterval(timer);
|
370
|
-
timer = null;
|
371
|
-
callback.call(module);
|
372
|
-
}
|
373
|
-
}
|
374
|
-
|
375
|
-
check_ready();
|
376
|
-
});
|
377
|
-
|
378
|
-
/*
|
379
|
-
Method: execute
|
380
|
-
Wrapper method that set's up the environment and then calls actions.
|
381
|
-
|
382
|
-
> MyModule.execute();
|
383
|
-
*/
|
384
|
-
NinjsModule.method('execute', function() {
|
385
|
-
this.old__ = is_defined(window.__) ? window.__ : undefined;
|
386
|
-
window.__ = this;
|
387
|
-
|
388
|
-
if (this.run_tests) {
|
389
|
-
this._run_tests();
|
390
|
-
}
|
391
|
-
this.actions();
|
392
|
-
|
393
|
-
if(is_defined(this.old__)) {
|
394
|
-
window.__ = this.old__;
|
395
|
-
}
|
396
|
-
});
|
397
|
-
|
398
|
-
/*
|
399
|
-
Method: elements
|
400
|
-
Method to define module elements.
|
401
|
-
|
402
|
-
Parameters:
|
403
|
-
callback - function to define a module's elements
|
404
|
-
|
405
|
-
> MyModule.elements(function() {
|
406
|
-
> // element definitions go here
|
407
|
-
> });
|
408
|
-
*/
|
409
|
-
NinjsModule.method('elements', function(callback) {
|
410
|
-
this.old__ = is_defined(window.__) ? window.__ : undefined;
|
411
|
-
window.__ = this;
|
412
|
-
|
413
|
-
this.call_on_ready(callback);
|
414
|
-
|
415
|
-
if(is_defined(this.old__)) {
|
416
|
-
window.__ = this.old__;
|
417
|
-
}
|
418
|
-
});
|
419
|
-
|
420
|
-
|
421
|
-
/*
|
422
|
-
Method: set_data
|
423
|
-
Adds properties to the module's data object.
|
424
|
-
|
425
|
-
Parameters:
|
426
|
-
key - string or object (if string = key, if object sets multiple properties)
|
427
|
-
value - value of key if key is string
|
428
|
-
|
429
|
-
> MyModule.set_data('some_key', 'some_value');
|
430
|
-
> MyModule.data.some_key === 'some_value'
|
431
|
-
|
432
|
-
> MyModule.set_data({
|
433
|
-
> 'property_one': 'value_one',
|
434
|
-
> 'property_two': 'value_two'
|
435
|
-
> });
|
436
|
-
> MyModule.data.property_one === 'value_one'
|
437
|
-
> MyModule.data.property_two === 'value_two'
|
438
|
-
*/
|
439
|
-
NinjsModule.method('set_data', function(key, value) {
|
440
|
-
try {
|
441
|
-
if (is_undefined(key)) {
|
442
|
-
throw new SyntaxError('NinjsModule.set_data(key, value): key is undefined');
|
443
|
-
}
|
444
|
-
|
445
|
-
if (is_typeof(String, key) && is_undefined(value)) {
|
446
|
-
throw new SyntaxError('NinjsModule.set_data(key, value): value is undefined');
|
447
|
-
}
|
448
|
-
|
449
|
-
if (is_typeof(String, key)) {
|
450
|
-
this.data[key] = value;
|
451
|
-
}
|
452
|
-
else if (is_typeof(Object, key)) {
|
453
|
-
var data = key;
|
454
|
-
for(var property in data) {
|
455
|
-
this.data[property] = data[property];
|
456
|
-
}
|
457
|
-
}
|
458
|
-
|
459
|
-
return this;
|
460
|
-
}
|
461
|
-
catch(error) {
|
462
|
-
alert(error.message);
|
463
|
-
}
|
464
|
-
});
|
465
|
-
|
466
|
-
/*
|
467
|
-
Method: add_test
|
468
|
-
Adds a test file to the tests array (beta).
|
469
|
-
|
470
|
-
Parameters:
|
471
|
-
test_file - File to add to the tests array
|
472
|
-
|
473
|
-
> MyModule.add_test('mytest.test.js');
|
474
|
-
*/
|
475
|
-
NinjsModule.method('add_test', function(test_file) {
|
476
|
-
this.tests.push(test_file);
|
477
|
-
});
|
478
|
-
|
479
|
-
/*
|
480
|
-
Method: _run_tests
|
481
|
-
Runs the test files in the test array. This method is automatically called by the execute method if run_tests === true
|
482
|
-
*/
|
483
|
-
NinjsModule.method('_run_tests', function() {
|
484
|
-
var test_template = [];
|
485
|
-
test_template.push('<div class="test-results" title="Test Results">');
|
486
|
-
test_template.push('<h1 id="qunit-header">' + this.name + ' module tests</h1>');
|
487
|
-
test_template.push('<h2 id="qunit-banner"></h2>');
|
488
|
-
test_template.push('<h2 id="qunit-userAgent"></h2>');
|
489
|
-
test_template.push('<ol id="qunit-tests"></ol>');
|
490
|
-
test_template.push('</div>');
|
491
|
-
|
492
|
-
var qunit_dependencies = '<script src="' + _.tests_path +'qunit/qunit.js"></script>';
|
493
|
-
$.getScript(_.tests_path + 'qunit/qunit.js');
|
494
|
-
var qunit_styles = '<link rel="stylesheet" href="' + _.tests_path + 'qunit/qunit.css">';
|
495
|
-
$('body').append(qunit_styles);
|
496
|
-
$('body').append(test_template.join("\n"));
|
497
|
-
|
498
|
-
this.tests.each(function(test) {
|
499
|
-
$.getScript(_.tests_path + test + '.test.js', function() {
|
500
|
-
var test_results_dialog = $('.test-results');
|
501
|
-
var height = $(window).height() - 200;
|
502
|
-
var width = $(window).width() - 300;
|
503
|
-
try {
|
504
|
-
test_results_dialog.dialog({
|
505
|
-
width: width,
|
506
|
-
height: height,
|
507
|
-
autoOpen: false,
|
508
|
-
buttons: {
|
509
|
-
"Thanks buddy": function() {
|
510
|
-
test_results_dialog.dialog('close');
|
511
|
-
}
|
512
|
-
}
|
513
|
-
});
|
514
|
-
var failed = $('.failed');
|
515
|
-
console.log(failed.html());
|
516
|
-
test_results_dialog.dialog('open');
|
517
|
-
}
|
518
|
-
catch(error) {
|
519
|
-
alert("Test harness requires jQueryUI");
|
520
|
-
}
|
521
|
-
});
|
522
|
-
});
|
523
|
-
});
|
524
|
-
/*
|
525
|
-
File: application.js
|
526
|
-
|
527
|
-
Class: NinjsApplication
|
528
|
-
An NinjsApplication object serves as your application's namespace and includes a utility to add modules to the application object.
|
529
|
-
|
530
|
-
See Also:
|
531
|
-
<NinjsModule>
|
532
|
-
*/
|
533
|
-
var NinjsApplication = function(base_url, tests_path) {
|
534
|
-
if (is_undefined(window._)) {
|
535
|
-
window._ = this;
|
536
|
-
}
|
537
|
-
|
538
|
-
if(is_defined(tests_path)) {
|
539
|
-
this.tests_path = tests_path;
|
540
|
-
}
|
541
|
-
|
542
|
-
if(is_defined(base_url)) {
|
543
|
-
this.site_url = function(path) {
|
544
|
-
var path = path || '';
|
545
|
-
return base_url + path;
|
546
|
-
}
|
547
|
-
}
|
548
|
-
};
|
549
|
-
|
550
|
-
/*
|
551
|
-
Method: add_module
|
552
|
-
Adds a NinjsModule to the application.
|
553
|
-
|
554
|
-
Parameters:
|
555
|
-
name - the name of the module
|
556
|
-
|
557
|
-
> myapp.add_module('my_module');
|
558
|
-
*/
|
559
|
-
NinjsApplication.method('add_module', function(name) {
|
560
|
-
try {
|
561
|
-
if (is_undefined(name)) {
|
562
|
-
throw new SyntaxError("NinjsApplication.add_module(name): name is undefined");
|
563
|
-
}
|
564
|
-
|
565
|
-
if (is_defined(this[name])) {
|
566
|
-
throw new SyntaxError("NinjsApplication.add_module(name): '" + name + "' already declared");
|
567
|
-
}
|
568
|
-
this[name] = new NinjsModule(name);
|
569
|
-
}
|
570
|
-
catch(error) {
|
571
|
-
alert(error.message);
|
572
|
-
}
|
573
|
-
});
|