bixbite 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.markdown +49 -0
- data/VERSION +1 -0
- data/bin/bixbite +73 -0
- data/lib/bixbite.rb +13 -0
- data/lib/bixbite/command.rb +14 -0
- data/lib/bixbite/create.rb +76 -0
- data/template/Rakefile +25 -0
- data/template/assets/bixbite/Rakefile.rb +297 -0
- data/template/assets/naturaldocs/NaturalDocs/Config/Languages.txt +286 -0
- data/template/assets/naturaldocs/NaturalDocs/Config/Topics.txt +382 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/customizinglanguages.html +52 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/customizingtopics.html +74 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/documenting.html +58 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/documenting/reference.html +146 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/documenting/walkthrough.html +180 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/example/Default.css +528 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/example/NaturalDocs.js +204 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/examples.css +90 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/background.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/leftside.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/logo.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overbody.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overbodybg.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overleftmargin.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overmenu.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overmenubg.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/rightside.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/logo.gif +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/about.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/background.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/bottomleft.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/bottomright.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/community.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/customizing.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/using.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/index.html +9 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/javascript/BrowserStyles.js +77 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/javascript/PNGHandling.js +72 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/keywords.html +38 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/languages.html +32 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/menu.html +79 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/output.html +84 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/running.html +40 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/styles.css +290 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/styles.html +52 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/troubleshooting.html +18 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/CSSGuide.txt +947 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/File Parsing.txt +83 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/HTMLTestCases.pm +269 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/Languages.txt +107 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/NDMarkup.txt +91 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/Symbol Management.txt +59 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/images/Logo.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/JavaScript/NaturalDocs.js +836 -0
- data/template/assets/naturaldocs/NaturalDocs/License-GPL.txt +341 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/BinaryFile.pm +294 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder.pm +280 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/Base.pm +348 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/FramedHTML.pm +345 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/HTML.pm +398 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/HTMLBase.pm +3693 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy.pm +860 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy/Class.pm +412 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy/File.pm +157 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ConfigFile.pm +497 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Constants.pm +165 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/DefineMembers.pm +100 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Error.pm +305 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/File.pm +540 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable.pm +383 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable/Reference.pm +44 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable/String.pm +110 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages.pm +1475 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/ActionScript.pm +1473 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Ada.pm +38 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced.pm +828 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced/Scope.pm +95 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced/ScopeChange.pm +70 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Base.pm +832 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/CSharp.pm +1484 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/PLSQL.pm +319 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Pascal.pm +143 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Perl.pm +1370 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Prototype.pm +92 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Prototype/Parameter.pm +87 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Simple.pm +503 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Tcl.pm +219 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Menu.pm +3406 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Menu/Entry.pm +201 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/NDMarkup.pm +76 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser.pm +1331 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/JavaDoc.pm +464 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/Native.pm +1060 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/ParsedTopic.pm +253 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project.pm +1402 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project/ImageFile.pm +160 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project/SourceFile.pm +113 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ReferenceString.pm +334 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Settings.pm +1418 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Settings/BuildTarget.pm +66 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB.pm +678 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/Extension.pm +84 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/File.pm +129 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/Item.pm +201 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/ItemDefinition.pm +45 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/WatchedFileDefinitions.pm +159 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/StatusMessage.pm +102 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolString.pm +212 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable.pm +1984 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/File.pm +186 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/IndexElement.pm +522 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/Reference.pm +273 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/ReferenceTarget.pm +97 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/Symbol.pm +428 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/SymbolDefinition.pm +96 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Topics.pm +1319 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Topics/Type.pm +151 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Version.pm +384 -0
- data/template/assets/naturaldocs/NaturalDocs/NaturalDocs +400 -0
- data/template/assets/naturaldocs/NaturalDocs/NaturalDocs.bat +17 -0
- data/template/assets/naturaldocs/NaturalDocs/Styles/Default.css +767 -0
- data/template/assets/naturaldocs/NaturalDocs/Styles/Roman.css +765 -0
- data/template/assets/naturaldocs/NaturalDocs/Styles/Small.css +763 -0
- data/template/assets/utilities/pngout +0 -0
- data/template/deploy/public_html/.htaccess +0 -0
- data/template/documentation/js/.htaccess +0 -0
- data/template/src/html/.htaccess +76 -0
- data/template/src/html/css/cmn/global.css +96 -0
- data/template/src/html/css/cmn/ie.css +15 -0
- data/template/src/html/css/cmn/ie6.css +15 -0
- data/template/src/html/images/cmn/.htaccess +0 -0
- data/template/src/html/images/tmp/.htaccess +0 -0
- data/template/src/html/includes/debug.inc +5 -0
- data/template/src/html/includes/footer.inc +52 -0
- data/template/src/html/includes/header.inc +61 -0
- data/template/src/html/includes/html.inc +3 -0
- data/template/src/html/includes/namespace.inc +19 -0
- data/template/src/html/includes/page.inc +151 -0
- data/template/src/html/index.html +35 -0
- data/template/src/html/js/cmn/bootstrap.js +74 -0
- data/template/src/html/js/cmn/global.js +142 -0
- data/template/src/html/js/cmn/lib/LAB.js +348 -0
- data/template/src/html/min/.htaccess +4 -0
- data/template/src/html/min/MinifyCLI.php +19 -0
- data/template/src/html/min/README.txt +132 -0
- data/template/src/html/min/builder/_index.js +242 -0
- data/template/src/html/min/builder/bm.js +36 -0
- data/template/src/html/min/builder/index.php +182 -0
- data/template/src/html/min/builder/ocCheck.php +36 -0
- data/template/src/html/min/builder/rewriteTest.js +1 -0
- data/template/src/html/min/config.php +187 -0
- data/template/src/html/min/groupsConfig.php +34 -0
- data/template/src/html/min/index.php +66 -0
- data/template/src/html/min/lib/FirePHP.php +1370 -0
- data/template/src/html/min/lib/HTTP/ConditionalGet.php +348 -0
- data/template/src/html/min/lib/HTTP/Encoder.php +326 -0
- data/template/src/html/min/lib/JSMin.php +314 -0
- data/template/src/html/min/lib/JSMinPlus.php +1872 -0
- data/template/src/html/min/lib/Minify.php +532 -0
- data/template/src/html/min/lib/Minify/Build.php +103 -0
- data/template/src/html/min/lib/Minify/CSS.php +83 -0
- data/template/src/html/min/lib/Minify/CSS/Compressor.php +250 -0
- data/template/src/html/min/lib/Minify/CSS/UriRewriter.php +270 -0
- data/template/src/html/min/lib/Minify/Cache/APC.php +130 -0
- data/template/src/html/min/lib/Minify/Cache/File.php +125 -0
- data/template/src/html/min/lib/Minify/Cache/Memcache.php +137 -0
- data/template/src/html/min/lib/Minify/ClosureCompiler.php +85 -0
- data/template/src/html/min/lib/Minify/CommentPreserver.php +90 -0
- data/template/src/html/min/lib/Minify/Controller/Base.php +202 -0
- data/template/src/html/min/lib/Minify/Controller/Files.php +78 -0
- data/template/src/html/min/lib/Minify/Controller/Groups.php +94 -0
- data/template/src/html/min/lib/Minify/Controller/MinApp.php +132 -0
- data/template/src/html/min/lib/Minify/Controller/Page.php +82 -0
- data/template/src/html/min/lib/Minify/Controller/Version1.php +118 -0
- data/template/src/html/min/lib/Minify/HTML.php +245 -0
- data/template/src/html/min/lib/Minify/ImportProcessor.php +157 -0
- data/template/src/html/min/lib/Minify/Lines.php +131 -0
- data/template/src/html/min/lib/Minify/Logger.php +45 -0
- data/template/src/html/min/lib/Minify/Packer.php +37 -0
- data/template/src/html/min/lib/Minify/Source.php +187 -0
- data/template/src/html/min/lib/Minify/YUICompressor.php +139 -0
- data/template/src/html/min/lib/Solar/Dir.php +199 -0
- data/template/src/html/min/lib/closure-compiler.jar +0 -0
- data/template/src/html/min/lib/yuicompressor-2.4.2.jar +0 -0
- data/template/src/html/min/utils.php +90 -0
- data/template/src/templates/css/template.css +7 -0
- data/template/src/templates/js/template.js +72 -0
- data/template/src/templates/template.html +18 -0
- data/template/src/yaml/config.yml +46 -0
- data/template/src/yaml/deploy.yml +35 -0
- data/test/bixbite_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- metadata +278 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
<?php
|
2
|
+
require('includes/namespace.inc');
|
3
|
+
|
4
|
+
$page->setPageTitle('Index');
|
5
|
+
|
6
|
+
ob_start();
|
7
|
+
?>
|
8
|
+
|
9
|
+
<!-- Start [#content] -->
|
10
|
+
<div id="content">
|
11
|
+
<h1>Completed Pages</h1>
|
12
|
+
|
13
|
+
<div id="contentWrapper">
|
14
|
+
<ul style="font-size: 16px; line-height: 1.5;">
|
15
|
+
<?php
|
16
|
+
foreach ($page->listFilesInDirectory(SITE_ROOT, "html") as $key => $value) {
|
17
|
+
|
18
|
+
if ($value != "index.html") {
|
19
|
+
|
20
|
+
$raw = file_get_contents(SITE_ROOT . $value);
|
21
|
+
$regex = '/\$page->setPageTitle\(\'([^\']+)\'\)/';
|
22
|
+
preg_match($regex, $raw, $matches, PREG_OFFSET_CAPTURE);
|
23
|
+
$title = $matches[1][0];
|
24
|
+
|
25
|
+
echo "\t\t\t\t\t" . '<li><a href="' . $value . '">' . $title . '</a></li>' . "\n";
|
26
|
+
}
|
27
|
+
}
|
28
|
+
?>
|
29
|
+
</ul>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
</div>
|
33
|
+
<!-- End [#content] -->
|
34
|
+
|
35
|
+
<?php $page->output(ob_get_clean()); ?>
|
@@ -0,0 +1,74 @@
|
|
1
|
+
/*
|
2
|
+
File: bootstrap.js
|
3
|
+
|
4
|
+
About: Version
|
5
|
+
1.0
|
6
|
+
|
7
|
+
Project: __PROJECT_NAME__
|
8
|
+
|
9
|
+
Description:
|
10
|
+
This should be included directly after the opening <body> tag.
|
11
|
+
|
12
|
+
If a module required a <script> tag in the middle of the page
|
13
|
+
markup, queue up the code in a function so that jQuery and other
|
14
|
+
dependencies are available for the code runs.
|
15
|
+
|
16
|
+
Example:
|
17
|
+
><script type="text/javascript">
|
18
|
+
> __PROJECT_NAMESPACE__.queue(function() {
|
19
|
+
> // do something with jQuery, etc
|
20
|
+
> });
|
21
|
+
></script>
|
22
|
+
>
|
23
|
+
>...
|
24
|
+
>
|
25
|
+
>$(document).ready(function() {
|
26
|
+
> __PROJECT_NAMESPACE__.unqueue();
|
27
|
+
>})
|
28
|
+
|
29
|
+
*/
|
30
|
+
|
31
|
+
/*
|
32
|
+
Class: __PROJECT_NAMESPACE__
|
33
|
+
Scoped to the __PROJECT_NAMESPACE__ Global Namespace
|
34
|
+
*/
|
35
|
+
var __PROJECT_NAMESPACE__ = window.__PROJECT_NAMESPACE__ || {};
|
36
|
+
|
37
|
+
(function(__PROJECT_NAMESPACE__) {
|
38
|
+
|
39
|
+
document.body.className += " js-enabled";
|
40
|
+
|
41
|
+
var queue = [];
|
42
|
+
|
43
|
+
/*
|
44
|
+
method: queue
|
45
|
+
Adds functions to a queuer to be deployed once the DOM is ready
|
46
|
+
|
47
|
+
Parameters:
|
48
|
+
arguments - the function (or functions) to add to the queue
|
49
|
+
*/
|
50
|
+
__PROJECT_NAMESPACE__.queue = function() {
|
51
|
+
for (var i = -1, func; func = arguments[++i];) {
|
52
|
+
queue[queue.length] = func;
|
53
|
+
}
|
54
|
+
};
|
55
|
+
|
56
|
+
/*
|
57
|
+
method: unqueue
|
58
|
+
Fires each queued function
|
59
|
+
*/
|
60
|
+
__PROJECT_NAMESPACE__.unqueue = function() {
|
61
|
+
var func;
|
62
|
+
while (queue != null && (func = queue.shift())) {
|
63
|
+
func();
|
64
|
+
}
|
65
|
+
|
66
|
+
// Nullify
|
67
|
+
for (var i = (queue != null) ? queue.length - 1 : -1; i >= 0; i--) {
|
68
|
+
queue[i] = null;
|
69
|
+
}
|
70
|
+
|
71
|
+
queue = null;
|
72
|
+
};
|
73
|
+
|
74
|
+
}(__PROJECT_NAMESPACE__));
|
@@ -0,0 +1,142 @@
|
|
1
|
+
/*
|
2
|
+
File: global.js
|
3
|
+
|
4
|
+
About: Version
|
5
|
+
1.0
|
6
|
+
|
7
|
+
Project: __PROJECT_NAME__
|
8
|
+
|
9
|
+
Description:
|
10
|
+
A common file that includes all globally shared functionality for __PROJECT_NAMESPACE__
|
11
|
+
|
12
|
+
Requires:
|
13
|
+
- LABjs <http://labjs.com/>
|
14
|
+
- __JS_LIB__
|
15
|
+
|
16
|
+
Requires:
|
17
|
+
- <bootstrap.js>
|
18
|
+
|
19
|
+
*/
|
20
|
+
|
21
|
+
/*
|
22
|
+
Class: __PROJECT_NAMESPACE__
|
23
|
+
Scoped to the __PROJECT_NAMESPACE__ Global Namespace
|
24
|
+
*/
|
25
|
+
var __PROJECT_NAMESPACE__ = window.__PROJECT_NAMESPACE__ || {};
|
26
|
+
|
27
|
+
// When the DOM is ready.
|
28
|
+
(function () {
|
29
|
+
|
30
|
+
// Storing a variable to reference
|
31
|
+
var $self = __PROJECT_NAMESPACE__;
|
32
|
+
|
33
|
+
/*
|
34
|
+
Namespace: __PROJECT_NAMESPACE__.vars
|
35
|
+
Shared global variables
|
36
|
+
*/
|
37
|
+
$self.vars = {
|
38
|
+
|
39
|
+
/*
|
40
|
+
variable: queue
|
41
|
+
Contains the functions ready to be fired on DOM ready
|
42
|
+
*/
|
43
|
+
queue : []
|
44
|
+
};
|
45
|
+
|
46
|
+
/*
|
47
|
+
Namespace: __PROJECT_NAMESPACE__.legacy
|
48
|
+
A legacy namespace to be used if __PROJECT_NAMESPACE__ has any legacy dependencies
|
49
|
+
*/
|
50
|
+
$self.legacy = {};
|
51
|
+
|
52
|
+
/*
|
53
|
+
Namespace: __PROJECT_NAMESPACE__.utils
|
54
|
+
Shared global utilities
|
55
|
+
*/
|
56
|
+
$self.utils = {
|
57
|
+
|
58
|
+
/*
|
59
|
+
sub: ie6Check
|
60
|
+
Adds an IE6 flag to jQuery
|
61
|
+
*/
|
62
|
+
ie6Check : function() {
|
63
|
+
// Let's set a flag for IE 6
|
64
|
+
$.extend($.browser, {
|
65
|
+
ie6 : function () {
|
66
|
+
return !!($.browser.msie && $.browser.version == 6);
|
67
|
+
}()
|
68
|
+
});
|
69
|
+
}(),
|
70
|
+
|
71
|
+
/*
|
72
|
+
sub: queue
|
73
|
+
A global initializer. Takes a function argument and queues it until <init> is fired
|
74
|
+
|
75
|
+
Parameters:
|
76
|
+
object - The function to initialize when the DOM is ready
|
77
|
+
|
78
|
+
Example:
|
79
|
+
>__PROJECT_NAMESPACE__.utils.queue(function() {
|
80
|
+
> // Add code here
|
81
|
+
>});
|
82
|
+
*/
|
83
|
+
queue : function (object) {
|
84
|
+
$self.vars.queue.push(object);
|
85
|
+
},
|
86
|
+
|
87
|
+
/*
|
88
|
+
sub: init
|
89
|
+
When fired, loops through $self.vars.queue and fires each queued function
|
90
|
+
*/
|
91
|
+
init : function() {
|
92
|
+
var queue = $self.vars.queue;
|
93
|
+
|
94
|
+
$.each(queue, function(i, object) {
|
95
|
+
for (var key in object) {
|
96
|
+
if (object.hasOwnProperty(key) && (typeof object[key] === "function")) {
|
97
|
+
object[key]();
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
});
|
102
|
+
}
|
103
|
+
};
|
104
|
+
|
105
|
+
/*
|
106
|
+
Namespace: __PROJECT_NAMESPACE__
|
107
|
+
Under the __PROJECT_NAMESPACE__ Local Namespace
|
108
|
+
*/
|
109
|
+
|
110
|
+
/*
|
111
|
+
Function: global
|
112
|
+
Takes care of a few global functionalities:
|
113
|
+
- Fires __PROJECT_NAMESPACE__.unqueue
|
114
|
+
- Overrides the default jQuery easing
|
115
|
+
- Adds the IE BackgroundImageCache fix
|
116
|
+
*/
|
117
|
+
$self.global = function () {
|
118
|
+
|
119
|
+
// Unqueue inline functions
|
120
|
+
__PROJECT_NAMESPACE__.unqueue();
|
121
|
+
|
122
|
+
if ($.browser.msie) {
|
123
|
+
try {
|
124
|
+
// Enable background image cache
|
125
|
+
document.execCommand("BackgroundImageCache", false, true);
|
126
|
+
} catch (ex) {}
|
127
|
+
}
|
128
|
+
};
|
129
|
+
|
130
|
+
/*
|
131
|
+
Function: header
|
132
|
+
Encapsulates functionality found in the #header space
|
133
|
+
*/
|
134
|
+
$self.header = function() {};
|
135
|
+
|
136
|
+
/*
|
137
|
+
Callback: init
|
138
|
+
Sends local functions to a global queuer for initialization See: <__PROJECT_NAMESPACE__.utils.queue>
|
139
|
+
*/
|
140
|
+
$self.utils.queue($self);
|
141
|
+
|
142
|
+
}).call(__PROJECT_NAMESPACE__);
|
@@ -0,0 +1,348 @@
|
|
1
|
+
// LAB.js (LABjs :: Loading And Blocking JavaScript)
|
2
|
+
// v1.0.1 (c) Kyle Simpson
|
3
|
+
// MIT License
|
4
|
+
|
5
|
+
(function(global){
|
6
|
+
var sSTRING = "string", // constants used for compression optimization
|
7
|
+
sHEAD = "head",
|
8
|
+
sBODY = "body",
|
9
|
+
sSCRIPT = "script",
|
10
|
+
sREADYSTATE = "readyState",
|
11
|
+
sPRELOADDONE = "preloaddone",
|
12
|
+
sLOADTRIGGER = "loadtrigger",
|
13
|
+
sSRCURI = "srcuri",
|
14
|
+
sPRELOAD = "preload",
|
15
|
+
sCOMPLETE = "complete",
|
16
|
+
sDONE = "done",
|
17
|
+
sWHICH = "which",
|
18
|
+
sONREADYSTATECHANGE = "onreadystatechange",
|
19
|
+
sONLOAD = "onload",
|
20
|
+
sHASOWNPROPERTY = "hasOwnProperty",
|
21
|
+
nNULL = null,
|
22
|
+
bTRUE = true,
|
23
|
+
bFALSE = false,
|
24
|
+
oDOC = global.document,
|
25
|
+
oDOCLOC = oDOC.location,
|
26
|
+
oACTIVEX = global.ActiveXObject,
|
27
|
+
fSETTIMEOUT = global.setTimeout,
|
28
|
+
fCLEARTIMEOUT = global.clearTimeout,
|
29
|
+
fGETELEMENTSBYTAGNAME = function(tn){return oDOC.getElementsByTagName(tn);},
|
30
|
+
fOBJTOSTRING = Object.prototype.toString,
|
31
|
+
fNOOP = function(){},
|
32
|
+
append_to = {},
|
33
|
+
all_scripts = {},
|
34
|
+
PAGEROOT = /^[^?#]*\//.exec(oDOCLOC.href)[0], // these ROOTs do not support file:/// usage, only http:// type usage
|
35
|
+
DOCROOT = /^\w+\:\/\/\/?[^\/]+/.exec(PAGEROOT)[0], // optional third / in the protocol portion of this regex so that LABjs doesn't blow up when used in file:/// usage
|
36
|
+
docScripts = fGETELEMENTSBYTAGNAME(sSCRIPT),
|
37
|
+
|
38
|
+
// Ah-ha hush that fuss, feature inference is used to detect specific browsers
|
39
|
+
// because the techniques used in LABjs have no known feature detection. If
|
40
|
+
// you know of a feature test please contact me ASAP. Feature inference is used
|
41
|
+
// instead of user agent sniffing because the UA string can be easily
|
42
|
+
// spoofed and is not adequate for such a mission critical part of the code.
|
43
|
+
is_opera = global.opera && fOBJTOSTRING.call(global.opera) == "[object Opera]",
|
44
|
+
is_gecko = (function(o) { o[o] = o+""; return o[o] != o+""; })(new String("__count__")),
|
45
|
+
|
46
|
+
global_defs = {
|
47
|
+
cache:!(is_gecko||is_opera), // browsers like IE/Safari/Chrome can use the "cache" trick to preload
|
48
|
+
order:is_gecko||is_opera, // FF/Opera preserve execution order with script tags automatically, so just add all scripts as fast as possible
|
49
|
+
xhr:bTRUE, // use XHR trick to preload local scripts
|
50
|
+
dupe:bTRUE, // allow duplicate scripts? defaults to true now 'cause is slightly more performant that way (less checks)
|
51
|
+
preserve:bFALSE, // preserve execution order of all loaded scripts (regardless of preloading)
|
52
|
+
base:"", // base path to prepend to all non-absolute-path scripts
|
53
|
+
which:sHEAD // which DOM object ("head" or "body") to append scripts to
|
54
|
+
}
|
55
|
+
;
|
56
|
+
global_defs[sPRELOAD] = bTRUE; // use various tricks for "preloading" scripts
|
57
|
+
|
58
|
+
append_to[sHEAD] = fGETELEMENTSBYTAGNAME(sHEAD);
|
59
|
+
append_to[sBODY] = fGETELEMENTSBYTAGNAME(sBODY);
|
60
|
+
|
61
|
+
function isFunc(func) { return fOBJTOSTRING.call(func) === "[object Function]"; }
|
62
|
+
function canonicalScriptURI(src,base_path) {
|
63
|
+
var regex = /^\w+\:\/\//, ret;
|
64
|
+
if (typeof src !== sSTRING) src = "";
|
65
|
+
if (typeof base_path !== sSTRING) base_path = "";
|
66
|
+
ret = (regex.test(src) ? "" : base_path) + src;
|
67
|
+
return ((regex.test(ret) ? "" : (ret.charAt(0) === "/" ? DOCROOT : PAGEROOT)) + ret);
|
68
|
+
}
|
69
|
+
function sameDomain(src) { return (canonicalScriptURI(src).indexOf(DOCROOT) === 0); }
|
70
|
+
function scriptTagExists(uri) { // checks if a script uri has ever been loaded into this page's DOM
|
71
|
+
var i = 0, script;
|
72
|
+
while (script = docScripts[i++]) {
|
73
|
+
if (typeof script.src === sSTRING && uri === canonicalScriptURI(script.src) && script.getAttribute("rel") !== sPRELOAD) return bTRUE;
|
74
|
+
}
|
75
|
+
return bFALSE;
|
76
|
+
}
|
77
|
+
function engine(queueExec,opts) {
|
78
|
+
queueExec = !(!queueExec);
|
79
|
+
if (opts == nNULL) opts = global_defs;
|
80
|
+
|
81
|
+
var ready = bFALSE,
|
82
|
+
_use_preload = queueExec && opts[sPRELOAD],
|
83
|
+
_use_cache_preload = _use_preload && opts.cache,
|
84
|
+
_use_script_order = _use_preload && opts.order,
|
85
|
+
_use_xhr_preload = _use_preload && opts.xhr,
|
86
|
+
_auto_wait = opts.preserve,
|
87
|
+
_which = opts.which,
|
88
|
+
_base_path = opts.base,
|
89
|
+
waitFunc = fNOOP,
|
90
|
+
scripts_loading = bFALSE,
|
91
|
+
publicAPI,
|
92
|
+
first_pass = bTRUE,
|
93
|
+
scripts = {},
|
94
|
+
exec = [],
|
95
|
+
end_of_chain_check_interval = null
|
96
|
+
;
|
97
|
+
|
98
|
+
_use_preload = _use_cache_preload || _use_xhr_preload || _use_script_order; // if all flags are turned off, preload is moot so disable it
|
99
|
+
|
100
|
+
function isScriptLoaded(elem,scriptentry) {
|
101
|
+
if ((elem[sREADYSTATE] && elem[sREADYSTATE]!==sCOMPLETE && elem[sREADYSTATE]!=="loaded") || scriptentry[sDONE]) { return bFALSE; }
|
102
|
+
elem[sONLOAD] = elem[sONREADYSTATECHANGE] = nNULL; // prevent memory leak
|
103
|
+
return bTRUE;
|
104
|
+
}
|
105
|
+
function handleScriptLoad(elem,scriptentry,skipReadyCheck) {
|
106
|
+
skipReadyCheck = !(!skipReadyCheck); // used to override ready check when script text was injected from XHR preload
|
107
|
+
if (!skipReadyCheck && !(isScriptLoaded(elem,scriptentry))) return;
|
108
|
+
scriptentry[sDONE] = bTRUE;
|
109
|
+
|
110
|
+
for (var key in scripts) {
|
111
|
+
if (scripts[sHASOWNPROPERTY](key) && !(scripts[key][sDONE])) return;
|
112
|
+
}
|
113
|
+
ready = bTRUE;
|
114
|
+
waitFunc();
|
115
|
+
}
|
116
|
+
function loadTriggerExecute(scriptentry) {
|
117
|
+
if (isFunc(scriptentry[sLOADTRIGGER])) {
|
118
|
+
scriptentry[sLOADTRIGGER]();
|
119
|
+
scriptentry[sLOADTRIGGER] = nNULL; // prevent memory leak
|
120
|
+
}
|
121
|
+
}
|
122
|
+
function handleScriptPreload(elem,scriptentry) {
|
123
|
+
if (!isScriptLoaded(elem,scriptentry)) return;
|
124
|
+
scriptentry[sPRELOADDONE] = bTRUE;
|
125
|
+
fSETTIMEOUT(function(){
|
126
|
+
append_to[scriptentry[sWHICH]][0].removeChild(elem); // remove preload script node
|
127
|
+
loadTriggerExecute(scriptentry);
|
128
|
+
},0);
|
129
|
+
}
|
130
|
+
function handleXHRPreload(xhr,scriptentry) {
|
131
|
+
if (xhr[sREADYSTATE] === 4) {
|
132
|
+
xhr[sONREADYSTATECHANGE] = fNOOP; // fix a memory leak in IE
|
133
|
+
scriptentry[sPRELOADDONE] = bTRUE;
|
134
|
+
fSETTIMEOUT(function(){ loadTriggerExecute(scriptentry); },0);
|
135
|
+
}
|
136
|
+
}
|
137
|
+
function createScriptTag(scriptentry,src,type,charset,rel,onload,scriptText) {
|
138
|
+
fSETTIMEOUT(function(){
|
139
|
+
if (append_to[scriptentry[sWHICH]][0] === nNULL) { // append_to object not yet ready
|
140
|
+
fSETTIMEOUT(arguments.callee,25);
|
141
|
+
return;
|
142
|
+
}
|
143
|
+
var scriptElem = oDOC.createElement(sSCRIPT), fSETATTRIBUTE = function(attr,val){scriptElem.setAttribute(attr,val);};
|
144
|
+
fSETATTRIBUTE("type",type);
|
145
|
+
fSETATTRIBUTE("rel",rel);
|
146
|
+
if (typeof charset === sSTRING) fSETATTRIBUTE("charset",charset);
|
147
|
+
if (isFunc(onload)) { // load script via 'src' attribute, set onload/onreadystatechange listeners
|
148
|
+
scriptElem[sONLOAD] = scriptElem[sONREADYSTATECHANGE] = function(){onload(scriptElem,scriptentry);};
|
149
|
+
fSETATTRIBUTE("src",src);
|
150
|
+
}
|
151
|
+
append_to[scriptentry[sWHICH]][0].appendChild(scriptElem);
|
152
|
+
if (typeof scriptText === sSTRING) { // script text already avaiable from XHR preload, so just inject it
|
153
|
+
scriptElem.text = scriptText;
|
154
|
+
handleScriptLoad(scriptElem,scriptentry,bTRUE); // manually call 'load' callback function, skipReadyCheck=true
|
155
|
+
}
|
156
|
+
},0);
|
157
|
+
}
|
158
|
+
function loadScriptElem(scriptentry,src,type,charset) {
|
159
|
+
all_scripts[scriptentry[sSRCURI]] = bTRUE;
|
160
|
+
createScriptTag(scriptentry,src,type,charset,"",handleScriptLoad);
|
161
|
+
}
|
162
|
+
function loadScriptCache(scriptentry,src,type,charset) {
|
163
|
+
var args = arguments;
|
164
|
+
if (first_pass && scriptentry[sPRELOADDONE] == nNULL) { // need to preload into cache
|
165
|
+
scriptentry[sPRELOADDONE] = bFALSE;
|
166
|
+
createScriptTag(scriptentry,src,"text/html",charset,sPRELOAD,handleScriptPreload); // "text/html" causes a fetch into cache, but no execution
|
167
|
+
}
|
168
|
+
else if (!first_pass && scriptentry[sPRELOADDONE] != nNULL && !scriptentry[sPRELOADDONE]) { // preload still in progress, make sure trigger is set for execution later
|
169
|
+
scriptentry[sLOADTRIGGER] = function(){loadScriptCache.apply(nNULL,args);};
|
170
|
+
}
|
171
|
+
else if (!first_pass) { // preload done, so reload (from cache, hopefully!) as regular script element
|
172
|
+
loadScriptElem.apply(nNULL,args);
|
173
|
+
}
|
174
|
+
}
|
175
|
+
function loadScriptXHR(scriptentry,src,type,charset) {
|
176
|
+
var args = arguments, xhr;
|
177
|
+
if (first_pass && scriptentry[sPRELOADDONE] == nNULL) { // need to preload
|
178
|
+
scriptentry[sPRELOADDONE] = bFALSE;
|
179
|
+
xhr = scriptentry.xhr = (oACTIVEX ? new oACTIVEX("Microsoft.XMLHTTP") : new global.XMLHttpRequest());
|
180
|
+
xhr[sONREADYSTATECHANGE] = function(){handleXHRPreload(xhr,scriptentry);};
|
181
|
+
xhr.open("GET",src);
|
182
|
+
xhr.send("");
|
183
|
+
}
|
184
|
+
else if (!first_pass && scriptentry[sPRELOADDONE] != nNULL && !scriptentry[sPRELOADDONE]) { // preload XHR still in progress, make sure trigger is set for execution later
|
185
|
+
scriptentry[sLOADTRIGGER] = function(){loadScriptXHR.apply(nNULL,args);};
|
186
|
+
}
|
187
|
+
else if (!first_pass) { // preload done, so "execute" script via injection
|
188
|
+
all_scripts[scriptentry[sSRCURI]] = bTRUE;
|
189
|
+
createScriptTag(scriptentry,src,type,charset,"",nNULL,scriptentry.xhr.responseText);
|
190
|
+
scriptentry.xhr = nNULL;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
function loadScript(o) {
|
194
|
+
if (o.allowDup == nNULL) o.allowDup = opts.dupe;
|
195
|
+
var src = o.src, type = o.type, charset = o.charset, allowDup = o.allowDup,
|
196
|
+
src_uri = canonicalScriptURI(src,_base_path), scriptentry, same_domain = sameDomain(src_uri);
|
197
|
+
if (typeof type !== sSTRING) type = "text/javascript";
|
198
|
+
if (typeof charset !== sSTRING) charset = nNULL;
|
199
|
+
allowDup = !(!allowDup);
|
200
|
+
if (!allowDup &&
|
201
|
+
(
|
202
|
+
(all_scripts[src_uri] != nNULL) || (first_pass && scripts[src_uri]) || scriptTagExists(src_uri)
|
203
|
+
)
|
204
|
+
) {
|
205
|
+
if (scripts[src_uri] != nNULL && scripts[src_uri][sPRELOADDONE] && !scripts[src_uri][sDONE] && same_domain) {
|
206
|
+
// this script was preloaded via XHR, but is a duplicate, and dupes are not allowed
|
207
|
+
handleScriptLoad(nNULL,scripts[src_uri],bTRUE); // mark the entry as done and check if chain group is done
|
208
|
+
}
|
209
|
+
return;
|
210
|
+
}
|
211
|
+
if (scripts[src_uri] == nNULL) scripts[src_uri] = {};
|
212
|
+
scriptentry = scripts[src_uri];
|
213
|
+
if (scriptentry[sWHICH] == nNULL) scriptentry[sWHICH] = _which;
|
214
|
+
scriptentry[sDONE] = bFALSE;
|
215
|
+
scriptentry[sSRCURI] = src_uri;
|
216
|
+
scripts_loading = bTRUE;
|
217
|
+
|
218
|
+
if (!_use_script_order && _use_xhr_preload && same_domain) loadScriptXHR(scriptentry,src_uri,type,charset);
|
219
|
+
else if (!_use_script_order && _use_cache_preload) loadScriptCache(scriptentry,src_uri,type,charset);
|
220
|
+
else loadScriptElem(scriptentry,src_uri,type,charset);
|
221
|
+
}
|
222
|
+
function onlyQueue(execBody) {
|
223
|
+
exec.push(execBody);
|
224
|
+
}
|
225
|
+
function queueAndExecute(execBody) { // helper for publicAPI functions below
|
226
|
+
if (queueExec && !_use_script_order) onlyQueue(execBody);
|
227
|
+
if (!queueExec || _use_preload) execBody(); // if engine is either not queueing, or is queuing in preload mode, go ahead and execute
|
228
|
+
}
|
229
|
+
function serializeArgs(args) {
|
230
|
+
var sargs = [], i;
|
231
|
+
for (i=0; i<args.length; i++) {
|
232
|
+
if (fOBJTOSTRING.call(args[i]) === "[object Array]") sargs = sargs.concat(serializeArgs(args[i]));
|
233
|
+
else sargs[sargs.length] = args[i];
|
234
|
+
}
|
235
|
+
return sargs;
|
236
|
+
}
|
237
|
+
|
238
|
+
publicAPI = {
|
239
|
+
script:function() {
|
240
|
+
fCLEARTIMEOUT(end_of_chain_check_interval);
|
241
|
+
var args = serializeArgs(arguments), use_engine = publicAPI;
|
242
|
+
if (_auto_wait) {
|
243
|
+
for (var i=0; i<args.length; i++) {
|
244
|
+
if (i===0) {
|
245
|
+
queueAndExecute(function(){
|
246
|
+
loadScript((typeof args[0] === sSTRING) ? {src:args[0]} : args[0]);
|
247
|
+
});
|
248
|
+
}
|
249
|
+
else use_engine = use_engine.script(args[i]);
|
250
|
+
use_engine = use_engine.wait();
|
251
|
+
}
|
252
|
+
}
|
253
|
+
else {
|
254
|
+
queueAndExecute(function(){
|
255
|
+
for (var i=0; i<args.length; i++) {
|
256
|
+
loadScript((typeof args[i] === sSTRING) ? {src:args[i]} : args[i]);
|
257
|
+
}
|
258
|
+
});
|
259
|
+
}
|
260
|
+
end_of_chain_check_interval = fSETTIMEOUT(function(){first_pass = bFALSE;},5); // hack to "detect" the end of the chain if a wait() is not the last call
|
261
|
+
return use_engine;
|
262
|
+
},
|
263
|
+
wait:function(func) {
|
264
|
+
fCLEARTIMEOUT(end_of_chain_check_interval);
|
265
|
+
first_pass = bFALSE;
|
266
|
+
if (!isFunc(func)) func = fNOOP;
|
267
|
+
// On this current chain's waitFunc function, tack on call to trigger the queue for the *next* engine
|
268
|
+
// in the chain, which will be executed when the current chain finishes loading
|
269
|
+
var e = engine(bTRUE,opts), // 'bTRUE' tells the engine to be in queueing mode
|
270
|
+
triggerNextChain = e.trigger, // store ref to e's trigger function for use by 'wfunc'
|
271
|
+
wfunc = function(){ try { func(); } catch(err) {} triggerNextChain(); };
|
272
|
+
delete e.trigger; // remove the 'trigger' property from e's public API, since only used internally
|
273
|
+
var fn = function(){
|
274
|
+
if (scripts_loading && !ready) waitFunc = wfunc;
|
275
|
+
else fSETTIMEOUT(wfunc,0);
|
276
|
+
};
|
277
|
+
|
278
|
+
if (queueExec && !scripts_loading) onlyQueue(fn);
|
279
|
+
else queueAndExecute(fn);
|
280
|
+
return e;
|
281
|
+
}
|
282
|
+
};
|
283
|
+
publicAPI.block = publicAPI.wait; // alias "block" to "wait" -- "block" is now deprecated
|
284
|
+
if (queueExec) {
|
285
|
+
// if queueing, return a function that the previous chain's waitFunc function can use to trigger this
|
286
|
+
// engine's queue. NOTE: this trigger function is captured and removed from the public chain API before return
|
287
|
+
publicAPI.trigger = function() {
|
288
|
+
var i=0, fn;
|
289
|
+
while (fn = exec[i++]) fn();
|
290
|
+
exec = [];
|
291
|
+
};
|
292
|
+
}
|
293
|
+
return publicAPI;
|
294
|
+
}
|
295
|
+
function processOpts(opts) {
|
296
|
+
var k, newOpts = {},
|
297
|
+
boolOpts = {"UseCachePreload":"cache","UseLocalXHR":"xhr","UsePreloading":sPRELOAD,"AlwaysPreserveOrder":"preserve","AllowDuplicates":"dupe"},
|
298
|
+
allOpts = {"AppendTo":"which","BasePath":"base"}
|
299
|
+
;
|
300
|
+
for (k in boolOpts) allOpts[k] = boolOpts[k];
|
301
|
+
newOpts.order = !(!global_defs.order);
|
302
|
+
for (k in allOpts) {
|
303
|
+
if (allOpts[sHASOWNPROPERTY](k) && global_defs[allOpts[k]] != nNULL) newOpts[allOpts[k]] = (opts[k] != nNULL) ? opts[k] : global_defs[allOpts[k]];
|
304
|
+
}
|
305
|
+
for (k in boolOpts) { // normalize bool props to actual boolean values if not already
|
306
|
+
if (boolOpts[sHASOWNPROPERTY](k)) newOpts[boolOpts[k]] = !(!newOpts[boolOpts[k]]);
|
307
|
+
}
|
308
|
+
if (!newOpts[sPRELOAD]) newOpts.cache = newOpts.order = newOpts.xhr = bFALSE; // turn off all flags if preloading is disabled
|
309
|
+
newOpts.which = (newOpts.which === sHEAD || newOpts.which === sBODY) ? newOpts.which : sHEAD;
|
310
|
+
return newOpts;
|
311
|
+
}
|
312
|
+
|
313
|
+
global.$LAB = {
|
314
|
+
setGlobalDefaults:function(gdefs) { // intentionally does not return an "engine" instance -- must call as stand-alone function call on $LAB
|
315
|
+
global_defs = processOpts(gdefs);
|
316
|
+
},
|
317
|
+
setOptions:function(opts){ // set options per chain
|
318
|
+
return engine(bFALSE,processOpts(opts));
|
319
|
+
},
|
320
|
+
script:function(){ // will load one or more scripts
|
321
|
+
return engine().script.apply(nNULL,arguments);
|
322
|
+
},
|
323
|
+
wait:function(){ // will ensure that the chain's previous scripts are executed before execution of scripts in subsequent chain links
|
324
|
+
return engine().wait.apply(nNULL,arguments);
|
325
|
+
}
|
326
|
+
};
|
327
|
+
global.$LAB.block = global.$LAB.wait; // alias "block" to "wait" -- "block" is now deprecated
|
328
|
+
|
329
|
+
/* The following "hack" was suggested by Andrea Giammarchi and adapted from: http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html
|
330
|
+
NOTE: this hack only operates in FF and then only in versions where document.readyState is not present (FF < 3.6?).
|
331
|
+
|
332
|
+
The hack essentially "patches" the **page** that LABjs is loaded onto so that it has a proper conforming document.readyState, so that if a script which does
|
333
|
+
proper and safe dom-ready detection is loaded onto a page, after dom-ready has passed, it will still be able to detect this state, by inspecting the now hacked
|
334
|
+
document.readyState property. The loaded script in question can then immediately trigger any queued code executions that were waiting for the DOM to be ready.
|
335
|
+
For instance, jQuery > 1.3.2 has been patched to take advantage of document.readyState, which is enabled by this hack. But 1.3.2 and before are **not** safe or
|
336
|
+
affected by this hack, and should therefore **not** be lazy-loaded by script loader tools such as LABjs.
|
337
|
+
*/
|
338
|
+
(function(addEvent,domLoaded,handler){
|
339
|
+
if (oDOC[sREADYSTATE] == nNULL && oDOC[addEvent]){
|
340
|
+
oDOC[sREADYSTATE] = "loading";
|
341
|
+
oDOC[addEvent](domLoaded,handler = function(){
|
342
|
+
oDOC.removeEventListener(domLoaded,handler,bFALSE);
|
343
|
+
oDOC[sREADYSTATE] = sCOMPLETE;
|
344
|
+
},bFALSE);
|
345
|
+
}
|
346
|
+
})("addEventListener","DOMContentLoaded");
|
347
|
+
|
348
|
+
})(window);
|