These were git submodules, but no time to fix that, so just adding.
This commit is contained in:
parent
287cc246db
commit
c0c79362ae
255 changed files with 37187 additions and 0 deletions
2
lib/js/extra/classList.js/LICENSE.md
Normal file
2
lib/js/extra/classList.js/LICENSE.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
This software is dedicated to the public domain. No warranty is expressed or implied.
|
||||
Use this software at your own risk.
|
7
lib/js/extra/classList.js/README.md
Normal file
7
lib/js/extra/classList.js/README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
classList.js is a cross-browser JavaScript shim that fully implements `element.classList`. Refer to [the MDN page on `element.classList`][1] for more information.
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
[1]: https://developer.mozilla.org/en/DOM/element.classList "MDN / DOM / element.classList"
|
138
lib/js/extra/classList.js/classList.js
Normal file
138
lib/js/extra/classList.js/classList.js
Normal file
|
@ -0,0 +1,138 @@
|
|||
|
||||
/*
|
||||
* classList.js: Cross-browser full element.classList implementation.
|
||||
* 2011-06-15
|
||||
*
|
||||
* By Eli Grey, http://eligrey.com
|
||||
* Public Domain.
|
||||
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
||||
*/
|
||||
|
||||
/*global self, document, DOMException */
|
||||
|
||||
/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js*/
|
||||
|
||||
if (typeof document !== "undefined" && !("classList" in document.createElement("a"))) {
|
||||
|
||||
(function (view) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var
|
||||
classListProp = "classList"
|
||||
, protoProp = "prototype"
|
||||
, elemCtrProto = (view.HTMLElement || view.Element)[protoProp]
|
||||
, objCtr = Object
|
||||
, strTrim = String[protoProp].trim || function () {
|
||||
return this.replace(/^\s+|\s+$/g, "");
|
||||
}
|
||||
, arrIndexOf = Array[protoProp].indexOf || function (item) {
|
||||
var
|
||||
i = 0
|
||||
, len = this.length
|
||||
;
|
||||
for (; i < len; i++) {
|
||||
if (i in this && this[i] === item) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
// Vendors: please allow content code to instantiate DOMExceptions
|
||||
, DOMEx = function (type, message) {
|
||||
this.name = type;
|
||||
this.code = DOMException[type];
|
||||
this.message = message;
|
||||
}
|
||||
, checkTokenAndGetIndex = function (classList, token) {
|
||||
if (token === "") {
|
||||
throw new DOMEx(
|
||||
"SYNTAX_ERR"
|
||||
, "An invalid or illegal string was specified"
|
||||
);
|
||||
}
|
||||
if (/\s/.test(token)) {
|
||||
throw new DOMEx(
|
||||
"INVALID_CHARACTER_ERR"
|
||||
, "String contains an invalid character"
|
||||
);
|
||||
}
|
||||
return arrIndexOf.call(classList, token);
|
||||
}
|
||||
, ClassList = function (elem) {
|
||||
var
|
||||
trimmedClasses = strTrim.call(elem.className)
|
||||
, classes = trimmedClasses ? trimmedClasses.split(/\s+/) : []
|
||||
, i = 0
|
||||
, len = classes.length
|
||||
;
|
||||
for (; i < len; i++) {
|
||||
this.push(classes[i]);
|
||||
}
|
||||
this._updateClassName = function () {
|
||||
elem.className = this.toString();
|
||||
};
|
||||
}
|
||||
, classListProto = ClassList[protoProp] = []
|
||||
, classListGetter = function () {
|
||||
return new ClassList(this);
|
||||
}
|
||||
;
|
||||
// Most DOMException implementations don't allow calling DOMException's toString()
|
||||
// on non-DOMExceptions. Error's toString() is sufficient here.
|
||||
DOMEx[protoProp] = Error[protoProp];
|
||||
classListProto.item = function (i) {
|
||||
return this[i] || null;
|
||||
};
|
||||
classListProto.contains = function (token) {
|
||||
token += "";
|
||||
return checkTokenAndGetIndex(this, token) !== -1;
|
||||
};
|
||||
classListProto.add = function (token) {
|
||||
token += "";
|
||||
if (checkTokenAndGetIndex(this, token) === -1) {
|
||||
this.push(token);
|
||||
this._updateClassName();
|
||||
}
|
||||
};
|
||||
classListProto.remove = function (token) {
|
||||
token += "";
|
||||
var index = checkTokenAndGetIndex(this, token);
|
||||
if (index !== -1) {
|
||||
this.splice(index, 1);
|
||||
this._updateClassName();
|
||||
}
|
||||
};
|
||||
classListProto.toggle = function (token) {
|
||||
token += "";
|
||||
if (checkTokenAndGetIndex(this, token) === -1) {
|
||||
this.add(token);
|
||||
} else {
|
||||
this.remove(token);
|
||||
}
|
||||
};
|
||||
classListProto.toString = function () {
|
||||
return this.join(" ");
|
||||
};
|
||||
|
||||
if (objCtr.defineProperty) {
|
||||
var classListPropDesc = {
|
||||
get: classListGetter
|
||||
, enumerable: true
|
||||
, configurable: true
|
||||
};
|
||||
try {
|
||||
objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
|
||||
} catch (ex) { // IE 8 doesn't support enumerable:true
|
||||
if (ex.number === -0x7FF5EC54) {
|
||||
classListPropDesc.enumerable = false;
|
||||
objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
|
||||
}
|
||||
}
|
||||
} else if (objCtr[protoProp].__defineGetter__) {
|
||||
elemCtrProto.__defineGetter__(classListProp, classListGetter);
|
||||
}
|
||||
|
||||
}(self));
|
||||
|
||||
}
|
2
lib/js/extra/classList.js/classList.min.js
vendored
Normal file
2
lib/js/extra/classList.js/classList.min.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js*/
|
||||
if(typeof document!=="undefined"&&!("classList" in document.createElement("a"))){(function(j){var a="classList",f="prototype",m=(j.HTMLElement||j.Element)[f],b=Object,k=String[f].trim||function(){return this.replace(/^\s+|\s+$/g,"")},c=Array[f].indexOf||function(q){var p=0,o=this.length;for(;p<o;p++){if(p in this&&this[p]===q){return p}}return -1},n=function(o,p){this.name=o;this.code=DOMException[o];this.message=p},g=function(p,o){if(o===""){throw new n("SYNTAX_ERR","An invalid or illegal string was specified")}if(/\s/.test(o)){throw new n("INVALID_CHARACTER_ERR","String contains an invalid character")}return c.call(p,o)},d=function(s){var r=k.call(s.className),q=r?r.split(/\s+/):[],p=0,o=q.length;for(;p<o;p++){this.push(q[p])}this._updateClassName=function(){s.className=this.toString()}},e=d[f]=[],i=function(){return new d(this)};n[f]=Error[f];e.item=function(o){return this[o]||null};e.contains=function(o){o+="";return g(this,o)!==-1};e.add=function(o){o+="";if(g(this,o)===-1){this.push(o);this._updateClassName()}};e.remove=function(p){p+="";var o=g(this,p);if(o!==-1){this.splice(o,1);this._updateClassName()}};e.toggle=function(o){o+="";if(g(this,o)===-1){this.add(o)}else{this.remove(o)}};e.toString=function(){return this.join(" ")};if(b.defineProperty){var l={get:i,enumerable:true,configurable:true};try{b.defineProperty(m,a,l)}catch(h){if(h.number===-2146823252){l.enumerable=false;b.defineProperty(m,a,l)}}}else{if(b[f].__defineGetter__){m.__defineGetter__(a,i)}}}(self))};
|
63
lib/js/extra/headjs/.gitattributes
vendored
Normal file
63
lib/js/extra/headjs/.gitattributes
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
9
lib/js/extra/headjs/.gitignore
vendored
Normal file
9
lib/js/extra/headjs/.gitignore
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
# git ignore file
|
||||
.idea/
|
||||
_site/
|
||||
*.sln
|
||||
*.suo
|
||||
*.config
|
||||
*.bundle
|
||||
sauce_connect.*
|
||||
node_modules/
|
88
lib/js/extra/headjs/.jshintrc
Normal file
88
lib/js/extra/headjs/.jshintrc
Normal file
|
@ -0,0 +1,88 @@
|
|||
{
|
||||
// JSHint Configuration File for HeadJS
|
||||
// See http://jshint.com/docs/ for more details
|
||||
// See http://jslinterrors.com/ for error information
|
||||
// If you have suggestions for these settings, please leave a comment on GitHub
|
||||
|
||||
"maxerr" : 50, // {int} Maximum error before stopping
|
||||
|
||||
// Enforcing
|
||||
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
|
||||
"camelcase" : true, // true: Identifiers must be in camelCase
|
||||
"curly" : true, // true: Require {} for every new block or scope
|
||||
"eqeqeq" : true, // true: Require triple equals (===) for comparison
|
||||
"forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
|
||||
"immed" : true, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
|
||||
"indent" : 4, // {int} Number of spaces to use for indentation
|
||||
"latedef" : true, // true: Require variables/functions to be defined before being used
|
||||
"newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()`
|
||||
"noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
|
||||
"noempty" : false, // true: Prohibit use of empty blocks
|
||||
"nonew" : true, // true: Prohibit use of constructors for side-effects (without assignment)
|
||||
"plusplus" : false, // true: Prohibit use of `++` & `--`
|
||||
"quotmark" : true, // Quotation mark consistency:
|
||||
// false : do nothing (default)
|
||||
// true : ensure whatever is used is consistent
|
||||
// "single" : require single quotes
|
||||
// "double" : require double quotes
|
||||
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
|
||||
"unused" : true, // true: Require all defined variables be used
|
||||
"strict" : true, // true: Requires all functions run in ES5 Strict Mode
|
||||
"trailing" : true, // true: Prohibit trailing whitespaces
|
||||
"maxparams" : false, // {int} Max number of formal params allowed per function
|
||||
"maxdepth" : false, // {int} Max depth of nested blocks (within functions)
|
||||
"maxstatements" : false, // {int} Max number statements per function
|
||||
"maxcomplexity" : false, // {int} Max cyclomatic complexity per function
|
||||
"maxlen" : false, // {int} Max number of characters per line
|
||||
|
||||
// Relaxing
|
||||
"asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
|
||||
"boss" : false, // true: Tolerate assignments where comparisons would be expected
|
||||
"debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
|
||||
"eqnull" : false, // true: Tolerate use of `== null`
|
||||
"es5" : false, // true: Allow ES5 syntax (ex: getters and setters)
|
||||
"esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`)
|
||||
"moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
|
||||
// (ex: `for each`, multiple try/catch, function expression…)
|
||||
"evil" : false, // true: Tolerate use of `eval` and `new Function()`
|
||||
"expr" : false, // true: Tolerate `ExpressionStatement` as Programs
|
||||
"funcscope" : false, // true: Tolerate defining variables inside control statements"
|
||||
"globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
|
||||
"iterator" : false, // true: Tolerate using the `__iterator__` property
|
||||
"lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
|
||||
"laxbreak" : false, // true: Tolerate possibly unsafe line breakings
|
||||
"laxcomma" : true, // true: Tolerate comma-first style coding
|
||||
"loopfunc" : false, // true: Tolerate functions being defined in loops
|
||||
"multistr" : false, // true: Tolerate multi-line strings
|
||||
"proto" : false, // true: Tolerate using the `__proto__` property
|
||||
"scripturl" : false, // true: Tolerate script-targeted URLs
|
||||
"smarttabs" : true, // true: Tolerate mixed tabs/spaces when used for alignment
|
||||
"shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
|
||||
"sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
|
||||
"supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
|
||||
"validthis" : false, // true: Tolerate using this in a non-constructor function
|
||||
|
||||
// Environments
|
||||
"browser" : true, // Web Browser (window, document, etc)
|
||||
"couch" : false, // CouchDB
|
||||
"devel" : true, // Development/debugging (alert, confirm, etc)
|
||||
"dojo" : false, // Dojo Toolkit
|
||||
"jquery" : false, // jQuery
|
||||
"mootools" : false, // MooTools
|
||||
"node" : false, // Node.js
|
||||
"nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
|
||||
"prototypejs" : false, // Prototype and Scriptaculous
|
||||
"rhino" : false, // Rhino
|
||||
"worker" : false, // Web Workers
|
||||
"wsh" : false, // Windows Scripting Host
|
||||
"yui" : false, // Yahoo User Interface
|
||||
|
||||
// Legacy
|
||||
"nomen" : false, // true: Prohibit dangling `_` in variables
|
||||
"onevar" : false, // true: Allow only one `var` statement per function
|
||||
"passfail" : false, // true: Stop on first error
|
||||
"white" : false, // true: Check against strict whitespace and indentation rules
|
||||
|
||||
// Custom Globals
|
||||
"globals" : {} // additional predefined global variables
|
||||
}
|
29
lib/js/extra/headjs/.travis.yml
Normal file
29
lib/js/extra/headjs/.travis.yml
Normal file
|
@ -0,0 +1,29 @@
|
|||
# define language used
|
||||
language: node_js
|
||||
|
||||
# configure node version
|
||||
node_js:
|
||||
- "0.11"
|
||||
|
||||
# http://about.travis-ci.org/docs/user/build-configuration/#Build-Lifecycle
|
||||
# install dependencies
|
||||
before_script:
|
||||
- npm install -g grunt-cli
|
||||
- npm install grunt grunt-contrib-qunit
|
||||
|
||||
# run
|
||||
script: grunt test -v -d
|
||||
|
||||
|
||||
# Run tests using Travis CI and Sauce Labs
|
||||
# https://saucelabs.com/opensource/travis
|
||||
#
|
||||
# Secure environment variables
|
||||
# http://about.travis-ci.org/docs/user/build-configuration/#Secure-environment-variables
|
||||
#
|
||||
# Extra links
|
||||
# https://github.com/axemclion/grunt-saucelabs
|
||||
env:
|
||||
global:
|
||||
- secure: "i8xVOci13yViGd+vqpiM0P2kL4qayAOOd80jmlOOKHu7tCMEF6EvkJBOwALVx+LDRFnyg/4iP0drQSMYztiF5ZTnEcbh+EknltKAA3ygI/d2RUDhB7Cn7Knu3baqE1By3BXHbVlhOZ0zTZUbwrGcnzxnBHec5mvISw9Y1dIaz94="
|
||||
- secure: "M7lJ0WoAcSACTUJGHRuTcUzGrvo806mJ5UCJ3MjttL4DPz+kxeO2zLPCLff12zmv1x97lRjKtY7zJJei8ZkGgEQfLLlz5I3Hg7yJ2dSqTxGiKpr7vlipDZq6+ZPpHo3kElsGIy5ue/rVKNS/8l8I5zYRdNpWkwztLJvj6nHfxIo="
|
19
lib/js/extra/headjs/404.html
Normal file
19
lib/js/extra/headjs/404.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
layout: main
|
||||
---
|
||||
<div class="intro">
|
||||
Stop breaking things !
|
||||
</div>
|
||||
|
||||
<div class="group">
|
||||
<div class="float-l" style="font-size: 150px">404</div>
|
||||
<img class="float-l" src="/site/assets/img/404.jpg" title="by ~Lain-Luscious-Fanart" alt="not found" style="max-width: 100%"/>
|
||||
</div>
|
||||
|
||||
<br /><br />
|
||||
<div class="intro">
|
||||
<strong>Make it the only script in your HEAD.</strong>
|
||||
« A concise solution to universal problems »
|
||||
</div>
|
||||
|
||||
{% include sections/download.html %}
|
1
lib/js/extra/headjs/CNAME
Normal file
1
lib/js/extra/headjs/CNAME
Normal file
|
@ -0,0 +1 @@
|
|||
headjs.com
|
121
lib/js/extra/headjs/Gruntfile.js
Normal file
121
lib/js/extra/headjs/Gruntfile.js
Normal file
|
@ -0,0 +1,121 @@
|
|||
module.exports = function (grunt) {
|
||||
//#region Saucelabs Browsers
|
||||
// https://saucelabs.com/docs/platforms
|
||||
var browsers = [
|
||||
// sauce says ff25 is availiable, but times out systematically...
|
||||
{
|
||||
browserName: "firefox",
|
||||
platform : "Windows 8",
|
||||
version : "22"
|
||||
},
|
||||
{
|
||||
browserName : "iphone",
|
||||
platform : "OS X 10.8",
|
||||
version : "6.1",
|
||||
"device-orientation": "portrait"
|
||||
},
|
||||
{
|
||||
browserName : "ipad",
|
||||
platform : "OS X 10.8",
|
||||
version : "6.1",
|
||||
"device-orientation": "portrait"
|
||||
},
|
||||
{
|
||||
browserName : "android",
|
||||
platform : "Linux",
|
||||
version : "4.0",
|
||||
"device-orientation": "portrait"
|
||||
},
|
||||
{
|
||||
browserName: "safari",
|
||||
platform: "OS X 10.6",
|
||||
version: "5"
|
||||
},
|
||||
{
|
||||
browserName: "safari",
|
||||
platform : "OS X 10.8",
|
||||
version : "6"
|
||||
},
|
||||
{
|
||||
browserName: "chrome",
|
||||
platform : "Windows 7",
|
||||
version : "31"
|
||||
},
|
||||
{
|
||||
browserName: "internet explorer",
|
||||
platform : "Windows XP",
|
||||
version : "7"
|
||||
},
|
||||
{
|
||||
browserName: "internet explorer",
|
||||
platform : "Windows XP",
|
||||
version : "8"
|
||||
},
|
||||
{
|
||||
browserName: "internet explorer",
|
||||
platform : "Windows 7",
|
||||
version : "9"
|
||||
},
|
||||
{
|
||||
browserName: "internet explorer",
|
||||
platform : "Windows 8",
|
||||
version : "10"
|
||||
},
|
||||
{
|
||||
browserName: "internet explorer",
|
||||
platform : "Windows 8.1",
|
||||
version : "11"
|
||||
}
|
||||
];
|
||||
//#endregion
|
||||
|
||||
// Project configuration
|
||||
grunt.initConfig({
|
||||
//#region Saucelabs
|
||||
connect: {
|
||||
server: {
|
||||
options: {
|
||||
base: "",
|
||||
port: 9999
|
||||
}
|
||||
}
|
||||
},
|
||||
"saucelabs-qunit": {
|
||||
all: {
|
||||
options: {
|
||||
urls : ["http://127.0.0.1:9999/test/unit/1.0.0/index.html"],
|
||||
tunnelTimeout: 10,
|
||||
build : process.env.TRAVIS_JOB_ID,
|
||||
concurrency : 3,
|
||||
browsers : browsers,
|
||||
testname : "qunit tests",
|
||||
tags : ["master"]
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
//#endregion
|
||||
|
||||
// load package information ..use later for building via grunt...
|
||||
//pkg: grunt.file.readJSON("package.json"),
|
||||
|
||||
// task: local unit tests
|
||||
qunit: {
|
||||
files: ['test/unit/1.0.0/index.html']
|
||||
}
|
||||
});
|
||||
|
||||
// Loading dependencies
|
||||
for (var key in grunt.file.readJSON("package.json").devDependencies) {
|
||||
if (key !== "grunt" && key.indexOf("grunt") === 0) {
|
||||
grunt.loadNpmTasks(key);
|
||||
}
|
||||
}
|
||||
|
||||
// register: local unit tests
|
||||
grunt.registerTask("qtest", "qunit");
|
||||
|
||||
// register sauce tasks
|
||||
grunt.registerTask("dev" , ["connect", "watch"]);
|
||||
grunt.registerTask("test", ["connect", "saucelabs-qunit"]);
|
||||
};
|
21
lib/js/extra/headjs/LICENSE
Normal file
21
lib/js/extra/headjs/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2013
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
30
lib/js/extra/headjs/README.md
Normal file
30
lib/js/extra/headjs/README.md
Normal file
|
@ -0,0 +1,30 @@
|
|||
### This project is no longer maintained, but was the only solution back in the day, to do responsive design with IE6 & co ^^
|
||||
|
||||
### Latest Version: v1.0.3 :: [Docs](https://headjs.github.io) | [Downloads](https://headjs.github.io/#download)
|
||||
|
||||
### Responsive Design, Feature Detections, and Resource Loading
|
||||
* Speed up your apps: Load JS & CSS asyncronously and in parallel, but execute them in order
|
||||
* Load one asset if a condition is met, else fallback and load a different one
|
||||
* Manage script dependencies, and execute callbacks once they are loaded
|
||||
* Cross-browser compatible « pseudo media-queries » let you code against different resolutions & devices
|
||||
* Fix quirks in specific browsers by quickly applying dedicated CSS/JS logic
|
||||
* Detect various browsers & their versions
|
||||
* Check if the client supports a certain Browser, HTML5, or CSS3 feature
|
||||
* Automatically generates JS and CSS classes for browsers & features that where detected
|
||||
* Automatically generates CSS classes, to know what page or section a user is viewing
|
||||
* Know if the user is in landscape or portrait mode
|
||||
* Or whether the client is using a mobile or desktop device
|
||||
* Get old browsers to support HTML5 elements like nav, sidebar, header, footer, ...
|
||||
* ...
|
||||
* __Make it, The only script in your <HEAD>__
|
||||
* ___A concise solution to universal problems___
|
||||
|
||||
|
||||
###Resources
|
||||
- __WebSite__
|
||||
- [https://headjs.github.io/](https://headjs.github.io/)
|
||||
- __Bugs__
|
||||
- [https://github.com/headjs/headjs/issues](https://github.com/headjs/headjs/issues)
|
||||
- __Community Support__
|
||||
- [http://stackoverflow.com](http://stackoverflow.com/questions/tagged/head.js)
|
||||
- _Remember to tag your questions with_: ___head.js___
|
12
lib/js/extra/headjs/_config.yml
Normal file
12
lib/js/extra/headjs/_config.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
# GitHub Defaults
|
||||
lsi: false
|
||||
pygments: true
|
||||
safe: true
|
||||
|
||||
# UTF-8 & parse errors fix
|
||||
markdown: redcarpet
|
||||
|
||||
# Custom Variables
|
||||
head:
|
||||
major: 1.0.0
|
||||
minor: 1.0.3
|
49
lib/js/extra/headjs/_includes/api/1.0.0/browser.html
Normal file
49
lib/js/extra/headjs/_includes/api/1.0.0/browser.html
Normal file
|
@ -0,0 +1,49 @@
|
|||
<h2 id="browser">Browser Information</h2>
|
||||
|
||||
<div class="intro">
|
||||
HeadJS knows certain information about the browser and exposes that information via CSS & JS
|
||||
</div>
|
||||
|
||||
<div class="code-example" data-title="head.browser">
|
||||
<p>These variables are accessible via JavaScript (all the time) so you can apply certain logic depending on specific use-cases</p>
|
||||
|
||||
<ul>
|
||||
<li>head.browser.name (string)</li>
|
||||
<li>head.browser.version (float)</li>
|
||||
<li>head.browser.ie (bool)</li>
|
||||
<li>head.browser.ff (bool)</li>
|
||||
<li>head.browser.chrome (bool)</li>
|
||||
<li>head.browser.ios (bool)</li>
|
||||
<li>head.browser.android (bool)</li>
|
||||
<li>head.browser.webkit (bool)</li>
|
||||
<li>head.browser.opera (bool)</li>
|
||||
</ul>
|
||||
|
||||
{% highlight js %}
|
||||
if (head.browser.ie && head.browser.version < 9) {
|
||||
/* code specific to IE but only if IE < 9 */
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
<p>The same information is also exposed via CSS, so that you may apply CSS specific fixes</p>
|
||||
|
||||
{% highlight css %}
|
||||
.ie8 {
|
||||
/* code specific to IE8 */
|
||||
}
|
||||
|
||||
.lt-ie9 {
|
||||
/* code specific to IE but only if IE < 9 */
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
<p>No matter how HeadJS is configured, it will at least generate CSS classes for the current browser & it's version (.ie8, .ff25). Generating classes for (.lt, .lte, .gt, .gte, .eq) including full min/max ranges of browser versions is supported, but not advised since it can generate too much css. By default only current browser + version, and IE6-11 ranges are generated automagically.</p>
|
||||
|
||||
<p>You can select which variables are exposed via CSS in the <a href="#configuration">configuration</a> section.</p>
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/1.0.0/browser', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
82
lib/js/extra/headjs/_includes/api/1.0.0/configuration.html
Normal file
82
lib/js/extra/headjs/_includes/api/1.0.0/configuration.html
Normal file
|
@ -0,0 +1,82 @@
|
|||
<h1 id="configuration">Configuration</h1>
|
||||
|
||||
<div class="intro">
|
||||
Sometimes you will want to change how HeadJS behaves by enabling or disabling certain features.
|
||||
</div>
|
||||
|
||||
<div class="code-example" data-title="Configuration">
|
||||
<p>This is the default configuration that HeadJS ships with</p>
|
||||
|
||||
{% highlight js %}
|
||||
conf = {
|
||||
screens : [240, 320, 480, 640, 768, 800, 1024, 1280, 1440, 1680, 1920],
|
||||
screensCss: { "gt": true, "gte": false, "lt": true, "lte": false, "eq": false },
|
||||
browsers : [
|
||||
{ ie: { min: 6, max: 11 } }
|
||||
//,{ chrome : { min: 8, max: 31 } }
|
||||
//,{ ff : { min: 3, max: 26 } }
|
||||
//,{ ios : { min: 3, max: 7 } }
|
||||
//,{ android: { min: 2, max: 4 } }
|
||||
//,{ webkit : { min: 9, max: 12 } }
|
||||
//,{ opera : { min: 9, max: 12 } }
|
||||
],
|
||||
browserCss: { "gt": true, "gte": false, "lt": true, "lte": false, "eq": true },
|
||||
html5 : true,
|
||||
page : "-page",
|
||||
section : "-section",
|
||||
head : "head"
|
||||
};
|
||||
{% endhighlight %}
|
||||
|
||||
<p>If you wanted to change what screen breakpoints HeadJS uses, then you would do something like this</p>
|
||||
|
||||
{% highlight html %}
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
var head_conf = {
|
||||
screens: [1024, 1280, 1440, 1680, 1920]
|
||||
};
|
||||
</script>
|
||||
<script src="head.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- my content-->
|
||||
</body>
|
||||
</html>
|
||||
{% endhighlight %}
|
||||
|
||||
<p>The same goes for all the other configurable variables. Just make sure <strong>var head_conf</strong> is declared BEFORE you include HeadJS.</p>
|
||||
|
||||
<dl>
|
||||
<dt>screens</dt>
|
||||
<dd>Width breakpoints for which lt,lte,gt,gte,eq can be generated (.gt-800, .lt-1680)</dd>
|
||||
|
||||
<dt>screensCss</dt>
|
||||
<dd>Enables/Disables the actual insertion of those breakpoints into the HTML</dd>
|
||||
|
||||
<dt>browsers</dt>
|
||||
<dd>Browser/Version breakpoints for which lt,lte,gt,gte,eq can be generated (.ie8, .lt-ie9)</dd>
|
||||
|
||||
<dt>browserCss</dt>
|
||||
<dd>Enables/Disables the actual insertion of those breakpoints into the HTML</dd>
|
||||
|
||||
<dt>html5</dt>
|
||||
<dd>When enabled, IE8 and less will have the « HTML5 Shim » injected, which adds compatibility for the following HTML5 elements: abbr, article, aside, audio, canvas, details, figcaption, figure, footer, header, hgroup, main, mark, meter, nav, output, progress, section, summary, time, video</dd>
|
||||
|
||||
<dt>page</dt>
|
||||
<dd>Suffix used by the « CSS Router » when detecting pages (#v1-page)</dd>
|
||||
|
||||
<dt>section</dt>
|
||||
<dd>Suffix used by the « CSS Router » when detecting page sections (.api-section)</dd>
|
||||
|
||||
<dt>head</dt>
|
||||
<dd>Name of the variable that should be used for HeadJS. If set to something else like: test, you would call test.load() instead of head.load()</dd>
|
||||
</dl>
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/1.0.0/configuration', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
344
lib/js/extra/headjs/_includes/api/1.0.0/features.html
Normal file
344
lib/js/extra/headjs/_includes/api/1.0.0/features.html
Normal file
|
@ -0,0 +1,344 @@
|
|||
<h1 id="features">Feature Detections</h1>
|
||||
<div class="intro">
|
||||
Feature detections help you apply CSS and JS logic depending on what a user supports or not. It also allows you to create custom detection to better manage your site.
|
||||
</div>
|
||||
<div class="code-example" data-title="head.feature()">
|
||||
<p>Imagine you have a menu or element that's only visible to members</p>
|
||||
|
||||
{% highlight js %}
|
||||
// add the feature
|
||||
head.feature("member", true);
|
||||
|
||||
// use the feature via CSS
|
||||
.member .member-menu {
|
||||
display: block;
|
||||
}
|
||||
.no-member .member-menu {
|
||||
display: none;
|
||||
}
|
||||
|
||||
// use the feature via JS
|
||||
if (head.member) {
|
||||
// do something
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
<p>You can toggle a feature from one state to another, it's state will be refleted to CSS and JS automatically</p>
|
||||
|
||||
<h3>In addition to being able to add your custom detections, a bunch of detections are already built in, and they are all accessible via CSS and JS</h3>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Is the user on a mobile device
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-mobile</li>
|
||||
<li>.mobile</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.mobile (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Is the user on a desktop device
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-desktop</li>
|
||||
<li>.desktop</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.desktop (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the usere support touch input
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-touch</li>
|
||||
<li>.touch</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.touch (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Is the users device in portrait mode
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-portrait</li>
|
||||
<li>.portrait</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.portrait (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Is the users device in landscape mode
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-landscape</li>
|
||||
<li>.landscape</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.landscape (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Is the users device a retina display
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-retina</li>
|
||||
<li>.retina</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.retina (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/transition/" target="_blank">CSS Transitions</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-transitions</li>
|
||||
<li>.transitions</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.transitions (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/transform/" target="_blank">CSS3 Transforms</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-transforms</li>
|
||||
<li>.transforms</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.transforms (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/gradient/" target="_blank">CSS3 Gradients</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-gradients</li>
|
||||
<li>.gradients</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.gradients (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/color/#opacity" target="_blank">CSS3 Opacity</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-opacity</li>
|
||||
<li>.opacity</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.opacity (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/background/" target="_blank">Multiple Backgrounds</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-multiplebgs</li>
|
||||
<li>.multiplebgs</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.multiplebgs (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/shadow/" target="_blank">CSS3 Box-Shadow</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-boxshadow</li>
|
||||
<li>.boxshadow</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.boxshadow (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/border/#borderimage" target="_blank">CSS3 Border-Image</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-borderimage</li>
|
||||
<li>.borderimage</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.borderimage (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/border/#borderradius" target="_blank">CSS3 Border-Radius</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-borderradius</li>
|
||||
<li>.borderradius</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.borderradius (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="https://www.webkit.org/blog/182/css-reflections/" target="_blank">CSS Reflections</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-cssreflections</li>
|
||||
<li>.cssreflections</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.cssreflections (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/font/" target="_blank">CSS3 @Font-Face</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-fontface</li>
|
||||
<li>.fontface</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.fontface (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/color/#rgba" target="_blank">CSS3 RGBA</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-rgba</li>
|
||||
<li>.rgba</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.rgba (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/1.0.0/features', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
63
lib/js/extra/headjs/_includes/api/1.0.0/html5.html
Normal file
63
lib/js/extra/headjs/_includes/api/1.0.0/html5.html
Normal file
|
@ -0,0 +1,63 @@
|
|||
<h1 id="html5">HTML5 Shim</h1>
|
||||
|
||||
<h2>Target HTML5 and CSS3 elements safely</h2>
|
||||
<div class="intro">
|
||||
Want to start using HTML5 semantics but are put off by it because you still have a large audience of users using non compatible browsers ?
|
||||
</div>
|
||||
<div class="code-example" data-title="HTML5 & CSS3">
|
||||
<p>DIV's are good, but HeadJS let's you be semantic and futuristic</p>
|
||||
|
||||
{% highlight html %}
|
||||
/* Use CSS3 semantics */
|
||||
<style>
|
||||
article { text-shadow:0 0 1px #ccc; }
|
||||
</style>
|
||||
|
||||
<!-- works in IE too -->
|
||||
<article>
|
||||
<header></header>
|
||||
<section></section>
|
||||
<footer></footer>
|
||||
</article>
|
||||
{% endhighlight %}
|
||||
|
||||
<p>HeadJS will detect if IE < 9 is present, and inject the necessary HTML5 Shim for you.</p>
|
||||
<p>You will still need to use a HTML5 enabling stylesheet for it to work like <a href="http://necolas.github.io/normalize.css/" target="_blank">Normalize.css</a>, or just <a href="/site/assets/css/html5.min.css" target="_blank">download our file</a> and reference it in your HEAD.</p>
|
||||
|
||||
{% highlight html %}
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="html5.min.css" />
|
||||
<script src="head.min.js"></script>
|
||||
|
||||
/* Use CSS3 semantics */
|
||||
<style>
|
||||
article { text-shadow:0 0 1px #ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- works in IE too -->
|
||||
<article>
|
||||
<header></header>
|
||||
<section></section>
|
||||
<footer></footer>
|
||||
</article>
|
||||
</body>
|
||||
</html>
|
||||
{% endhighlight %}
|
||||
|
||||
<p>You can also enable/disable the injection via the <a href="#configuration">configuration</a> section.</p>
|
||||
---
|
||||
<p><em>But before you start believing all the hype around HTML5, be sure to give this a read ..you'll be surprised !</em></p>
|
||||
<figure>
|
||||
<a href="http://www.truthabouthtml5.com/#fivereasons" target="_blank"><img src="/site/assets/img/truth-about-html5.jpg" alt="The Truth About HTML5" width="51" height="81"></a>
|
||||
<figcaption><em>The Truth About HTML5</em></figcaption>
|
||||
</figure>
|
||||
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/1.0.0/html5', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
97
lib/js/extra/headjs/_includes/api/1.0.0/load.html
Normal file
97
lib/js/extra/headjs/_includes/api/1.0.0/load.html
Normal file
|
@ -0,0 +1,97 @@
|
|||
<h1 id="load">Resource Loading</h1>
|
||||
|
||||
<div class="intro">
|
||||
Speed up your site. Manage your library's dependencies. Load javascript and stylesheets in parallel but execute them in the correct order.
|
||||
</div>
|
||||
<div class="code-example" data-title="head.load()">
|
||||
|
||||
<p>Resource loading has many different options to cater to various needs</p>
|
||||
|
||||
{% highlight js %}
|
||||
// queue scripts and fire a callback when loading is finished
|
||||
head.load("file1.js", "file2.js", function() {
|
||||
// do something
|
||||
});
|
||||
|
||||
// same as above, but pass files in as an Array
|
||||
head.load(["file1.js", "file2.js"], function() {
|
||||
// do something
|
||||
});
|
||||
|
||||
// you can also give scripts a name (label)
|
||||
head.load({ label1: "file1.js" }, { label2: "file2.js" }, function() {
|
||||
// do something
|
||||
});
|
||||
|
||||
// same as above, but pass files in as an Array
|
||||
head.load([{ label1: "file1.js" }, { label2: "file2.js" }], function() {
|
||||
// do something
|
||||
});
|
||||
|
||||
// Labels are usually used in conjuntion with: head.ready()
|
||||
head.ready("label1", function() {
|
||||
// do something
|
||||
});
|
||||
|
||||
// Actually if no label is supplied, internally the filename is used for the label
|
||||
head.ready("file1.js", function() {
|
||||
// do something
|
||||
});
|
||||
{% endhighlight %}
|
||||
|
||||
<p>All the above examples also work with CSS files.</p>
|
||||
|
||||
{% highlight js %}
|
||||
// queue scripts and fire a callback when loading is finished
|
||||
head.load("file1.css", "file2.css");
|
||||
|
||||
// same as above, but pass files in as an Array
|
||||
head.load(["file1.css", "file2.css"]);
|
||||
{% endhighlight %}
|
||||
|
||||
<h2>Conditional Loading</h2>
|
||||
<p>You can also run tests to load file A if a test succeeds, or fallback to file B. This is great for loading Polyfils, or loading dependencies when certain conditions are met.</p>
|
||||
|
||||
|
||||
{% highlight js %}
|
||||
// signature
|
||||
head.test(condition, success, failure, callback);
|
||||
|
||||
/*
|
||||
condition: something that evaluates to true/false
|
||||
success : a file, an array of files, a labeled object, an array of labeled objects
|
||||
failure : a file, an array of files, a labeled object, an array of labeled objects
|
||||
callback : a function to call when evaluation & loading is done
|
||||
*/
|
||||
|
||||
|
||||
// simplified version 1
|
||||
head.test(condition, "success.js", "failure.js" , callback);
|
||||
|
||||
// simplified version 2
|
||||
head.test(condition, ["success1.js", "success1.js"], "failure.js" , callback);
|
||||
|
||||
// object version
|
||||
head.test({
|
||||
test : bool,
|
||||
success : ["file1.js", "file2.js"],
|
||||
failure : ["poly1.js", "poly2.js"],
|
||||
callback: function() {
|
||||
// do stuff
|
||||
}
|
||||
);
|
||||
|
||||
// Example
|
||||
head.test(head.mobile, "normal.js", "fallback.js", function() {
|
||||
// do stuff
|
||||
});
|
||||
{% endhighlight %}
|
||||
|
||||
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/1.0.0/load', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
103
lib/js/extra/headjs/_includes/api/1.0.0/ready.html
Normal file
103
lib/js/extra/headjs/_includes/api/1.0.0/ready.html
Normal file
|
@ -0,0 +1,103 @@
|
|||
<h1 id="ready">Document Ready</h1>
|
||||
<div class="intro">
|
||||
Know when the document or various files have finished loading
|
||||
</div>
|
||||
<div class="code-example" data-title="head.ready()">
|
||||
<p>The best way to not block rendering of a page is to not put JS all over the page. The best practice is to put all your CSS in the <head> and all your JS right before the </body></p>
|
||||
|
||||
<p>Unfortunately this is not always possible, since often various elements depend on certain JS before getting to the </body>. To work around this we can push functions downwards to be able to execute them later when all the JS has finished loading.</p>
|
||||
|
||||
{% highlight html %}
|
||||
<html>
|
||||
<head>
|
||||
<script src="head.min.js"></script>
|
||||
<script>
|
||||
// this loads jquery asyncrounously & in parallel
|
||||
head.load("jquery.min.js");
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- some content-->
|
||||
|
||||
<!-- injected via a module or an include -->
|
||||
<script>
|
||||
// some function that depends on jquery
|
||||
head.ready("jquery.min.js", function () {
|
||||
// this will only be executed once jquery has finished loading
|
||||
$(".main").hide();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- some content-->
|
||||
</body>
|
||||
</html>
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Even when not depending on something like jQuery, if we should have inline scripts, it is always faster and safer to push the execution of those scripts to the bottom.</p>
|
||||
|
||||
{% highlight html %}
|
||||
<html>
|
||||
<head>
|
||||
<script src="head.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- some content-->
|
||||
|
||||
<!-- injected via a module or an include -->
|
||||
<script>
|
||||
// schedule the execution of the function for later
|
||||
// when the rest of the document has finished loading
|
||||
head.ready(document, function () {
|
||||
// some big function
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- some content-->
|
||||
</body>
|
||||
</html>
|
||||
{% endhighlight %}
|
||||
|
||||
<h3>head.ready() takes the following arguments</h3>
|
||||
|
||||
{% highlight js %}
|
||||
// Attention: subtility here
|
||||
head.ready(function() {
|
||||
// push a function to the end of the page for later execution
|
||||
// runs once all files have finished loading
|
||||
|
||||
// WARNING: if no files are cued for loading this will NOT trigger !
|
||||
});
|
||||
|
||||
head.ready(document, function() {
|
||||
// push a function to the end of the page for later execution
|
||||
// runs as soon as the document is ready
|
||||
});
|
||||
|
||||
head.ready("file1.js", function() {
|
||||
// execute this function, only when file1.js has finished loading
|
||||
// used in conjunction with head.load("file1.js");
|
||||
});
|
||||
|
||||
head.ready(["file1.js", "file2.js"], function() {
|
||||
// execute this function, only when file1.js AND file2.js has finished loading
|
||||
// used in conjunction with head.load("file1.js", "file2.js");
|
||||
});
|
||||
|
||||
head.ready("label1", function() {
|
||||
// execute this function, only when label1 has finished loading
|
||||
// used in conjunction with head.load({ label1: "file1.js" });
|
||||
});
|
||||
|
||||
head.ready(["label1", "label2"], function() {
|
||||
// execute this function, only when label1 AND label2 has finished loading
|
||||
// used in conjunction with head.load([{ label1: "file1.js" }, { label2: "file2.js" }]);
|
||||
});
|
||||
{% endhighlight %}
|
||||
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/1.0.0/ready', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
47
lib/js/extra/headjs/_includes/api/1.0.0/responsive.html
Normal file
47
lib/js/extra/headjs/_includes/api/1.0.0/responsive.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
<h2>Achieve responsive design with CSS that targets different screen resolutions, paths, states and browsers</h2>
|
||||
<div class="intro">
|
||||
HeadJS will detect screen resolutions, features, browsers and automatically generate dynamic css/javascript classes that you can then target.
|
||||
</div>
|
||||
<div class="code-example" data-title="CSS / JavaScript">
|
||||
<p>Often you will need to adapt your design or code logic depending on resolution, where the user is, or what browser he is using.</p>
|
||||
|
||||
{% highlight css %}
|
||||
/* Only apply margin to IE < 6 */
|
||||
.ie-lt6 {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
/* Resize elements based on resolution */
|
||||
.lt-800 .container {
|
||||
width: 600px;
|
||||
}
|
||||
.gt-1024 .container {
|
||||
width: 1000px;
|
||||
}
|
||||
|
||||
/* Change style based on feature support */
|
||||
.no-border-radius table {
|
||||
border: 1px dashed black;
|
||||
}
|
||||
|
||||
/* Change elements on individual pages thank's to the CSS Router */
|
||||
.index-page .ads {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Do something if the user is on a mobile device */
|
||||
if (head.mobile) {
|
||||
head.load("iscroll.js");
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
<p>
|
||||
All feature detections are both accessible via css classes, and javascript properties.
|
||||
</p>
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/1.0.0/responsive', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
47
lib/js/extra/headjs/_includes/api/1.0.0/router.html
Normal file
47
lib/js/extra/headjs/_includes/api/1.0.0/router.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
<h1 id="router">CSS Router</h1>
|
||||
<div class="intro">
|
||||
Know which page & section the user is currently on and react accordingly
|
||||
</div>
|
||||
<div class="code-example" data-title="CSS Router">
|
||||
<p>Ever need to highlight or change certain features depending on where the user is ? HeadJS will detect the current page, and what section (subfolder/path) the user is on, and generate CSS classes that you can then easily target.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
page (..problem with decimals ? should we drop, concenate ?)
|
||||
<ul><li>Will generate a CSS id for the current page: #v1-page</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
section
|
||||
<ul><li>Will generate multiple CSS classes for the current path: .site-section, .api-section</li></ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% highlight css %}
|
||||
/* user is on any page that ends with /index.* or on the root path / or */
|
||||
#index-page .main-menu {
|
||||
background-color: gray;
|
||||
}
|
||||
|
||||
/* user is on a path containing /api/ */
|
||||
.api-section .top-menu {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* mix & match */
|
||||
|
||||
/* for example the user is on /api/test.html */
|
||||
#test-page.api-section .top-menu {
|
||||
display: block;
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
<p>If the user is on page « /home/api/test.html » HeadJS will generate the following CSS classes for you: #test-page, .home-section, .api-section</p>
|
||||
|
||||
<p>You can choose how these variables are named in the <a href="#configuration">configuration</a> section.</p>
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/1.0.0/router', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
62
lib/js/extra/headjs/_includes/api/1.0.0/screen.html
Normal file
62
lib/js/extra/headjs/_includes/api/1.0.0/screen.html
Normal file
|
@ -0,0 +1,62 @@
|
|||
<h2 id="screen">Screen Information</h2>
|
||||
|
||||
<div class="intro">
|
||||
HeadJS also knows information about the current screen & viewport size
|
||||
</div>
|
||||
|
||||
<div class="code-example" data-title="head.screen">
|
||||
<p>These variables are accessible via JavaScript (all the time) so you can apply certain logic depending on specific use-cases</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
head.screen.height (int)
|
||||
<ul><li>This is the <strong>height</strong> of the screen (<strong>resolution</strong>) no matter the size of the current browser window</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
head.screen.width (int)
|
||||
<ul><li>This is the <strong>width</strong> of the screen (<strong>resolution</strong>) no matter the size of the current browser window</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
head.screen.innerHeight (int)
|
||||
<ul><li>This is the <strong>height</strong> of the inside of the browser window (<strong>viewport</strong>), and varies depending on the current size of the browser. It also does not include any eventual menu bars or toolbars. This is the default value when you want to do responsive design !</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
head.screen.innerWidth (int)
|
||||
<ul><li>This is the <strong>width</strong> of the inside of the browser window (<strong>viewport</strong>), and varies depending on the current size of the browser. It also does not include any eventual menu bars or toolbars. This is the default value when you want to do responsive design !</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
head.screen.outerHeight (int)
|
||||
<ul><li>This is the <strong>height</strong> of the entire browser, and varies depending on if the browser is resized or not.</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
head.screen.outerWidth (int)
|
||||
<ul><li>This is the <strong>width</strong> of the entire browser, and varies depending on if the browser is resized or not.</li></ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% highlight js %}
|
||||
if (head.screen.innerHeight < 800) {
|
||||
/* code specific to VIEWPORT < 800 */
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Viewport width information is exposed via CSS so you can apply responsive design principles to your website. These have the advantage of working even on browsers that do not support media queries !</p>
|
||||
|
||||
{% highlight css %}
|
||||
.lt-800 {
|
||||
/* code specific to VIEWPORT < 800 */
|
||||
}
|
||||
|
||||
.gt-800 {
|
||||
/* code specific to VIEWPORT > 800 */
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
<p>You can select which variables (lt, lte, gt, gte, eq) and which breakpoints (480, 640, 800, etc) are exposed via CSS in the <a href="#configuration">configuration</a> section.</p>
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/1.0.0/screen', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
63
lib/js/extra/headjs/_includes/api/1.0.0/setup.html
Normal file
63
lib/js/extra/headjs/_includes/api/1.0.0/setup.html
Normal file
|
@ -0,0 +1,63 @@
|
|||
<h1 id="setup">Setup</h1>
|
||||
|
||||
<div class="intro">
|
||||
Adding HeadJS to your site
|
||||
</div>
|
||||
|
||||
<div class="code-example" data-title="Setup">
|
||||
<p>The most common way to include HeadJS on your site will be to include it in the <head></p>
|
||||
|
||||
{% highlight html %}
|
||||
<html>
|
||||
<head>
|
||||
<script src="head.min.js"></script>
|
||||
<script>
|
||||
head.load("file1.js", "file2.js");
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- my content-->
|
||||
|
||||
<script>
|
||||
head.ready(function () {
|
||||
// some callback stuff
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
{% endhighlight %}
|
||||
|
||||
<p>But sometimes you might want it to load up a bunch of code right away, without having to declare that code in a new <script> tag. This can be very useful when using code-generation, or even if you just want to stick all your code in a centralized place.</p>
|
||||
|
||||
{% highlight html %}
|
||||
<html>
|
||||
<head>
|
||||
<script src="head.min.js" data-headjs-load="init.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- my content-->
|
||||
|
||||
<script>
|
||||
head.ready(function () {
|
||||
// some callback stuff
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
{% endhighlight %}
|
||||
|
||||
<p>In the above example you would put your code in init.js, which would be called automagically</p>
|
||||
|
||||
{% highlight js %}
|
||||
// init.js
|
||||
head.load("file1.js", "file2.js");
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Note: Only the first detected instance of data-headjs-load will be used, so make sure there is only one on the page.</p>
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/1.0.0/setup', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
49
lib/js/extra/headjs/_includes/api/2.0.0/browser.html
Normal file
49
lib/js/extra/headjs/_includes/api/2.0.0/browser.html
Normal file
|
@ -0,0 +1,49 @@
|
|||
<h2 id="browser">Browser Information</h2>
|
||||
|
||||
<div class="intro">
|
||||
HeadJS knows certain information about the browser and exposes that information via CSS & JS
|
||||
</div>
|
||||
|
||||
<div class="code-example" data-title="head.browser">
|
||||
<p>These variables are accessible via JavaScript (all the time) so you can apply certain logic depending on specific use-cases</p>
|
||||
|
||||
<ul>
|
||||
<li>head.browser.name (string)</li>
|
||||
<li>head.browser.version (float)</li>
|
||||
<li>head.browser.ie (bool)</li>
|
||||
<li>head.browser.ff (bool)</li>
|
||||
<li>head.browser.chrome (bool)</li>
|
||||
<li>head.browser.ios (bool)</li>
|
||||
<li>head.browser.android (bool)</li>
|
||||
<li>head.browser.webkit (bool)</li>
|
||||
<li>head.browser.opera (bool)</li>
|
||||
</ul>
|
||||
|
||||
{% highlight js %}
|
||||
if (head.browser.ie && head.browser.version < 9) {
|
||||
/* code specific to IE but only if IE < 9 */
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
<p>The same information is also exposed via CSS, so that you may apply CSS specific fixes</p>
|
||||
|
||||
{% highlight css %}
|
||||
.ie8 {
|
||||
/* code specific to IE8 */
|
||||
}
|
||||
|
||||
.ie-lt9 {
|
||||
/* code specific to IE but only if IE < 9 */
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
<p>No matter how HeadJS is configured, it will at least generate CSS classes for the current browser & it's version (.ie8, .ff25). Generating classes for (.lt, .gt) including full min/max ranges of browser versions is supported, but not advised since it can generate too much css. By default only current browser + version, and IE6-11 ranges are generated automagically.</p>
|
||||
|
||||
<p>You can select which variables are exposed via CSS in the <a href="#configuration">configuration</a> section.</p>
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/2.0.0/browser', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
98
lib/js/extra/headjs/_includes/api/2.0.0/configuration.html
Normal file
98
lib/js/extra/headjs/_includes/api/2.0.0/configuration.html
Normal file
|
@ -0,0 +1,98 @@
|
|||
<h1 id="configuration">Configuration</h1>
|
||||
|
||||
<div class="intro">
|
||||
Sometimes you will want to change how HeadJS behaves by enabling or disabling certain features.
|
||||
</div>
|
||||
|
||||
<div class="code-example" data-title="Configuration">
|
||||
<p>This is the default configuration that HeadJS ships with</p>
|
||||
|
||||
{% highlight js %}
|
||||
conf = {
|
||||
widths : [240, 320, 480, 640, 768, 800, 1024, 1280, 1366, 1440, 1680, 1920],
|
||||
heights : [320, 480, 600, 768, 800, 900, 1050],
|
||||
widthCss : { "gt": true, "lt": true, },
|
||||
heightCss : { "gt": true, "lt": true, },
|
||||
browsers : {
|
||||
"ie" : [7, 11]
|
||||
//,"ff" : [4, 26]
|
||||
//,"chrome" : [23, 31]
|
||||
//,"ios" : [4, 7]
|
||||
//,"android": [2, 4]
|
||||
//,"webkit" : [10, 12]
|
||||
//,"opera" : [10, 12]
|
||||
},
|
||||
browserCss: { "gt": true, "lt": true },
|
||||
html5 : true,
|
||||
hashtags : true,
|
||||
page : "page",
|
||||
section : "section",
|
||||
hash : "hash",
|
||||
head : "head"
|
||||
};
|
||||
{% endhighlight %}
|
||||
|
||||
<p>If you wanted to change what screen-width breakpoints HeadJS uses, then you would do something like this</p>
|
||||
|
||||
{% highlight html %}
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
var head_conf = {
|
||||
widths: [1024, 1280, 1440, 1680, 1920]
|
||||
};
|
||||
</script>
|
||||
<script src="head.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- my content-->
|
||||
</body>
|
||||
</html>
|
||||
{% endhighlight %}
|
||||
|
||||
<p>The same goes for all the other configurable variables. Just make sure <strong>var head_conf</strong> is declared BEFORE you include HeadJS.</p>
|
||||
|
||||
<dl>
|
||||
<dt>width</dt>
|
||||
<dd>Width breakpoints for which lt, gt can be generated (.w-gt800, .w-lt1680)</dd>
|
||||
|
||||
<dt>height</dt>
|
||||
<dd>Height breakpoints for which lt, gt can be generated (.h-gt600, .h-lt1050)</dd>
|
||||
|
||||
<dt>widthCss</dt>
|
||||
<dd>Enables/Disables the actual insertion of those breakpoints into the HTML</dd>
|
||||
|
||||
<dt>heightCss</dt>
|
||||
<dd>Enables/Disables the actual insertion of those breakpoints into the HTML</dd>
|
||||
|
||||
<dt>browsers</dt>
|
||||
<dd>Browser version breakpoints for which lt, gt can be generated (.ie-gt8, .ie-lt9)</dd>
|
||||
|
||||
<dt>browserCss</dt>
|
||||
<dd>Enables/Disables the actual insertion of those breakpoints into the HTML</dd>
|
||||
|
||||
<dt>html5</dt>
|
||||
<dd>When enabled, IE8 and less will have the « HTML5 Shim » injected, which adds compatibility for the following HTML5 elements: abbr, article, aside, audio, canvas, details, figcaption, figure, footer, header, hgroup, main, mark, meter, nav, output, progress, section, summary, time, video</dd>
|
||||
|
||||
<dt>hashtags</dt>
|
||||
<dd>When enabled, hashchange events will be detected (ie. /home/user#profile) and classes inserted into the HTML</dd>
|
||||
|
||||
<dt>page</dt>
|
||||
<dd>Prefix used by the « CSS Router » when detecting pages (#page-user)</dd>
|
||||
|
||||
<dt>section</dt>
|
||||
<dd>Prefix used by the « CSS Router » when detecting page sections (.section-home)</dd>
|
||||
|
||||
<dt>hash</dt>
|
||||
<dd>Prefix used by the « CSS Router » when detecting hashtags (.hash-profile)</dd>
|
||||
|
||||
<dt>head</dt>
|
||||
<dd>Name of the variable that should be used for HeadJS. If set to something else like: test, you would call test.load() instead of head.load()</dd>
|
||||
</dl>
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/2.0.0/configuration', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
344
lib/js/extra/headjs/_includes/api/2.0.0/features.html
Normal file
344
lib/js/extra/headjs/_includes/api/2.0.0/features.html
Normal file
|
@ -0,0 +1,344 @@
|
|||
<h1 id="features">Feature Detections</h1>
|
||||
<div class="intro">
|
||||
Feature detections help you apply CSS and JS logic depending on what a user supports or not. It also allows you to create custom detection to better manage your site.
|
||||
</div>
|
||||
<div class="code-example" data-title="head.feature()">
|
||||
<p>Imagine you have a menu or element that's only visible to members</p>
|
||||
|
||||
{% highlight js %}
|
||||
// add the feature
|
||||
head.feature("member", true);
|
||||
|
||||
// use the feature via CSS
|
||||
.member .member-menu {
|
||||
display: block;
|
||||
}
|
||||
.no-member .member-menu {
|
||||
display: none;
|
||||
}
|
||||
|
||||
// use the feature via JS
|
||||
if (head.member) {
|
||||
// do something
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
<p>You can toggle a feature from one state to another, it's state will be refleted to CSS and JS automatically</p>
|
||||
|
||||
<h3>In addition to being able to add your custom detections, a bunch of detections are already built in, and they are all accessible via CSS and JS</h3>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Is the user on a mobile device
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-mobile</li>
|
||||
<li>.mobile</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.mobile (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Is the user on a desktop device
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-desktop</li>
|
||||
<li>.desktop</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.desktop (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the usere support touch input
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-touch</li>
|
||||
<li>.touch</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.touch (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Is the users device in portrait mode
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-portrait</li>
|
||||
<li>.portrait</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.portrait (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Is the users device in landscape mode
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-landscape</li>
|
||||
<li>.landscape</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.landscape (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Is the users device a retina display
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-retina</li>
|
||||
<li>.retina</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.retina (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/transition/" target="_blank">CSS Transitions</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-transitions</li>
|
||||
<li>.transitions</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.transitions (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/transform/" target="_blank">CSS3 Transforms</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-transforms</li>
|
||||
<li>.transforms</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.transforms (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/gradient/" target="_blank">CSS3 Gradients</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-gradients</li>
|
||||
<li>.gradients</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.gradients (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/color/#opacity" target="_blank">CSS3 Opacity</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-opacity</li>
|
||||
<li>.opacity</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.opacity (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/background/" target="_blank">Multiple Backgrounds</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-multiplebgs</li>
|
||||
<li>.multiplebgs</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.multiplebgs (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/shadow/" target="_blank">CSS3 Box-Shadow</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-boxshadow</li>
|
||||
<li>.boxshadow</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.boxshadow (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/border/#borderimage" target="_blank">CSS3 Border-Image</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-borderimage</li>
|
||||
<li>.borderimage</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.borderimage (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/border/#borderradius" target="_blank">CSS3 Border-Radius</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-borderradius</li>
|
||||
<li>.borderradius</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.borderradius (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="https://www.webkit.org/blog/182/css-reflections/" target="_blank">CSS Reflections</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-cssreflections</li>
|
||||
<li>.cssreflections</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.cssreflections (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/font/" target="_blank">CSS3 @Font-Face</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-fontface</li>
|
||||
<li>.fontface</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.fontface (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Does the user support <a href="http://www.css3files.com/color/#rgba" target="_blank">CSS3 RGBA</a>
|
||||
<ul>
|
||||
<li>
|
||||
CSS
|
||||
<ul>
|
||||
<li>.no-rgba</li>
|
||||
<li>.rgba</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
JS
|
||||
<ul>
|
||||
<li>head.rgba (bool)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/2.0.0/features', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
63
lib/js/extra/headjs/_includes/api/2.0.0/html5.html
Normal file
63
lib/js/extra/headjs/_includes/api/2.0.0/html5.html
Normal file
|
@ -0,0 +1,63 @@
|
|||
<h1 id="html5">HTML5 Shim</h1>
|
||||
|
||||
<h2>Target HTML5 and CSS3 elements safely</h2>
|
||||
<div class="intro">
|
||||
Want to start using HTML5 semantics but are put off by it because you still have a large audience of users using non compatible browsers ?
|
||||
</div>
|
||||
<div class="code-example" data-title="HTML5 & CSS3">
|
||||
<p>DIV's are good, but HeadJS let's you be semantic and futuristic</p>
|
||||
|
||||
{% highlight html %}
|
||||
/* Use CSS3 semantics */
|
||||
<style>
|
||||
article { text-shadow:0 0 1px #ccc; }
|
||||
</style>
|
||||
|
||||
<!-- works in IE too -->
|
||||
<article>
|
||||
<header></header>
|
||||
<section></section>
|
||||
<footer></footer>
|
||||
</article>
|
||||
{% endhighlight %}
|
||||
|
||||
<p>HeadJS will detect if IE < 9 is present, and inject the necessary HTML5 Shim for you.</p>
|
||||
<p>You will still need to use a HTML5 enabling stylesheet for it to work like <a href="http://necolas.github.io/normalize.css/" target="_blank">Normalize.css</a>, or just <a href="/site/assets/css/html5.min.css" target="_blank">download our file</a> and reference it in your HEAD.</p>
|
||||
|
||||
{% highlight html %}
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="html5.min.css" />
|
||||
<script src="head.min.js"></script>
|
||||
|
||||
/* Use CSS3 semantics */
|
||||
<style>
|
||||
article { text-shadow:0 0 1px #ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- works in IE too -->
|
||||
<article>
|
||||
<header></header>
|
||||
<section></section>
|
||||
<footer></footer>
|
||||
</article>
|
||||
</body>
|
||||
</html>
|
||||
{% endhighlight %}
|
||||
|
||||
<p>You can also enable/disable the injection via the <a href="#configuration">configuration</a> section.</p>
|
||||
---
|
||||
<p><em>But before you start believing all the hype around HTML5, be sure to give this a read ..you'll be surprised !</em></p>
|
||||
<figure>
|
||||
<a href="http://www.truthabouthtml5.com/#fivereasons" target="_blank"><img src="/site/assets/img/truth-about-html5.jpg" alt="The Truth About HTML5" width="51" height="81"></a>
|
||||
<figcaption><em>The Truth About HTML5</em></figcaption>
|
||||
</figure>
|
||||
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/2.0.0/html5', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
97
lib/js/extra/headjs/_includes/api/2.0.0/load.html
Normal file
97
lib/js/extra/headjs/_includes/api/2.0.0/load.html
Normal file
|
@ -0,0 +1,97 @@
|
|||
<h1 id="load">Resource Loading</h1>
|
||||
|
||||
<div class="intro">
|
||||
Speed up your site. Manage your library's dependencies. Load javascript and stylesheets in parallel but execute them in the correct order.
|
||||
</div>
|
||||
<div class="code-example" data-title="head.load()">
|
||||
|
||||
<p>Resource loading has many different options to cater to various needs</p>
|
||||
|
||||
{% highlight js %}
|
||||
// queue scripts and fire a callback when loading is finished
|
||||
head.load("file1.js", "file2.js", function() {
|
||||
// do something
|
||||
});
|
||||
|
||||
// same as above, but pass files in as an Array
|
||||
head.load(["file1.js", "file2.js"], function() {
|
||||
// do something
|
||||
});
|
||||
|
||||
// you can also give scripts a name (label)
|
||||
head.load({ label1: "file1.js" }, { label2: "file2.js" }, function() {
|
||||
// do something
|
||||
});
|
||||
|
||||
// same as above, but pass files in as an Array
|
||||
head.load([{ label1: "file1.js" }, { label2: "file2.js" }], function() {
|
||||
// do something
|
||||
});
|
||||
|
||||
// Labels are usually used in conjuntion with: head.ready()
|
||||
head.ready("label1", function() {
|
||||
// do something
|
||||
});
|
||||
|
||||
// Actually if no label is supplied, internally the filename is used for the label
|
||||
head.ready("file1.js", function() {
|
||||
// do something
|
||||
});
|
||||
{% endhighlight %}
|
||||
|
||||
<p>All the above examples also work with CSS files.</p>
|
||||
|
||||
{% highlight js %}
|
||||
// queue scripts and fire a callback when loading is finished
|
||||
head.load("file1.css", "file2.css");
|
||||
|
||||
// same as above, but pass files in as an Array
|
||||
head.load(["file1.css", "file2.css"]);
|
||||
{% endhighlight %}
|
||||
|
||||
<h2>Conditional Loading</h2>
|
||||
<p>You can also run tests to load file A if a test succeeds, or fallback to file B. This is great for loading Polyfils, or loading dependencies when certain conditions are met.</p>
|
||||
|
||||
|
||||
{% highlight js %}
|
||||
// signature
|
||||
head.test(condition, success, failure, callback);
|
||||
|
||||
/*
|
||||
condition: something that evaluates to true/false
|
||||
success : a file, an array of files, a labeled object, an array of labeled objects
|
||||
failure : a file, an array of files, a labeled object, an array of labeled objects
|
||||
callback : a function to call when evaluation & loading is done
|
||||
*/
|
||||
|
||||
|
||||
// simplified version 1
|
||||
head.test(condition, "success.js", "failure.js" , callback);
|
||||
|
||||
// simplified version 2
|
||||
head.test(condition, ["success1.js", "success1.js"], "failure.js" , callback);
|
||||
|
||||
// object version
|
||||
head.test({
|
||||
test : bool,
|
||||
success : ["file1.js", "file2.js"],
|
||||
failure : ["poly1.js", "poly2.js"],
|
||||
callback: function() {
|
||||
// do stuff
|
||||
}
|
||||
);
|
||||
|
||||
// Example
|
||||
head.test(head.mobile, "normal.js", "fallback.js", function() {
|
||||
// do stuff
|
||||
});
|
||||
{% endhighlight %}
|
||||
|
||||
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/2.0.0/load', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
103
lib/js/extra/headjs/_includes/api/2.0.0/ready.html
Normal file
103
lib/js/extra/headjs/_includes/api/2.0.0/ready.html
Normal file
|
@ -0,0 +1,103 @@
|
|||
<h1 id="ready">Document Ready</h1>
|
||||
<div class="intro">
|
||||
Know when the document or various files have finished loading
|
||||
</div>
|
||||
<div class="code-example" data-title="head.ready()">
|
||||
<p>The best way to not block rendering of a page is to not put JS all over the page. The best practice is to put all your CSS in the <head> and all your JS right before the </body></p>
|
||||
|
||||
<p>Unfortunately this is not always possible, since often various elements depend on certain JS before getting to the </body>. To work around this we can push functions downwards to be able to execute them later when all the JS has finished loading.</p>
|
||||
|
||||
{% highlight html %}
|
||||
<html>
|
||||
<head>
|
||||
<script src="head.min.js"></script>
|
||||
<script>
|
||||
// this loads jquery asyncrounously & in parallel
|
||||
head.load("jquery.min.js");
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- some content-->
|
||||
|
||||
<!-- injected via a module or an include -->
|
||||
<script>
|
||||
// some function that depends on jquery
|
||||
head.ready("jquery.min.js", function () {
|
||||
// this will only be executed once jquery has finished loading
|
||||
$(".main").hide();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- some content-->
|
||||
</body>
|
||||
</html>
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Even when not depending on something like jQuery, if we should have inline scripts, it is always faster and safer to push the execution of those scripts to the bottom.</p>
|
||||
|
||||
{% highlight html %}
|
||||
<html>
|
||||
<head>
|
||||
<script src="head.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- some content-->
|
||||
|
||||
<!-- injected via a module or an include -->
|
||||
<script>
|
||||
// schedule the execution of the function for later
|
||||
// when the rest of the document has finished loading
|
||||
head.ready(document, function () {
|
||||
// some big function
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- some content-->
|
||||
</body>
|
||||
</html>
|
||||
{% endhighlight %}
|
||||
|
||||
<h3>head.ready() takes the following arguments</h3>
|
||||
|
||||
{% highlight js %}
|
||||
// Attention: subtility here
|
||||
head.ready(function() {
|
||||
// push a function to the end of the page for later execution
|
||||
// runs once all files have finished loading
|
||||
|
||||
// WARNING: if no files are cued for loading this will NOT trigger !
|
||||
});
|
||||
|
||||
head.ready(document, function() {
|
||||
// push a function to the end of the page for later execution
|
||||
// runs as soon as the document is ready
|
||||
});
|
||||
|
||||
head.ready("file1.js", function() {
|
||||
// execute this function, only when file1.js has finished loading
|
||||
// used in conjunction with head.load("file1.js");
|
||||
});
|
||||
|
||||
head.ready(["file1.js", "file2.js"], function() {
|
||||
// execute this function, only when file1.js AND file2.js has finished loading
|
||||
// used in conjunction with head.load("file1.js", "file2.js");
|
||||
});
|
||||
|
||||
head.ready("label1", function() {
|
||||
// execute this function, only when label1 has finished loading
|
||||
// used in conjunction with head.load({ label1: "file1.js" });
|
||||
});
|
||||
|
||||
head.ready(["label1", "label2"], function() {
|
||||
// execute this function, only when label1 AND label2 has finished loading
|
||||
// used in conjunction with head.load([{ label1: "file1.js" }, { label2: "file2.js" }]);
|
||||
});
|
||||
{% endhighlight %}
|
||||
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/2.0.0/ready', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
47
lib/js/extra/headjs/_includes/api/2.0.0/responsive.html
Normal file
47
lib/js/extra/headjs/_includes/api/2.0.0/responsive.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
<h2>Achieve responsive design with CSS that targets different screen resolutions, paths, states and browsers</h2>
|
||||
<div class="intro">
|
||||
HeadJS will detect screen resolutions, features, browsers and automatically generate dynamic css/javascript classes that you can then target.
|
||||
</div>
|
||||
<div class="code-example" data-title="CSS / JavaScript">
|
||||
<p>Often you will need to adapt your design or code logic depending on resolution, where the user is, or what browser he is using.</p>
|
||||
|
||||
{% highlight css %}
|
||||
/* Only apply margin to IE < 6 */
|
||||
.ie-lt6 {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
/* Resize elements based on resolution */
|
||||
.lt-800 .container {
|
||||
width: 600px;
|
||||
}
|
||||
.gt-1024 .container {
|
||||
width: 1000px;
|
||||
}
|
||||
|
||||
/* Change style based on feature support */
|
||||
.no-border-radius table {
|
||||
border: 1px dashed black;
|
||||
}
|
||||
|
||||
/* Change elements on individual pages thank's to the CSS Router */
|
||||
.index-page .ads {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Do something if the user is on a mobile device */
|
||||
if (head.mobile) {
|
||||
head.load("iscroll.js");
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
<p>
|
||||
All feature detections are both accessible via css classes, and javascript properties.
|
||||
</p>
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/2.0.0/responsive', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
47
lib/js/extra/headjs/_includes/api/2.0.0/router.html
Normal file
47
lib/js/extra/headjs/_includes/api/2.0.0/router.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
<h1 id="router">CSS Router</h1>
|
||||
<div class="intro">
|
||||
Know which page & section the user is currently on and react accordingly
|
||||
</div>
|
||||
<div class="code-example" data-title="CSS Router">
|
||||
<p>Ever need to highlight or change certain features depending on where the user is ? HeadJS will detect the current page, and what section (subfolder/path) the user is on, and generate CSS classes that you can then easily target.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
page (..problem with decimals ? should we drop, concenate ?)
|
||||
<ul><li>Will generate a CSS id for the current page: #v1-page</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
section
|
||||
<ul><li>Will generate multiple CSS classes for the current path: .site-section, .api-section</li></ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% highlight css %}
|
||||
/* user is on any page that ends with /index.* or on the root path / or */
|
||||
#index-page .main-menu {
|
||||
background-color: gray;
|
||||
}
|
||||
|
||||
/* user is on a path containing /api/ */
|
||||
.api-section .top-menu {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* mix & match */
|
||||
|
||||
/* for example the user is on /api/test.html */
|
||||
#test-page.api-section .top-menu {
|
||||
display: block;
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
<p>If the user is on page « /home/api/test.html » HeadJS will generate the following CSS classes for you: #test-page, .home-section, .api-section</p>
|
||||
|
||||
<p>You can choose how these variables are named in the <a href="#configuration">configuration</a> section.</p>
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/2.0.0/router', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
62
lib/js/extra/headjs/_includes/api/2.0.0/screen.html
Normal file
62
lib/js/extra/headjs/_includes/api/2.0.0/screen.html
Normal file
|
@ -0,0 +1,62 @@
|
|||
<h2 id="screen">Screen Information</h2>
|
||||
|
||||
<div class="intro">
|
||||
HeadJS also knows information about the current screen & viewport size
|
||||
</div>
|
||||
|
||||
<div class="code-example" data-title="head.screen">
|
||||
<p>These variables are accessible via JavaScript (all the time) so you can apply certain logic depending on specific use-cases</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
head.screen.height (int)
|
||||
<ul><li>This is the <strong>height</strong> of the screen (<strong>resolution</strong>) no matter the size of the current browser window</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
head.screen.width (int)
|
||||
<ul><li>This is the <strong>width</strong> of the screen (<strong>resolution</strong>) no matter the size of the current browser window</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
head.screen.innerHeight (int)
|
||||
<ul><li>This is the <strong>height</strong> of the inside of the browser window (<strong>viewport</strong>), and varies depending on the current size of the browser. It also does not include any eventual menu bars or toolbars. This is the default value when you want to do responsive design !</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
head.screen.innerWidth (int)
|
||||
<ul><li>This is the <strong>width</strong> of the inside of the browser window (<strong>viewport</strong>), and varies depending on the current size of the browser. It also does not include any eventual menu bars or toolbars. This is the default value when you want to do responsive design !</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
head.screen.outerHeight (int)
|
||||
<ul><li>This is the <strong>height</strong> of the entire browser, and varies depending on if the browser is resized or not.</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
head.screen.outerWidth (int)
|
||||
<ul><li>This is the <strong>width</strong> of the entire browser, and varies depending on if the browser is resized or not.</li></ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% highlight js %}
|
||||
if (head.screen.innerHeight < 800) {
|
||||
/* code specific to VIEWPORT < 800 */
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Viewport width information is exposed via CSS so you can apply responsive design principles to your website. These have the advantage of working even on browsers that do not support media queries !</p>
|
||||
|
||||
{% highlight css %}
|
||||
.h-lt1024 {
|
||||
/* code specific to VIEWPORT HEIGHT < 1024 */
|
||||
}
|
||||
|
||||
.w-gt800 {
|
||||
/* code specific to VIEWPORT WIDTH > 800 */
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
<p>You can select which variables (lt, gt) and which breakpoints (480, 640, 800, etc) are exposed via CSS in the <a href="#configuration">configuration</a> section.</p>
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/2.0.0/screen', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
63
lib/js/extra/headjs/_includes/api/2.0.0/setup.html
Normal file
63
lib/js/extra/headjs/_includes/api/2.0.0/setup.html
Normal file
|
@ -0,0 +1,63 @@
|
|||
<h1 id="setup">Setup</h1>
|
||||
|
||||
<div class="intro">
|
||||
Adding HeadJS to your site
|
||||
</div>
|
||||
|
||||
<div class="code-example" data-title="Setup">
|
||||
<p>The most common way to include HeadJS on your site will be to include it in the <head></p>
|
||||
|
||||
{% highlight html %}
|
||||
<html>
|
||||
<head>
|
||||
<script src="head.min.js"></script>
|
||||
<script>
|
||||
head.load("file1.js", "file2.js");
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- my content-->
|
||||
|
||||
<script>
|
||||
head.ready(function () {
|
||||
// some callback stuff
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
{% endhighlight %}
|
||||
|
||||
<p>But sometimes you might want it to load up a bunch of code right away, without having to declare that code in a new <script> tag. This can be very useful when using code-generation, or even if you just want to stick all your code in a centralized place.</p>
|
||||
|
||||
{% highlight html %}
|
||||
<html>
|
||||
<head>
|
||||
<script src="head.min.js" data-headjs-load="init.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- my content-->
|
||||
|
||||
<script>
|
||||
head.ready(function () {
|
||||
// some callback stuff
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
{% endhighlight %}
|
||||
|
||||
<p>In the above example you would put your code in init.js, which would be called automagically</p>
|
||||
|
||||
{% highlight js %}
|
||||
// init.js
|
||||
head.load("file1.js", "file2.js");
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Note: Only the first detected instance of data-headjs-load will be used, so make sure there is only one on the page.</p>
|
||||
|
||||
<div style="width:100%;">
|
||||
<div onclick="blog.loadComments(this, 'api/2.0.0/setup', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
135
lib/js/extra/headjs/_includes/content/builder.html
Normal file
135
lib/js/extra/headjs/_includes/content/builder.html
Normal file
|
@ -0,0 +1,135 @@
|
|||
<script>
|
||||
function addBreakPoint(ele) {
|
||||
// create seperate function to prepopulate
|
||||
// allow adding of multiple values: 4,5,6,7
|
||||
var value = parseInt(prompt("Enter breakpoint value"));
|
||||
if (value) {
|
||||
var bps = $(ele)
|
||||
.parent()
|
||||
.find(".bps");
|
||||
|
||||
bps.append("<span>" + (bps.find(".bp").length ? ', ' : '') + "<span class='bp'>" + value + "</span></span>");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<h2>Roll-Your-Own</h2>
|
||||
<fieldset>
|
||||
<legend><strong>Core Libraries</strong></legend>
|
||||
<ol id="core">
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox"/>
|
||||
Asset Loader
|
||||
<small style="float:right">head.load.js</small>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox"/>
|
||||
Responsive Design
|
||||
<small style="float:right">head.responsive.js</small>
|
||||
</label>
|
||||
</li>
|
||||
</ol>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<h2>Responsive Configuration</h2>
|
||||
<pre id="head-conf">
|
||||
// <span class="undeline">Underlined</span> elements are interactive via "click"
|
||||
var head_conf =
|
||||
<span class="screens">screens</span> : <span>[<span class="bps">240,480</span> <a href="javascript:void(0)" class="button add" onclick="addBreakPoint(this)">Add</a>],</span>
|
||||
<span class="screensCss">screensCss</span>: { "gt": <span class="gt toggle">true</span>, "gte": <span class="gte toggle">true</span>, "lt": <span class="lt toggle">true</span>, "lte": <span class="lte toggle">true</span>, "eq": <span class="eq toggle">true</span> },
|
||||
<span class="browsers">browsers</span> : [
|
||||
<span> { <span class="bid">ie</span> : [<span class="bps">6,7,8,9,10</span> <a href="javascript:void(0)" class="button add" onclick="addBreakPoint(this)">Add</a>] }</span>
|
||||
<span>,{ <span class="bid">chrome</span> : [<span class="bps"><span>8</span>,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24</span> <a href="javascript:void(0)" class="button add" onclick="addBreakPoint(this)">Add</a>] }</span>
|
||||
<span>,{ <span class="bid">ff</span> : [<span class="bps">3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19</span> <a href="javascript:void(0)" class="button add" onclick="addBreakPoint(this)">Add</a>] }</span>
|
||||
<span>,{ <span class="bid">ios</span> : [<span class="bps">3,4,5,6</span> <a href="javascript:void(0)" class="button add" onclick="addBreakPoint(this)">Add</a>] }</span>
|
||||
<span>,{ <span class="bid">android:</span> [<span class="bps">2,3,4</span> <a href="javascript:void(0)" class="button add" onclick="addBreakPoint(this)">Add</a>] }</span>
|
||||
<span>,{ <span class="bid">webkit</span> : [<span class="bps">9</span> <a href="javascript:void(0)" class="button add" onclick="addBreakPoint(this)">Add</a>] }</span>
|
||||
<span>,{ <span class="bid">opera</span> : [<span class="bps"></span> <a href="javascript:void(0)" class="button add" onclick="addBreakPoint(this)">Add</a>] }</span>
|
||||
],
|
||||
<span class="browserCss">browserCss: { "gt": <span class="gt toggle">true</span>, "gte": <span class="gte toggle">true</span>, "lt": <span class="lt toggle">true</span>, "lte": <span class="lte toggle">true</span>, "eq": <span class="eq toggle">true</span> },</span>
|
||||
html5 : <span class="html5 toggle">true</span>,
|
||||
page : <input class="page" value="-page" type="text" size="10"/>,
|
||||
section : <input class="section" value="-section" type="text" size="10"/>,
|
||||
hash : <input class="hash" value="-target" type="text" size="10"/>,
|
||||
head : <input class="head" value="head" type="text" size="10"/>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<h2>Feature Detections</h2>
|
||||
<fieldset>
|
||||
<legend>Browser Features</legend>
|
||||
<ol id="browser"></ol>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Device Features</legend>
|
||||
<ol id="device"></ol>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>CSS Features</legend>
|
||||
<ol id="css"></ol>
|
||||
</fieldset>
|
||||
|
||||
<textarea id="out" rows="7" style="width: 99.5%;"></textarea>
|
||||
|
||||
<p>
|
||||
<input type="checkbox" id="minify" />
|
||||
<label for="minify">Minify</label>
|
||||
<input type="checkbox" id="pack" />
|
||||
<label for="pack">Pack</label> <strong><em><span id="size"></span></em></strong>
|
||||
</p>
|
||||
<p>
|
||||
<a href="javascript:void(0)" class="button rounded" onclick="generate()">Generate</a>
|
||||
<a href="javascript:void(0)" class="button rounded" onclick="getDownload()">Download</a>
|
||||
</p>
|
||||
|
||||
|
||||
<script src="/site/assets/libs/jquery/jquery.min.js"></script>
|
||||
<script src="/site/assets/libs/builder/builder.min.js"></script>
|
||||
<script>
|
||||
GetFeatures();
|
||||
|
||||
////$.ajax({
|
||||
//// url: "http://www.i-technology.net/feeds/posts/default/-/headjs?alt=json",
|
||||
//// type: 'get',
|
||||
//// dataType: "jsonp",
|
||||
//// success: function (data) {
|
||||
//// //console.log(data);
|
||||
//// $("body").append($(data.feed.entry[0].content.$t).text());
|
||||
//// }
|
||||
////});
|
||||
|
||||
// Toogle browser id
|
||||
$(".bid").on("click", function () {
|
||||
$(this).parent().toggleClass("line-through");
|
||||
});
|
||||
|
||||
// Toogle bool value
|
||||
$(".toggle").on("click", function () {
|
||||
$(this).text($(this).text() == "true" ? "false" : "true");
|
||||
});
|
||||
|
||||
// Remove breakpoint
|
||||
$(".bp").live("click", function () {
|
||||
// when removing, should probably remove all and readd to make sure commas are right & reorder correctly
|
||||
// probably same on ad : order by ascending
|
||||
if (confirm("Remove this breakpoint ?")) {
|
||||
$(this).parent().remove();
|
||||
}
|
||||
});
|
||||
|
||||
// Cycle through breakpoints
|
||||
//$(".bps").on("dblclick", function () {
|
||||
// $(this).find(".bp").each(function() {
|
||||
// console.log($(this).text());
|
||||
// });
|
||||
//});
|
||||
</script>
|
||||
|
||||
<script src="/site/assets/libs/packer/base2.min.js"></script>
|
||||
<script src="/site/assets/libs/packer/words.min.js"></script>
|
||||
<script src="/site/assets/libs/packer/packer.min.js"></script>
|
17
lib/js/extra/headjs/_includes/scripts/analytics.html
Normal file
17
lib/js/extra/headjs/_includes/scripts/analytics.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', 'UA-15567888-7', { 'name': 'itech', 'cookieDomain': 'none' });
|
||||
ga('create', 'UA-20001309-1', { 'name': 'cloud', 'cookieDomain': '.headjs.com' });
|
||||
|
||||
ga('itech.send', 'pageview');
|
||||
ga('cloud.send', 'pageview');
|
||||
|
||||
function trackPageView(page) {
|
||||
window.ga('itech.send', 'pageview', { 'page': page });
|
||||
window.ga('cloud.send', 'pageview', { 'page': page });
|
||||
}
|
||||
</script>
|
17
lib/js/extra/headjs/_includes/scripts/uservoice.html
Normal file
17
lib/js/extra/headjs/_includes/scripts/uservoice.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<!-- UserVoice JavaScript SDK (only needed once on a page) -->
|
||||
<script>(function(){var uv=document.createElement('script');uv.type='text/javascript';uv.async=true;uv.src='//widget.uservoice.com/V4H0vdVJNOwBZTsBfSspDg.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(uv,s)})()</script>
|
||||
|
||||
<!-- A tab to launch the Classic Widget -->
|
||||
<script>
|
||||
UserVoice = window.UserVoice || [];
|
||||
UserVoice.push(['showTab', 'classic_widget', {
|
||||
mode : 'feedback',
|
||||
primary_color: '#cc6d00',
|
||||
link_color : '#007dbf',
|
||||
forum_id : 182905,
|
||||
tab_label : 'Features & Suggestions',
|
||||
tab_color : '#cc6d00',
|
||||
tab_position : 'middle-left',
|
||||
tab_inverted : false
|
||||
}]);
|
||||
</script>
|
13
lib/js/extra/headjs/_includes/sections/download.html
Normal file
13
lib/js/extra/headjs/_includes/sections/download.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<h2>head.ready(?)</h2>
|
||||
<div class="text-c">
|
||||
<div class="group" style="max-width: 350px; margin: 0 auto">
|
||||
<div class="float-l">
|
||||
<h2>Api Documentation</h2>
|
||||
<a href="/site/documentation.html" title="Read the docs"><img alt="Documentation" src="/site/assets/img/docs.png" width="128" height="128" /></a>
|
||||
</div>
|
||||
<div class="float-r download">
|
||||
<h2>Download</h2>
|
||||
<a href="/site/download.html" title="Download HeadJS"><img alt="Download" src="/site/assets/img/download.png" width="128" height="128" /></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
24
lib/js/extra/headjs/_includes/sections/featured.html
Normal file
24
lib/js/extra/headjs/_includes/sections/featured.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<div class=" " style="background-color: #dedede">
|
||||
<div class="container" style="padding: 10px;">
|
||||
<div class="group">
|
||||
<h2 class="float-l">Featured On</h2>
|
||||
<h2 class="float-r">
|
||||
<script type="IN/Share"></script>
|
||||
<a href="https://twitter.com/share" class="twitter-share-button" data-via="headjs" data-count="none">Tweet</a>
|
||||
<span class="g-plusone" data-size="medium" data-href="http://headjs.com" data-count="false"></span>
|
||||
</h2>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="text-c">
|
||||
<p class="featured">
|
||||
<a href="http://net.tutsplus.com/articles/web-roundups/for-your-script-loading-needs/" target="_blank" title="For Your Script Loading Needs"><img src="/site/assets/img/featured/net.tutsplus.com-small.png" height="35" width="116" alt="For Your Script Loading Needs" /></a>
|
||||
<a href="http://www.webappers.com/2010/12/01/head-js-speeds-up-simplifies-modernizes-your-site" target="_blank" title="Head JS Speeds Up, Simplifies & Modernizes Your Site"><img src="/site/assets/img/featured/webappers.com-small.png" height="35" width="200" alt="Head JS Speeds Up, Simplifies & Modernizes Your Site" /></a>
|
||||
<a href="http://coding.smashingmagazine.com/2011/06/10/useful-html-css-and-javascript-tools-and-libraries" target="_blank" title="Useful HTML-, CSS- and JavaScript Tools and Libraries"><img src="/site/assets/img/featured/smashingmagazine.com-small.png" height="35" width="135" alt="Useful HTML-, CSS- and JavaScript Tools and Libraries"/></a>
|
||||
<a href="http://www.smashingapps.com/2011/01/27/13-most-robust-wordpress-plugins-to-speed-up-your-blogs-loading-time.html" target="_blank" title="13 Most Robust WordPress Plugins To Speed Up Your Blog’s Loading Time"><img src="/site/assets/img/featured/smashing-apps.com-small.png" height="35" width="81" alt="13 Most Robust WordPress Plugins To Speed Up Your Blog’s Loading Time"/></a>
|
||||
<a href="http://www.creativebloq.com/javascript/essential-javascript-top-five-script-loaders-8122862" target="_blank" title="Essential JavaScript: the top five script loaders"><img src="/site/assets/img/featured/creativebloq.com-small.png" height="35" width="35" alt="Essential JavaScript: the top five script loaders"/></a>
|
||||
<a href="http://www.noupe.com/javascript/javascript-turbo-head-js-speeds-up-your-website-73078.html" target="_blank" title="JavaScript-Turbo: Head.js Speeds Up Your Website"><img src="/site/assets/img/featured/noupe.com-small.png" height="35" width="115" alt="JavaScript-Turbo: Head.js Speeds Up Your Website" /></a>
|
||||
<a href="http://speckyboy.com/2011/09/28/40-new-jquery-plugins" target="_blank" title="40 New jQuery Plugins"><img src="/site/assets/img/featured/speckyboy.com-small.png" height="35" width="100" alt="40 New jQuery Plugins"/></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
57
lib/js/extra/headjs/_includes/sections/footer.html
Normal file
57
lib/js/extra/headjs/_includes/sections/footer.html
Normal file
|
@ -0,0 +1,57 @@
|
|||
<div style="background-color: #2f2f2f; color: white" role="complementary">
|
||||
<div class="container" style="padding: 0 0 15px 5px;">
|
||||
<div class="group">
|
||||
<div class="group float-l authors">
|
||||
|
||||
<div itemscope="itemscope" itemtype="http://schema.org/Person" class="group float-l">
|
||||
<h3>Created by</h3>
|
||||
<img class="float-l" style="border-radius: 30px" alt="Tero Piirainen" src="https://secure.gravatar.com/avatar/a0bdf41fad9763f3e6ae7394c2b22ae9?s=40"/>
|
||||
<div class="float-r" style="padding: 0 0 0 5px">
|
||||
<a href="https://plus.google.com/115630295536677299145" target="_blank" itemprop="url"><strong itemprop="name">Tero Piirainen</strong></a>
|
||||
<br/>
|
||||
<a href="https://twitter.com/jquerytools">@jquerytools</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div itemscope="itemscope" itemtype="http://schema.org/Person" class="group float-l">
|
||||
<h3>Lead Developer</h3>
|
||||
<a href="http://www.linkedin.com/in/hoffmannrobert" target="_blank"><img class="float-l" style="border-radius: 30px" alt="Robert Hoffmann" src="https://secure.gravatar.com/avatar/a38aea3330d0aafc2c735d2b4e2e0dd5?s=40"/></a>
|
||||
<div class="float-r" style="padding: 0 0 0 5px">
|
||||
<a href="https://google.com/+RobertHoffmann" target="_blank" itemprop="url"><strong itemprop="name">Robert Hoffmann</strong></a>
|
||||
<br/>
|
||||
<a href="https://twitter.com/itechnologynet">@itechnology</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="float-r equidistant-social">
|
||||
<div class="text-c">
|
||||
<h3>Twitter Talk</h3>
|
||||
<a href="http://twitter.com/search?q=headjs" target="_blank" class="sprite social twitter mobile-hidden"></a>
|
||||
<a href="http://mobile.twitter.com/search?q=headjs" target="_blank" class="sprite social twitter mobile-visible"></a>
|
||||
</div>
|
||||
|
||||
<div class="text-c">
|
||||
<h3>Feature Requests</h3>
|
||||
<a href="http://headjs.uservoice.com" target="_blank" class="sprite social uservoice"></a>
|
||||
</div>
|
||||
|
||||
<div class="text-c">
|
||||
<h3>Community Support</h3>
|
||||
<a href="http://stackoverflow.com/questions/tagged/head.js?sort=newest" target="_blank" class="sprite social stackoverflow"></a>
|
||||
</div>
|
||||
|
||||
<div class="text-c">
|
||||
<h3>Bug Reports</h3>
|
||||
<a href="https://github.com/headjs/headjs/issues" target="_blank" class="sprite social github"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="background-color: black; color: white;" role="contentinfo">
|
||||
<div class="container" style="padding: 10px;">
|
||||
Copyright © 2010—2014. HeadJS is available under the <a href="http://opensource.org/licenses/MIT" target="_blank">MIT License</a>. This site is powered by: HeadJS, <a href="http://github.com" target="_blank">Github</a> & <a href="http://jekyllrb.com" target="_blank">Jekyll</a>
|
||||
</div>
|
||||
</div>
|
13
lib/js/extra/headjs/_includes/sections/menu.html
Normal file
13
lib/js/extra/headjs/_includes/sections/menu.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<div style="background-color: #2F2F2F; color: white;">
|
||||
<a class="flattr" href="https://flattr.com/submit/auto?user_id=HeadJS&url=http%3A%2F%2Fheadjs.com" target="_blank"><img src="//api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0"></a>
|
||||
<div class="container">
|
||||
<ul class="menu group text-c" style="padding: 10px;" role="navigation">
|
||||
<li class="home"><a href="/">Home</a></li>
|
||||
<li class="blog"><a href="/site/blog.html">Blog</a></li>
|
||||
<li class="api"><a href="/site/documentation.html">Api</a></li>
|
||||
<li class="unit"><a href="/site/unit.html">Unit Tests</a></li>
|
||||
<li class="download"><a href="/site/download.html">Download</a></li>
|
||||
<li class="resources"><a href="/site/resources.html">Resources</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
4
lib/js/extra/headjs/_layouts/blog.html
Normal file
4
lib/js/extra/headjs/_layouts/blog.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
layout: main
|
||||
---
|
||||
{{ content }}
|
116
lib/js/extra/headjs/_layouts/main.html
Normal file
116
lib/js/extra/headjs/_layouts/main.html
Normal file
|
@ -0,0 +1,116 @@
|
|||
<!doctype html>
|
||||
<html class="no-js" itemscope="itemscope" itemtype="http://schema.org/WebApplication" lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>{{ page.title }}</title>
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta http-equiv="cleartype" content="on" />
|
||||
|
||||
<meta name="description" content="Load scripts and stylesheets on demand. Achieve responsive design with CSS that targets different screen resolutions, paths, states and browsers. Detect various browsers and their features. Target HTML5 and CSS3 safely." />
|
||||
<meta itemprop="keywords" name="keywords" content="loader,polyfill,feature detection,responsive design,css3,html5" />
|
||||
|
||||
<!-- Google -->
|
||||
<meta name="google-site-verification" content="pqzn85yrum0AY6ugIrX0zoIEazSHL9p09us5yvHwZqw" />
|
||||
<meta itemprop="softwareVersion" content="{{site.head.minor}}" />
|
||||
<meta itemprop="releaseNotes" content="https://raw.github.com/headjs/headjs/master/src/{{site.head.major}}/changelog.txt" />
|
||||
<meta itemprop="fileFormat" content="application/javascript" />
|
||||
<meta itemprop="image" content="http://headjs.com/site/assets/img/logos/logo.png" />
|
||||
<meta itemprop="thumbnailUrl" content="http://headjs.com/favicon.png" />
|
||||
<meta itemprop="isFamilyFriendly" content="true" />
|
||||
|
||||
<!-- Facebook -->
|
||||
<meta property="og:title" content="HeadJS, The only script in your <HEAD>"/>
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="http://headjs.com" />
|
||||
<meta property="og:image" content="http://headjs.com/site/assets/img/logos/logo.png" />
|
||||
<meta property="og:site_name" content="Head JS" />
|
||||
<meta property="og:description" content="Load scripts and stylesheets on demand. Achieve responsive design with CSS that targets different screen resolutions, paths, states and browsers. Detect various browsers and their features. Target HTML5 and CSS3 safely." />
|
||||
<meta property="og:locale" content="en_US"/>
|
||||
|
||||
<!-- Twitter -->
|
||||
<meta name="twitter:card" content="summary" />
|
||||
<meta name="twitter:title" content="HeadJS, The only script in your <HEAD>"/>
|
||||
<meta name="twitter:description" content="Load scripts and stylesheets on demand. Achieve responsive design with CSS that targets different screen resolutions, paths, states and browsers. Detect various browsers and their features. Target HTML5 and CSS3 safely." />
|
||||
<meta name="twitter:image" content="http://headjs.com/site/assets/img/logos/logo.png" />
|
||||
<meta name="twitter:url" content="http://headjs.com" />
|
||||
|
||||
<meta name="application-name" content="HeadJS"/>
|
||||
<meta name="msapplication-TileColor" content="#000000" />
|
||||
<meta name="msapplication-square150x150logo" content="/site/assets/img/logos/logo.png" />
|
||||
|
||||
<link rel="author" href="https://plus.google.com/110321962486563701655" />
|
||||
<link rel="apple-touch-icon" href="/site/assets/img/logos/logo.png" />
|
||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/site/assets/css/normalize.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/site/assets/css/syntax.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/site/assets/css/common.min.css" />
|
||||
|
||||
<script src="/dist/1.0.0/head.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<span itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer"><meta itemprop="price" content="0.00"/></span>
|
||||
<!-- ..maybe maybe not
|
||||
<span itemprop="aggregateRating" itemscope="itemscope" itemtype="http://schema.org/AggregateRating"><meta itemprop="ratingValue" content="4.8" /></span>
|
||||
-->
|
||||
<div class="absolute left hide-1280" style="left: 10px; top: 75px;">
|
||||
<a href="/"><img src="/site/assets/img/logos/logo.png" alt="HeadJS" height="124" width="124" /></a>
|
||||
|
||||
<div style="height: 300px; overflow: hidden; width: 200px; white-space:nowrap">
|
||||
<h3>Latest News</h3>
|
||||
{% for post in site.posts %}
|
||||
<p>
|
||||
<em>{{ post.date | date_to_string }}</em><br />
|
||||
* <a href="{{ post.url }}">{{ post.title }}</a>
|
||||
</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<img src="/site/assets/img/social/html5-css3-gray.png" alt="HTML5 & CSS3" height="100" width="164" class="absolute hide-1440" style="top: 75px; right: 45px" />
|
||||
|
||||
<a href="http://github.com/headjs/headjs" onclick="trackPageView('github.com')" class="github-fork" target="_blank">
|
||||
<img alt="Fork me on GitHub" src="/site/assets/img/forkme.png" width="149" height="149" />
|
||||
</a>
|
||||
|
||||
{% include sections/menu.html %}
|
||||
|
||||
<div class="container tagline hide-640" style="background-color: white">
|
||||
<div class="group" style="text-align: left; border-radius: 5px 5px 5px 5px; color: white; background-color: #767676; background: linear-gradient(to bottom, #767676 0%, #000000 100%) repeat scroll 0 0 transparent; padding: 10px">
|
||||
<div class="float-l">
|
||||
<h1 itemprop="name" style="font-size: 3em; margin: 0 45px 0 0">HeadJS</h1>
|
||||
<strong>v{{site.head.minor}}</strong>
|
||||
</div>
|
||||
<div class="float-l">
|
||||
<h2>The only script in your <HEAD></h2>
|
||||
<h3>A tiny script, to simplify, speed up, and modernize your site !</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container main" role="main">
|
||||
<div style="padding: 10px; min-height: 700px;">
|
||||
|
||||
{{ content }}
|
||||
|
||||
<a href="#" class="up">Top</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include sections/featured.html %}
|
||||
|
||||
<!-- Contact Bar -->
|
||||
{% include sections/footer.html %}
|
||||
|
||||
{% include scripts/analytics.html %}
|
||||
<script src="//platform.linkedin.com/in.js" defer></script>
|
||||
<script src="//platform.twitter.com/widgets.js" defer></script>
|
||||
<script src="//apis.google.com/js/plusone.js" defer></script>
|
||||
|
||||
{% for item in page.scripts %}
|
||||
<script src="{{ item }}"></script>
|
||||
{% endfor %}
|
||||
</body>
|
||||
</html>
|
32
lib/js/extra/headjs/_posts/2013-05-20-Migrating-to-Jekyll.md
Normal file
32
lib/js/extra/headjs/_posts/2013-05-20-Migrating-to-Jekyll.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
layout: main
|
||||
title: Migrating to Jekyll
|
||||
excerpt: Now testing Jekyll for static stite generation, including blog & comments
|
||||
scripts: ["/site/assets/libs/jquery/jquery.min.js", "https://cdn.moot.it/latest/moot.min.js", "/site/assets/js/comments.min.js"]
|
||||
---
|
||||
|
||||
#{{ page.title }} ({{ page.date | date_to_string }})
|
||||
|
||||
<hr />
|
||||
|
||||
If you are reading this, then you found the new site :)
|
||||
|
||||
This site is in full migration, so don't take heed of any content you may come across
|
||||
..chances are things are incomplete or mixed up.
|
||||
|
||||
But feel free to look around, some nice features are comming up.
|
||||
|
||||
* Migrating to [Jekyll](http://jekyllrb.com) engine for site generation
|
||||
- logical layouts
|
||||
- post generation
|
||||
- static content generation
|
||||
* Testing HeadJS v2.0
|
||||
* Comments integration with [moot.it](http://moot.it)
|
||||
* project on which the original creator of HeadJS now works on
|
||||
* check it out, it's pretty cool (beta)
|
||||
|
||||
|
||||
<div onclick="blog.loadComments(this, 'posts/2013/may', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
<div id="moot"> </div>
|
|
@ -0,0 +1,67 @@
|
|||
---
|
||||
layout: main
|
||||
title: HeadJS v1.0.0 Released
|
||||
excerpt: Yes, it's finally out ! Adding a few new features, and a few fixes.
|
||||
scripts: ["/site/assets/libs/jquery/jquery.min.js", "https://cdn.moot.it/latest/moot.min.js", "/site/assets/js/comments.min.js"]
|
||||
---
|
||||
|
||||
#{{ page.title }} ({{ page.date | date_to_string }})
|
||||
|
||||
<hr />
|
||||
|
||||
It's finally time for a v1 release !
|
||||
|
||||
First let me say that this release is way past due, so thank's to all that reported features requests and bugs to the issue tracker !
|
||||
|
||||
Also, no fear, this release is drop in compatible with previous versions.
|
||||
|
||||
So what's changed in v1 ?
|
||||
|
||||
- New: Detect Windows 8 Mobile (Surface RT/Pro), IE11, Kindle, and other Android devices
|
||||
- New: Add Browser & Version CSS no matter what browser breakpoints are configured
|
||||
- Example: .ff .ff20
|
||||
- There is no need to cycle through all browser versions in 90% of cases
|
||||
- Makes it possible to work without any breakpoints at all
|
||||
- New: Improved CSS Router
|
||||
- View: [https://github.com/headjs/headjs/issues/227](https://github.com/headjs/headjs/issues/227)
|
||||
- New: Added "main" HTML5 element to shim
|
||||
- View on Github
|
||||
- [https://github.com/headjs/headjs/pull/230](https://github.com/headjs/headjs/pull/230)
|
||||
- New: Enable/Disable HTML5 Shim in head_conf
|
||||
- New: Load files from Array of Files or Array of Labels
|
||||
- ``head.load(["file1", "file2"], callBack);``
|
||||
- ``head.load([{ label1: "file1" }, { label2: "file2" }], callBack);``
|
||||
- [https://github.com/headjs/headjs/issues/139](https://github.com/headjs/headjs/issues/139)
|
||||
- New: Possibility to wait for multiple labels or files
|
||||
- ``head.ready(["label1", "label2"], callBack);``
|
||||
- ``head.ready(["file1.js", "file2.js"], callBack);``
|
||||
- [https://github.com/headjs/headjs/pull/212](https://github.com/headjs/headjs/pull/212)
|
||||
- New: Load file via data attribute on HeadJS script tag
|
||||
- ``<script src="head.min.js" data-headjs-load="configuration.js"></script>``
|
||||
- [https://github.com/headjs/headjs/pull/213](https://github.com/headjs/headjs/pull/213)
|
||||
- New: Source map files have been added for all minified JS files
|
||||
- Fix: Prevent loading empty strings
|
||||
- View on Github
|
||||
- [https://github.com/headjs/headjs/pull/184](https://github.com/headjs/headjs/pull/184)
|
||||
- Fix: CSS classes getting bigger on successive resizes under Chrome
|
||||
- View on Github
|
||||
- [https://github.com/headjs/headjs/issues/226](https://github.com/headjs/headjs/issues/226)
|
||||
- Fix: Invalid regular expression for CSS detection
|
||||
- View on Github
|
||||
- [https://github.com/headjs/headjs/issues/255](https://github.com/headjs/headjs/issues/255)
|
||||
- Fix: callback failing to trigger under certain cirumstances
|
||||
- View on Github
|
||||
- [https://github.com/headjs/headjs/issues/262](https://github.com/headjs/headjs/issues/262)
|
||||
- Divers: Changed window.frameElement detection
|
||||
- View on Github
|
||||
- [https://github.com/headjs/headjs/pull/257](https://github.com/headjs/headjs/pull/257)
|
||||
- Divers: Cleaned up a bunch of syntaxt to conform to JSHint
|
||||
- Easier to find quirks
|
||||
- Now using a very strict .jshintrc
|
||||
- Divers: Added missing .gitattributes
|
||||
|
||||
|
||||
<div onclick="blog.loadComments(this, 'posts/release/1.0.0', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
<div id="moot"> </div>
|
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
layout: main
|
||||
title: HeadJS v1.0.1 Update
|
||||
excerpt: Small point release to patch a bug that had a fix but got missed
|
||||
scripts: ["/site/assets/libs/jquery/jquery.min.js", "https://cdn.moot.it/latest/moot.min.js", "/site/assets/js/comments.min.js"]
|
||||
---
|
||||
|
||||
#{{ page.title }} ({{ page.date | date_to_string }})
|
||||
|
||||
<hr />
|
||||
|
||||
A small point release that patches a long-standing problem with older IE versions. Browsers that don't support async loading could potentially trigger the callback before the loading of the resources was done.
|
||||
|
||||
- Fix: Old IE's can trigger ready too soon
|
||||
- This fix was on Github but inclusion got missed
|
||||
- [https://github.com/headjs/headjs/issues/203](https://github.com/headjs/headjs/issues/203)
|
||||
|
||||
<div onclick="blog.loadComments(this, 'posts/release/1.0.1', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
<div id="moot"> </div>
|
|
@ -0,0 +1,44 @@
|
|||
---
|
||||
layout: main
|
||||
title: Head.Responsive() v2.0.0-alpha
|
||||
excerpt: Getting things ready for 2.0, and looking for feedback
|
||||
scripts: ["/site/assets/libs/jquery/jquery.min.js", "https://cdn.moot.it/latest/moot.min.js", "/site/assets/js/comments.min.js"]
|
||||
---
|
||||
|
||||
#{{ page.title }} ({{ page.date | date_to_string }})
|
||||
|
||||
<hr />
|
||||
|
||||
v2.0 is gearing up and getting ready for prime-time.
|
||||
|
||||
Currently playing with the new head.responsive() which will add a few things like
|
||||
|
||||
- height/width breakpoints
|
||||
- hashtag handling (same as page/section handling)
|
||||
- event handling (to subscribe to UI & feature detect changes)
|
||||
|
||||
Not everything is ready, and even, there is a need for some feedback on how certain things are done. Please have a look here, play with it, look at the souce and then come provide some feedback. Thanks !
|
||||
|
||||
- This way --->
|
||||
- [Test Page](/src/2.0.0/tests/responsive.html)
|
||||
- [FeedBack](https://github.com/headjs/headjs/issues/269)
|
||||
|
||||
<br/><br/>
|
||||
<hr style="border: thin dashed" />
|
||||
|
||||
P.S. The HeadJS site has been revamped to be more dynamic and more easily updateable. However i'm not a designer and as far as typographical choices etc go ..the site could use some Designer Luv !
|
||||
|
||||
I'd like to keep the current layout (more or less), but typo, color-scheme, ergonomics, and flat design revamps are very welcome.
|
||||
|
||||
If you have some Designer Luv to spread ...bring it on !
|
||||
|
||||
- Some designs i really like (though maybe overkill)
|
||||
- [Cassiopeia](http://themes.roussounelosweb.gr/cassiopeia)
|
||||
- [Moot](https://moot.it/)
|
||||
- Globally the bootstrap style: gray, black, white, or monochromatic with color highlights and large header/footer bars
|
||||
|
||||
|
||||
<div onclick="blog.loadComments(this, 'posts/responsive/2.0.0-alpha', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
<div id="moot"> </div>
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
layout: main
|
||||
title: HeadJS v1.0.2 Update
|
||||
excerpt: Small point release
|
||||
scripts: ["/site/assets/libs/jquery/jquery.min.js", "https://cdn.moot.it/latest/moot.min.js", "/site/assets/js/comments.min.js"]
|
||||
---
|
||||
|
||||
#{{ page.title }} ({{ page.date | date_to_string }})
|
||||
|
||||
<hr />
|
||||
|
||||
A small path release that fixes a reversion where the no-js class was not removed when js was detected. This was caused by a fix that corrects css classes getting bigger with time under Google Chrome. This patch fixes both issues permanently.
|
||||
|
||||
- Fix: no-js class not being removed
|
||||
- View
|
||||
- [https://github.com/headjs/headjs/issues/270](https://github.com/headjs/headjs/issues/270)
|
||||
|
||||
|
||||
<div onclick="blog.loadComments(this, 'posts/release/1.0.2', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
<div id="moot"> </div>
|
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
layout: main
|
||||
title: HeadJS v1.0.3 Update
|
||||
excerpt: Small point release
|
||||
scripts: ["/site/assets/libs/jquery/jquery.min.js", "https://cdn.moot.it/latest/moot.min.js", "/site/assets/js/comments.min.js"]
|
||||
---
|
||||
|
||||
#{{ page.title }} ({{ page.date | date_to_string }})
|
||||
|
||||
<hr />
|
||||
|
||||
Small but __very__ important update that fixes issues with older browser when loading via Arrays, or using and Array of labels with .ready().
|
||||
|
||||
Callbacks now work properly with CSS, a patch was added thank's to [xhaggi](https://github.com/xhaggi), which makes this possible.
|
||||
An error timeout was also added ..while it's not yet possible to use this timeout to take other actions, it at least assures that callbacks are always fired.
|
||||
Detecting CSS files when using load is much sturdier. We still can't tell if it's a CSS file when loading a .aspx, .php ...but this will likely change soon.
|
||||
|
||||
__This will probably be the _before last_ update on the 1.x branch ..time for [2.x to advance](http://headjs.com/2013/11/08/head.responsive-v2.0.0-alpha.html) ! ;-)__
|
||||
|
||||
- New: Timeout added to resource loading
|
||||
- New: CSS callbacks now executed for all browsers
|
||||
- Details: [https://github.com/headjs/headjs/pull/273](https://github.com/headjs/headjs/pull/273)
|
||||
- New: Changed how file extensions are parsed for detecting css files
|
||||
- in the future, we will need to add a way to supply a filetype, for when loading resources via scripts like style.php
|
||||
- Fix: Array loading & trigger not functioning correctly on old browsers
|
||||
- Details: [https://github.com/headjs/headjs/issues/274](https://github.com/headjs/headjs/issues/274)
|
||||
- Fix: ready() sometimes does not trigger if assets are loaded too fast
|
||||
- Details: [https://github.com/headjs/headjs/issues/271](https://github.com/headjs/headjs/issues/271)
|
||||
|
||||
<br/><br/>
|
||||
<hr style="border: thin dashed" />
|
||||
|
||||
P.S. The HeadJS site has been revamped to be more dynamic and more easily updateable. However i'm not a designer and as far as typographical choices etc go ..the site could use some Luv !
|
||||
|
||||
I'd like to keep the current layout (more or less), but typo, color-scheme, ergonomics, and flat design revamps are very welcome.
|
||||
|
||||
If you have some Designer Luv to spread ...bring it on !
|
||||
|
||||
- Some designs i really love (though maybe overkill ..)
|
||||
- [Cassiopeia](http://themes.roussounelosweb.gr/cassiopeia)
|
||||
- [Moot](https://moot.it/)
|
||||
- And globally the bootstrap style (gray, black, white, or monochromatic with color highlights and large header/footer bars)
|
||||
|
||||
|
||||
<div onclick="blog.loadComments(this, 'posts/release/1.0.3', 'Leave a comment')" style="cursor: pointer;">
|
||||
<h2>Show Comments</h2>
|
||||
</div>
|
||||
<div id="moot"> </div>
|
31
lib/js/extra/headjs/bower.json
Normal file
31
lib/js/extra/headjs/bower.json
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "headjs",
|
||||
"description": "HeadJS: Responsive Design, Feature Detections & Asset Loading. The only script in your <HEAD>",
|
||||
"version": "1.0.3",
|
||||
"license" : "MIT",
|
||||
"authors": [
|
||||
{"name": "Tero Piirainen"},
|
||||
{"name": "Robert Hoffmann"}
|
||||
],
|
||||
"homepage " : "http://headjs.com",
|
||||
"main" : ["./dist/1.0.0/head.min.js","./dist/1.0.0/head.min.js.map","./dist/1.0.0/changelog.txt"],
|
||||
"ignore": [
|
||||
"**",
|
||||
"!/dist/1.0.0/*.js",
|
||||
"!/dist/1.0.0/*.map",
|
||||
"!/dist/1.0.0/*.txt"
|
||||
],
|
||||
"directory": "public/scripts",
|
||||
"repository": {
|
||||
"type": "git", "url": "git://github.com/headjs/headjs.git"
|
||||
},
|
||||
"keywords": [
|
||||
"loader",
|
||||
"require",
|
||||
"polyfill",
|
||||
"html5",
|
||||
"css3",
|
||||
"feature",
|
||||
"responsive"
|
||||
]
|
||||
}
|
17
lib/js/extra/headjs/dist/0.97a/README.md
vendored
Normal file
17
lib/js/extra/headjs/dist/0.97a/README.md
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
#Prepackaged Files
|
||||
|
||||
###head.js / head.min.js
|
||||
|
||||
- Complete package containing: core.js, css3.js, and load.js
|
||||
|
||||
###head.css3.js / head.css3.min.js
|
||||
|
||||
- Package containing: core.js and css3.js
|
||||
|
||||
###head.core.js / head.core.min.js
|
||||
|
||||
- Package containing only core.js
|
||||
|
||||
###head.load.js / head.load.min.js
|
||||
|
||||
- Package containing only load.js
|
13
lib/js/extra/headjs/dist/0.97a/changelog.txt
vendored
Normal file
13
lib/js/extra/headjs/dist/0.97a/changelog.txt
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
0.97a (2012-10-20)
|
||||
- Updated QUnit & got unit tests running again
|
||||
- Swictched to "use strict"
|
||||
- Fixed up some variable usage
|
||||
- Added browser detections other than just for ie-lt
|
||||
- updated browser regexes (firefox, safari, opera, ios, android, webkit)
|
||||
- detect if browser is: desktop, mobile, touch enabled
|
||||
- detect portrait/landscape mode
|
||||
- html5 shim now only triggers on ie-lt9
|
||||
- added a throttle to onResize, since some browsers fire tons of events/sec
|
||||
- added corrected height/width measurements, but only exposed via new object: head.screen
|
||||
- contains height/width, innerHeight/innerWidth, outerHeight/outerWidth
|
||||
- force all css router names to lowercase just in case ppl try typing in names with wierd casings
|
276
lib/js/extra/headjs/dist/0.97a/head.core.js
vendored
Normal file
276
lib/js/extra/headjs/dist/0.97a/head.core.js
vendored
Normal file
|
@ -0,0 +1,276 @@
|
|||
/**!
|
||||
Head JS The only script in your <HEAD>
|
||||
Copyright Tero Piirainen (tipiirai)
|
||||
License MIT / http://bit.ly/mit-license
|
||||
Version 0.97a
|
||||
|
||||
http://headjs.com
|
||||
*/
|
||||
; (function (win, undefined) {
|
||||
"use strict";
|
||||
|
||||
var doc = win.document,
|
||||
nav = win.navigator,
|
||||
loc = win.location,
|
||||
html = doc.documentElement,
|
||||
klass = [],
|
||||
conf = {
|
||||
screens: [320, 480, 640, 768, 1024, 1280, 1440, 1680, 1920],
|
||||
section: "-section",
|
||||
page : "-page",
|
||||
head : "head"
|
||||
};
|
||||
|
||||
if (win.head_conf) {
|
||||
for (var item in win.head_conf) {
|
||||
if (win.head_conf[item] !== undefined) {
|
||||
conf[item] = win.head_conf[item];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function pushClass(name) {
|
||||
klass[klass.length] = name;
|
||||
}
|
||||
|
||||
function removeClass(name) {
|
||||
var re = new RegExp("\\b" + name + "\\b");
|
||||
html.className = html.className.replace(re, '');
|
||||
}
|
||||
|
||||
function each(arr, fn) {
|
||||
for (var i = 0, l = arr.length; i < l; i++) {
|
||||
fn.call(arr, arr[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// API
|
||||
var api = win[conf.head] = function () {
|
||||
api.ready.apply(null, arguments);
|
||||
};
|
||||
|
||||
api.feature = function (key, enabled, queue) {
|
||||
|
||||
// internal: apply all classes
|
||||
if (!key) {
|
||||
html.className += ' ' + klass.join(' ');
|
||||
klass = [];
|
||||
return api;
|
||||
}
|
||||
|
||||
if (Object.prototype.toString.call(enabled) === '[object Function]') {
|
||||
enabled = enabled.call();
|
||||
}
|
||||
|
||||
pushClass((enabled ? '' : 'no-') + key);
|
||||
api[key] = !!enabled;
|
||||
|
||||
// apply class to HTML element
|
||||
if (!queue) {
|
||||
removeClass('no-' + key);
|
||||
removeClass(key);
|
||||
api.feature();
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
// no queue here, so we can remove any eventual pre-existing no-js class
|
||||
api.feature("js", true);
|
||||
|
||||
// browser type & version
|
||||
var ua = nav.userAgent.toLowerCase(),
|
||||
mobile = /mobile|midp/.test(ua);
|
||||
|
||||
// useful for enabling/disabling feature (we can consider a desktop navigator to have more cpu/gpu power)
|
||||
api.feature("mobile" , mobile , true);
|
||||
api.feature("desktop", !mobile, true);
|
||||
api.feature("touch" , 'ontouchstart' in win, true);
|
||||
|
||||
// http://www.zytrax.com/tech/web/browser_ids.htm
|
||||
// http://www.zytrax.com/tech/web/mobile_ids.html
|
||||
ua = /(chrome|firefox)[ \/]([\w.]+)/.exec(ua) || // Chrome & Firefox
|
||||
/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile IOS
|
||||
/(android)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile Webkit
|
||||
/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Safari & Opera
|
||||
/(msie) ([\w.]+)/.exec(ua) || [];
|
||||
|
||||
|
||||
var browser = ua[1],
|
||||
version = parseFloat(ua[2]),
|
||||
start = 0,
|
||||
stop = 0;
|
||||
|
||||
switch (browser) {
|
||||
case 'msie':
|
||||
browser = 'ie';
|
||||
version = doc.documentMode || version;
|
||||
|
||||
start = 6;
|
||||
stop = 10;
|
||||
break;
|
||||
|
||||
// Add/remove extra tests here
|
||||
case 'chrome':
|
||||
start = 8;
|
||||
stop = 22;
|
||||
break;
|
||||
|
||||
case 'firefox':
|
||||
browser = 'ff';
|
||||
|
||||
start = 3;
|
||||
stop = 17;
|
||||
break;
|
||||
|
||||
case 'ipod':
|
||||
case 'ipad':
|
||||
case 'iphone':
|
||||
browser = 'ios';
|
||||
|
||||
start = 3;
|
||||
stop = 6;
|
||||
break;
|
||||
|
||||
case 'android':
|
||||
start = 2;
|
||||
stop = 4;
|
||||
break;
|
||||
|
||||
case 'webkit':
|
||||
browser = 'safari';
|
||||
|
||||
start = 9;
|
||||
stop = 12;
|
||||
break;
|
||||
|
||||
case 'opera':
|
||||
start = 9;
|
||||
stop = 12;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// name can be used further on for various tasks, like font-face detection in css3.js
|
||||
api.browser = {
|
||||
name : browser,
|
||||
version: version
|
||||
};
|
||||
api.browser[browser] = true;
|
||||
|
||||
|
||||
// add supported, not supported classes
|
||||
var supported = ['ie'];
|
||||
//var supported = ['ie', 'chrome', 'ff', 'ios', 'android', 'safari', 'opera'];
|
||||
each(supported, function (name) {
|
||||
if (name === browser) {
|
||||
pushClass(name);
|
||||
}
|
||||
else {
|
||||
pushClass("no-" + name);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
for (var v = start; v <= stop; v++) {
|
||||
if (version < v) {
|
||||
pushClass("lt-" + browser + v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// IE lt9 specific
|
||||
if (browser === "ie" && version < 9) {
|
||||
// HTML5 support : you still need to add html5 css initialization styles to your site
|
||||
// See: assets/html5.css
|
||||
each("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"), function (el) {
|
||||
doc.createElement(el);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// CSS "router"
|
||||
each(loc.pathname.split("/"), function (el, i) {
|
||||
if (this.length > 2 && this[i + 1] !== undefined) {
|
||||
if (i) {
|
||||
pushClass(this.slice(1, i + 1).join("-").toLowerCase() + conf.section);
|
||||
}
|
||||
} else {
|
||||
// pageId
|
||||
var id = el || "index", index = id.indexOf(".");
|
||||
if (index > 0) {
|
||||
id = id.substring(0, index);
|
||||
}
|
||||
|
||||
html.id = id.toLowerCase() + conf.page;
|
||||
|
||||
// on root?
|
||||
if (!i) {
|
||||
pushClass("root" + conf.section);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// basic screen info
|
||||
api.screen = {
|
||||
height: win.screen.height,
|
||||
width : win.screen.width
|
||||
};
|
||||
|
||||
// screen resolution: w-100, lt-480, lt-1024 ...
|
||||
function screenSize() {
|
||||
// Viewport width
|
||||
var iw = win.innerWidth || html.clientWidth,
|
||||
ow = win.outerWidth || win.screen.width;
|
||||
|
||||
api.screen['innerWidth'] = iw;
|
||||
api.screen['outerWidth'] = ow;
|
||||
|
||||
|
||||
// START old code
|
||||
var w = win.outerWidth || html.clientWidth;
|
||||
|
||||
// remove earlier widths
|
||||
html.className = html.className.replace(/ (w|lt|portrait|no-portrait|landscape|no-landscape)-\d+/g, "");
|
||||
|
||||
// add new ones
|
||||
pushClass("w-" + Math.round(w / 100) * 100);
|
||||
|
||||
each(conf.screens, function (width) {
|
||||
if (w <= width) {
|
||||
pushClass("lt-" + width);
|
||||
}
|
||||
});
|
||||
// END old code
|
||||
|
||||
// Viewport height
|
||||
var ih = win.innerHeight || html.clientHeight,
|
||||
oh = win.outerHeight || win.screen.height;
|
||||
|
||||
api.screen['innerHeight'] = ih;
|
||||
api.screen['outerHeight'] = oh;
|
||||
|
||||
// no need for onChange event to detect this
|
||||
api.feature("portrait" , (ih > iw));
|
||||
api.feature("landscape", (ih < iw));
|
||||
}
|
||||
|
||||
screenSize();
|
||||
|
||||
// Throttle navigators from triggering too many resize events
|
||||
var resizeId = 0;
|
||||
function onResize() {
|
||||
win.clearTimeout(resizeId);
|
||||
resizeId = win.setTimeout(screenSize, 100);
|
||||
}
|
||||
|
||||
// Manually attach, as to not overwrite existing handler
|
||||
if (win.addEventListener) {
|
||||
win.addEventListener("resize", onResize, false);
|
||||
|
||||
} else {
|
||||
win.attachEvent("onresize", onResize);
|
||||
}
|
||||
})(window);
|
||||
|
1
lib/js/extra/headjs/dist/0.97a/head.core.min.js
vendored
Normal file
1
lib/js/extra/headjs/dist/0.97a/head.core.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
(function(e,t){"use strict";function f(e){o[o.length]=e}function l(e){var t=new RegExp("\\b"+e+"\\b");s.className=s.className.replace(t,"")}function c(e,t){for(var n=0,r=e.length;n<r;n++)t.call(e,e[n],n)}function E(){var t=e.innerWidth||s.clientWidth,n=e.outerWidth||e.screen.width;h.screen.innerWidth=t,h.screen.outerWidth=n;var r=e.outerWidth||s.clientWidth;s.className=s.className.replace(/ (w|lt|portrait|no-portrait|landscape|no-landscape)-\d+/g,""),f("w-"+Math.round(r/100)*100),c(u.screens,function(e){r<=e&&f("lt-"+e)});var i=e.innerHeight||s.clientHeight,o=e.outerHeight||e.screen.height;h.screen.innerHeight=i,h.screen.outerHeight=o,h.feature("portrait",i>t),h.feature("landscape",i<t)}function x(){e.clearTimeout(S),S=e.setTimeout(E,100)}var n=e.document,r=e.navigator,i=e.location,s=n.documentElement,o=[],u={screens:[320,480,640,768,1024,1280,1440,1680,1920],section:"-section",page:"-page",head:"head"};if(e.head_conf)for(var a in e.head_conf)e.head_conf[a]!==t&&(u[a]=e.head_conf[a]);var h=e[u.head]=function(){h.ready.apply(null,arguments)};h.feature=function(e,t,n){return e?(Object.prototype.toString.call(t)==="[object Function]"&&(t=t.call()),f((t?"":"no-")+e),h[e]=!!t,n||(l("no-"+e),l(e),h.feature()),h):(s.className+=" "+o.join(" "),o=[],h)},h.feature("js",!0);var p=r.userAgent.toLowerCase(),d=/mobile|midp/.test(p);h.feature("mobile",d,!0),h.feature("desktop",!d,!0),h.feature("touch","ontouchstart"in e,!0),p=/(chrome|firefox)[ \/]([\w.]+)/.exec(p)||/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(p)||/(android)(?:.*version)?[ \/]([\w.]+)/.exec(p)||/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(p)||/(msie) ([\w.]+)/.exec(p)||[];var v=p[1],m=parseFloat(p[2]),g=0,y=0;switch(v){case"msie":v="ie",m=n.documentMode||m,g=6,y=10;break;case"chrome":g=8,y=22;break;case"firefox":v="ff",g=3,y=17;break;case"ipod":case"ipad":case"iphone":v="ios",g=3,y=6;break;case"android":g=2,y=4;break;case"webkit":v="safari",g=9,y=12;break;case"opera":g=9,y=12}h.browser={name:v,version:m},h.browser[v]=!0;var b=["ie"];c(b,function(e){e===v?f(e):f("no-"+e)});for(var w=g;w<=y;w++)m<w&&f("lt-"+v+w);v==="ie"&&m<9&&c("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"),function(e){n.createElement(e)}),c(i.pathname.split("/"),function(e,n){if(this.length>2&&this[n+1]!==t)n&&f(this.slice(1,n+1).join("-").toLowerCase()+u.section);else{var r=e||"index",i=r.indexOf(".");i>0&&(r=r.substring(0,i)),s.id=r.toLowerCase()+u.page,n||f("root"+u.section)}}),h.screen={height:e.screen.height,width:e.screen.width},E();var S=0;e.addEventListener?e.addEventListener("resize",x,!1):e.attachEvent("onresize",x)})(window)
|
425
lib/js/extra/headjs/dist/0.97a/head.css3.js
vendored
Normal file
425
lib/js/extra/headjs/dist/0.97a/head.css3.js
vendored
Normal file
|
@ -0,0 +1,425 @@
|
|||
/**!
|
||||
Head JS The only script in your <HEAD>
|
||||
Copyright Tero Piirainen (tipiirai)
|
||||
License MIT / http://bit.ly/mit-license
|
||||
Version 0.97a
|
||||
|
||||
http://headjs.com
|
||||
*/
|
||||
; (function (win, undefined) {
|
||||
"use strict";
|
||||
|
||||
var doc = win.document,
|
||||
nav = win.navigator,
|
||||
loc = win.location,
|
||||
html = doc.documentElement,
|
||||
klass = [],
|
||||
conf = {
|
||||
screens: [320, 480, 640, 768, 1024, 1280, 1440, 1680, 1920],
|
||||
section: "-section",
|
||||
page : "-page",
|
||||
head : "head"
|
||||
};
|
||||
|
||||
if (win.head_conf) {
|
||||
for (var item in win.head_conf) {
|
||||
if (win.head_conf[item] !== undefined) {
|
||||
conf[item] = win.head_conf[item];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function pushClass(name) {
|
||||
klass[klass.length] = name;
|
||||
}
|
||||
|
||||
function removeClass(name) {
|
||||
var re = new RegExp("\\b" + name + "\\b");
|
||||
html.className = html.className.replace(re, '');
|
||||
}
|
||||
|
||||
function each(arr, fn) {
|
||||
for (var i = 0, l = arr.length; i < l; i++) {
|
||||
fn.call(arr, arr[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// API
|
||||
var api = win[conf.head] = function () {
|
||||
api.ready.apply(null, arguments);
|
||||
};
|
||||
|
||||
api.feature = function (key, enabled, queue) {
|
||||
|
||||
// internal: apply all classes
|
||||
if (!key) {
|
||||
html.className += ' ' + klass.join(' ');
|
||||
klass = [];
|
||||
return api;
|
||||
}
|
||||
|
||||
if (Object.prototype.toString.call(enabled) === '[object Function]') {
|
||||
enabled = enabled.call();
|
||||
}
|
||||
|
||||
pushClass((enabled ? '' : 'no-') + key);
|
||||
api[key] = !!enabled;
|
||||
|
||||
// apply class to HTML element
|
||||
if (!queue) {
|
||||
removeClass('no-' + key);
|
||||
removeClass(key);
|
||||
api.feature();
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
// no queue here, so we can remove any eventual pre-existing no-js class
|
||||
api.feature("js", true);
|
||||
|
||||
// browser type & version
|
||||
var ua = nav.userAgent.toLowerCase(),
|
||||
mobile = /mobile|midp/.test(ua);
|
||||
|
||||
// useful for enabling/disabling feature (we can consider a desktop navigator to have more cpu/gpu power)
|
||||
api.feature("mobile" , mobile , true);
|
||||
api.feature("desktop", !mobile, true);
|
||||
api.feature("touch" , 'ontouchstart' in win, true);
|
||||
|
||||
// http://www.zytrax.com/tech/web/browser_ids.htm
|
||||
// http://www.zytrax.com/tech/web/mobile_ids.html
|
||||
ua = /(chrome|firefox)[ \/]([\w.]+)/.exec(ua) || // Chrome & Firefox
|
||||
/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile IOS
|
||||
/(android)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile Webkit
|
||||
/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Safari & Opera
|
||||
/(msie) ([\w.]+)/.exec(ua) || [];
|
||||
|
||||
|
||||
var browser = ua[1],
|
||||
version = parseFloat(ua[2]),
|
||||
start = 0,
|
||||
stop = 0;
|
||||
|
||||
switch (browser) {
|
||||
case 'msie':
|
||||
browser = 'ie';
|
||||
version = doc.documentMode || version;
|
||||
|
||||
start = 6;
|
||||
stop = 10;
|
||||
break;
|
||||
|
||||
// Add/remove extra tests here
|
||||
case 'chrome':
|
||||
start = 8;
|
||||
stop = 22;
|
||||
break;
|
||||
|
||||
case 'firefox':
|
||||
browser = 'ff';
|
||||
|
||||
start = 3;
|
||||
stop = 17;
|
||||
break;
|
||||
|
||||
case 'ipod':
|
||||
case 'ipad':
|
||||
case 'iphone':
|
||||
browser = 'ios';
|
||||
|
||||
start = 3;
|
||||
stop = 6;
|
||||
break;
|
||||
|
||||
case 'android':
|
||||
start = 2;
|
||||
stop = 4;
|
||||
break;
|
||||
|
||||
case 'webkit':
|
||||
browser = 'safari';
|
||||
|
||||
start = 9;
|
||||
stop = 12;
|
||||
break;
|
||||
|
||||
case 'opera':
|
||||
start = 9;
|
||||
stop = 12;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// name can be used further on for various tasks, like font-face detection in css3.js
|
||||
api.browser = {
|
||||
name : browser,
|
||||
version: version
|
||||
};
|
||||
api.browser[browser] = true;
|
||||
|
||||
|
||||
// add supported, not supported classes
|
||||
var supported = ['ie'];
|
||||
//var supported = ['ie', 'chrome', 'ff', 'ios', 'android', 'safari', 'opera'];
|
||||
each(supported, function (name) {
|
||||
if (name === browser) {
|
||||
pushClass(name);
|
||||
}
|
||||
else {
|
||||
pushClass("no-" + name);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
for (var v = start; v <= stop; v++) {
|
||||
if (version < v) {
|
||||
pushClass("lt-" + browser + v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// IE lt9 specific
|
||||
if (browser === "ie" && version < 9) {
|
||||
// HTML5 support : you still need to add html5 css initialization styles to your site
|
||||
// See: assets/html5.css
|
||||
each("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"), function (el) {
|
||||
doc.createElement(el);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// CSS "router"
|
||||
each(loc.pathname.split("/"), function (el, i) {
|
||||
if (this.length > 2 && this[i + 1] !== undefined) {
|
||||
if (i) {
|
||||
pushClass(this.slice(1, i + 1).join("-").toLowerCase() + conf.section);
|
||||
}
|
||||
} else {
|
||||
// pageId
|
||||
var id = el || "index", index = id.indexOf(".");
|
||||
if (index > 0) {
|
||||
id = id.substring(0, index);
|
||||
}
|
||||
|
||||
html.id = id.toLowerCase() + conf.page;
|
||||
|
||||
// on root?
|
||||
if (!i) {
|
||||
pushClass("root" + conf.section);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// basic screen info
|
||||
api.screen = {
|
||||
height: win.screen.height,
|
||||
width : win.screen.width
|
||||
};
|
||||
|
||||
// screen resolution: w-100, lt-480, lt-1024 ...
|
||||
function screenSize() {
|
||||
// Viewport width
|
||||
var iw = win.innerWidth || html.clientWidth,
|
||||
ow = win.outerWidth || win.screen.width;
|
||||
|
||||
api.screen['innerWidth'] = iw;
|
||||
api.screen['outerWidth'] = ow;
|
||||
|
||||
|
||||
// START old code
|
||||
var w = win.outerWidth || html.clientWidth;
|
||||
|
||||
// remove earlier widths
|
||||
html.className = html.className.replace(/ (w|lt|portrait|no-portrait|landscape|no-landscape)-\d+/g, "");
|
||||
|
||||
// add new ones
|
||||
pushClass("w-" + Math.round(w / 100) * 100);
|
||||
|
||||
each(conf.screens, function (width) {
|
||||
if (w <= width) {
|
||||
pushClass("lt-" + width);
|
||||
}
|
||||
});
|
||||
// END old code
|
||||
|
||||
// Viewport height
|
||||
var ih = win.innerHeight || html.clientHeight,
|
||||
oh = win.outerHeight || win.screen.height;
|
||||
|
||||
api.screen['innerHeight'] = ih;
|
||||
api.screen['outerHeight'] = oh;
|
||||
|
||||
// no need for onChange event to detect this
|
||||
api.feature("portrait" , (ih > iw));
|
||||
api.feature("landscape", (ih < iw));
|
||||
}
|
||||
|
||||
screenSize();
|
||||
|
||||
// Throttle navigators from triggering too many resize events
|
||||
var resizeId = 0;
|
||||
function onResize() {
|
||||
win.clearTimeout(resizeId);
|
||||
resizeId = win.setTimeout(screenSize, 100);
|
||||
}
|
||||
|
||||
// Manually attach, as to not overwrite existing handler
|
||||
if (win.addEventListener) {
|
||||
win.addEventListener("resize", onResize, false);
|
||||
|
||||
} else {
|
||||
win.attachEvent("onresize", onResize);
|
||||
}
|
||||
})(window);
|
||||
|
||||
/**
|
||||
Head JS The only script in your <HEAD>
|
||||
Copyright Tero Piirainen (tipiirai)
|
||||
License MIT / http://bit.ly/mit-license
|
||||
Version 0.97a
|
||||
|
||||
http://headjs.com
|
||||
*/
|
||||
;(function(win, undefined) {
|
||||
"use strict";
|
||||
|
||||
var doc = win.document,
|
||||
nav = win.navigator,
|
||||
|
||||
/*
|
||||
To add a new test:
|
||||
|
||||
head.feature("video", function() {
|
||||
var tag = document.createElement('video');
|
||||
return !!tag.canPlayType;
|
||||
});
|
||||
|
||||
Good place to grab more tests
|
||||
|
||||
https://github.com/Modernizr/Modernizr/blob/master/modernizr.js
|
||||
*/
|
||||
|
||||
/* CSS modernizer */
|
||||
el = doc.createElement("i"),
|
||||
style = el.style,
|
||||
prefs = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '),
|
||||
domPrefs = 'Webkit Moz O ms Khtml'.split(' '),
|
||||
|
||||
head_var = win.head_conf && win.head_conf.head || "head",
|
||||
api = win[head_var];
|
||||
|
||||
// Thanks Paul Irish!
|
||||
function testProps(props) {
|
||||
for (var i in props) {
|
||||
if (style[props[i]] !== undefined) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function testAll(prop) {
|
||||
var camel = prop.charAt(0).toUpperCase() + prop.substr(1),
|
||||
props = (prop + ' ' + domPrefs.join(camel + ' ') + camel).split(' ');
|
||||
|
||||
return !!testProps(props);
|
||||
}
|
||||
|
||||
var tests = {
|
||||
|
||||
gradient: function() {
|
||||
var s1 = 'background-image:',
|
||||
s2 = 'gradient(linear,left top,right bottom,from(#9f9),to(#fff));',
|
||||
s3 = 'linear-gradient(left top,#eee,#fff);';
|
||||
|
||||
style.cssText = (s1 + prefs.join(s2 + s1) + prefs.join(s3 + s1)).slice(0,-s1.length);
|
||||
return !!style.backgroundImage;
|
||||
},
|
||||
|
||||
rgba: function() {
|
||||
style.cssText = "background-color:rgba(0,0,0,0.5)";
|
||||
return !!style.backgroundColor;
|
||||
},
|
||||
|
||||
opacity: function() {
|
||||
return el.style.opacity === "";
|
||||
},
|
||||
|
||||
textshadow: function() {
|
||||
return style.textShadow === '';
|
||||
},
|
||||
|
||||
multiplebgs: function() {
|
||||
style.cssText = "background:url(//:),url(//:),red url(//:)";
|
||||
return new RegExp("(url\\s*\\(.*?){3}").test(style.background);
|
||||
},
|
||||
|
||||
boxshadow: function() {
|
||||
return testAll("boxShadow");
|
||||
},
|
||||
|
||||
borderimage: function() {
|
||||
return testAll("borderImage");
|
||||
},
|
||||
|
||||
borderradius: function() {
|
||||
return testAll("borderRadius");
|
||||
},
|
||||
|
||||
cssreflections: function() {
|
||||
return testAll("boxReflect");
|
||||
},
|
||||
|
||||
csstransforms: function() {
|
||||
return testAll("transform");
|
||||
},
|
||||
|
||||
csstransitions: function() {
|
||||
return testAll("transition");
|
||||
},
|
||||
|
||||
/*
|
||||
font-face support. Uses browser sniffing but is synchronous.
|
||||
|
||||
http://paulirish.com/2009/font-face-feature-detection/
|
||||
*/
|
||||
fontface: function() {
|
||||
var ua = navigator.userAgent, parsed;
|
||||
|
||||
if (/*@cc_on@if(@_jscript_version>=5)!@end@*/0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (parsed = ua.match(/Chrome\/(\d+\.\d+\.\d+\.\d+)/)) {
|
||||
return parsed[1] >= '4.0.249.4' || 1 * parsed[1].split(".")[0] > 5;
|
||||
}
|
||||
|
||||
if ((parsed = ua.match(/Safari\/(\d+\.\d+)/)) && !/iPhone/.test(ua)) {
|
||||
return parsed[1] >= '525.13';
|
||||
}
|
||||
|
||||
if (/Opera/.test({}.toString.call(window.opera))) {
|
||||
return opera.version() >= '10.00';
|
||||
}
|
||||
|
||||
if (parsed = ua.match(/rv:(\d+\.\d+\.\d+)[^b].*Gecko\//)) {
|
||||
return parsed[1] >= '1.9.1';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// queue features
|
||||
for (var key in tests) {
|
||||
if (tests[key]) {
|
||||
api.feature(key, tests[key].call(), true);
|
||||
}
|
||||
}
|
||||
|
||||
// enable features at once
|
||||
api.feature();
|
||||
|
||||
})(window);
|
1
lib/js/extra/headjs/dist/0.97a/head.css3.min.js
vendored
Normal file
1
lib/js/extra/headjs/dist/0.97a/head.css3.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
(function(e,t){"use strict";function f(e){o[o.length]=e}function l(e){var t=new RegExp("\\b"+e+"\\b");s.className=s.className.replace(t,"")}function c(e,t){for(var n=0,r=e.length;n<r;n++)t.call(e,e[n],n)}function E(){var t=e.innerWidth||s.clientWidth,n=e.outerWidth||e.screen.width;h.screen.innerWidth=t,h.screen.outerWidth=n;var r=e.outerWidth||s.clientWidth;s.className=s.className.replace(/ (w|lt|portrait|no-portrait|landscape|no-landscape)-\d+/g,""),f("w-"+Math.round(r/100)*100),c(u.screens,function(e){r<=e&&f("lt-"+e)});var i=e.innerHeight||s.clientHeight,o=e.outerHeight||e.screen.height;h.screen.innerHeight=i,h.screen.outerHeight=o,h.feature("portrait",i>t),h.feature("landscape",i<t)}function x(){e.clearTimeout(S),S=e.setTimeout(E,100)}var n=e.document,r=e.navigator,i=e.location,s=n.documentElement,o=[],u={screens:[320,480,640,768,1024,1280,1440,1680,1920],section:"-section",page:"-page",head:"head"};if(e.head_conf)for(var a in e.head_conf)e.head_conf[a]!==t&&(u[a]=e.head_conf[a]);var h=e[u.head]=function(){h.ready.apply(null,arguments)};h.feature=function(e,t,n){return e?(Object.prototype.toString.call(t)==="[object Function]"&&(t=t.call()),f((t?"":"no-")+e),h[e]=!!t,n||(l("no-"+e),l(e),h.feature()),h):(s.className+=" "+o.join(" "),o=[],h)},h.feature("js",!0);var p=r.userAgent.toLowerCase(),d=/mobile|midp/.test(p);h.feature("mobile",d,!0),h.feature("desktop",!d,!0),h.feature("touch","ontouchstart"in e,!0),p=/(chrome|firefox)[ \/]([\w.]+)/.exec(p)||/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(p)||/(android)(?:.*version)?[ \/]([\w.]+)/.exec(p)||/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(p)||/(msie) ([\w.]+)/.exec(p)||[];var v=p[1],m=parseFloat(p[2]),g=0,y=0;switch(v){case"msie":v="ie",m=n.documentMode||m,g=6,y=10;break;case"chrome":g=8,y=22;break;case"firefox":v="ff",g=3,y=17;break;case"ipod":case"ipad":case"iphone":v="ios",g=3,y=6;break;case"android":g=2,y=4;break;case"webkit":v="safari",g=9,y=12;break;case"opera":g=9,y=12}h.browser={name:v,version:m},h.browser[v]=!0;var b=["ie"];c(b,function(e){e===v?f(e):f("no-"+e)});for(var w=g;w<=y;w++)m<w&&f("lt-"+v+w);v==="ie"&&m<9&&c("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"),function(e){n.createElement(e)}),c(i.pathname.split("/"),function(e,n){if(this.length>2&&this[n+1]!==t)n&&f(this.slice(1,n+1).join("-").toLowerCase()+u.section);else{var r=e||"index",i=r.indexOf(".");i>0&&(r=r.substring(0,i)),s.id=r.toLowerCase()+u.page,n||f("root"+u.section)}}),h.screen={height:e.screen.height,width:e.screen.width},E();var S=0;e.addEventListener?e.addEventListener("resize",x,!1):e.attachEvent("onresize",x)})(window),function(e,t){"use strict";function l(e){for(var n in e)if(s[e[n]]!==t)return!0}function c(e){var t=e.charAt(0).toUpperCase()+e.substr(1),n=(e+" "+u.join(t+" ")+t).split(" ");return!!l(n)}var n=e.document,r=e.navigator,i=n.createElement("i"),s=i.style,o=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),u="Webkit Moz O ms Khtml".split(" "),a=e.head_conf&&e.head_conf.head||"head",f=e[a],h={gradient:function(){var e="background-image:",t="gradient(linear,left top,right bottom,from(#9f9),to(#fff));",n="linear-gradient(left top,#eee,#fff);";return s.cssText=(e+o.join(t+e)+o.join(n+e)).slice(0,-e.length),!!s.backgroundImage},rgba:function(){return s.cssText="background-color:rgba(0,0,0,0.5)",!!s.backgroundColor},opacity:function(){return i.style.opacity===""},textshadow:function(){return s.textShadow===""},multiplebgs:function(){return s.cssText="background:url(//:),url(//:),red url(//:)",(new RegExp("(url\\s*\\(.*?){3}")).test(s.background)},boxshadow:function(){return c("boxShadow")},borderimage:function(){return c("borderImage")},borderradius:function(){return c("borderRadius")},cssreflections:function(){return c("boxReflect")},csstransforms:function(){return c("transform")},csstransitions:function(){return c("transition")},fontface:function(){var e=navigator.userAgent,t;return(t=e.match(/Chrome\/(\d+\.\d+\.\d+\.\d+)/))?t[1]>="4.0.249.4"||1*t[1].split(".")[0]>5:(t=e.match(/Safari\/(\d+\.\d+)/))&&!/iPhone/.test(e)?t[1]>="525.13":/Opera/.test({}.toString.call(window.opera))?opera.version()>="10.00":(t=e.match(/rv:(\d+\.\d+\.\d+)[^b].*Gecko\//))?t[1]>="1.9.1":!1}};for(var p in h)h[p]&&f.feature(p,h[p].call(),!0);f.feature()}(window)
|
836
lib/js/extra/headjs/dist/0.97a/head.js
vendored
Normal file
836
lib/js/extra/headjs/dist/0.97a/head.js
vendored
Normal file
|
@ -0,0 +1,836 @@
|
|||
/**!
|
||||
Head JS The only script in your <HEAD>
|
||||
Copyright Tero Piirainen (tipiirai)
|
||||
License MIT / http://bit.ly/mit-license
|
||||
Version 0.97a
|
||||
|
||||
http://headjs.com
|
||||
*/
|
||||
; (function (win, undefined) {
|
||||
"use strict";
|
||||
|
||||
var doc = win.document,
|
||||
nav = win.navigator,
|
||||
loc = win.location,
|
||||
html = doc.documentElement,
|
||||
klass = [],
|
||||
conf = {
|
||||
screens: [320, 480, 640, 768, 1024, 1280, 1440, 1680, 1920],
|
||||
section: "-section",
|
||||
page : "-page",
|
||||
head : "head"
|
||||
};
|
||||
|
||||
if (win.head_conf) {
|
||||
for (var item in win.head_conf) {
|
||||
if (win.head_conf[item] !== undefined) {
|
||||
conf[item] = win.head_conf[item];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function pushClass(name) {
|
||||
klass[klass.length] = name;
|
||||
}
|
||||
|
||||
function removeClass(name) {
|
||||
var re = new RegExp("\\b" + name + "\\b");
|
||||
html.className = html.className.replace(re, '');
|
||||
}
|
||||
|
||||
function each(arr, fn) {
|
||||
for (var i = 0, l = arr.length; i < l; i++) {
|
||||
fn.call(arr, arr[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// API
|
||||
var api = win[conf.head] = function () {
|
||||
api.ready.apply(null, arguments);
|
||||
};
|
||||
|
||||
api.feature = function (key, enabled, queue) {
|
||||
|
||||
// internal: apply all classes
|
||||
if (!key) {
|
||||
html.className += ' ' + klass.join(' ');
|
||||
klass = [];
|
||||
return api;
|
||||
}
|
||||
|
||||
if (Object.prototype.toString.call(enabled) === '[object Function]') {
|
||||
enabled = enabled.call();
|
||||
}
|
||||
|
||||
pushClass((enabled ? '' : 'no-') + key);
|
||||
api[key] = !!enabled;
|
||||
|
||||
// apply class to HTML element
|
||||
if (!queue) {
|
||||
removeClass('no-' + key);
|
||||
removeClass(key);
|
||||
api.feature();
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
// no queue here, so we can remove any eventual pre-existing no-js class
|
||||
api.feature("js", true);
|
||||
|
||||
// browser type & version
|
||||
var ua = nav.userAgent.toLowerCase(),
|
||||
mobile = /mobile|midp/.test(ua);
|
||||
|
||||
// useful for enabling/disabling feature (we can consider a desktop navigator to have more cpu/gpu power)
|
||||
api.feature("mobile" , mobile , true);
|
||||
api.feature("desktop", !mobile, true);
|
||||
api.feature("touch" , 'ontouchstart' in win, true);
|
||||
|
||||
// http://www.zytrax.com/tech/web/browser_ids.htm
|
||||
// http://www.zytrax.com/tech/web/mobile_ids.html
|
||||
ua = /(chrome|firefox)[ \/]([\w.]+)/.exec(ua) || // Chrome & Firefox
|
||||
/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile IOS
|
||||
/(android)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile Webkit
|
||||
/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Safari & Opera
|
||||
/(msie) ([\w.]+)/.exec(ua) || [];
|
||||
|
||||
|
||||
var browser = ua[1],
|
||||
version = parseFloat(ua[2]),
|
||||
start = 0,
|
||||
stop = 0;
|
||||
|
||||
switch (browser) {
|
||||
case 'msie':
|
||||
browser = 'ie';
|
||||
version = doc.documentMode || version;
|
||||
|
||||
start = 6;
|
||||
stop = 10;
|
||||
break;
|
||||
|
||||
// Add/remove extra tests here
|
||||
case 'chrome':
|
||||
start = 8;
|
||||
stop = 22;
|
||||
break;
|
||||
|
||||
case 'firefox':
|
||||
browser = 'ff';
|
||||
|
||||
start = 3;
|
||||
stop = 17;
|
||||
break;
|
||||
|
||||
case 'ipod':
|
||||
case 'ipad':
|
||||
case 'iphone':
|
||||
browser = 'ios';
|
||||
|
||||
start = 3;
|
||||
stop = 6;
|
||||
break;
|
||||
|
||||
case 'android':
|
||||
start = 2;
|
||||
stop = 4;
|
||||
break;
|
||||
|
||||
case 'webkit':
|
||||
browser = 'safari';
|
||||
|
||||
start = 9;
|
||||
stop = 12;
|
||||
break;
|
||||
|
||||
case 'opera':
|
||||
start = 9;
|
||||
stop = 12;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// name can be used further on for various tasks, like font-face detection in css3.js
|
||||
api.browser = {
|
||||
name : browser,
|
||||
version: version
|
||||
};
|
||||
api.browser[browser] = true;
|
||||
|
||||
|
||||
// add supported, not supported classes
|
||||
var supported = ['ie'];
|
||||
//var supported = ['ie', 'chrome', 'ff', 'ios', 'android', 'safari', 'opera'];
|
||||
each(supported, function (name) {
|
||||
if (name === browser) {
|
||||
pushClass(name);
|
||||
}
|
||||
else {
|
||||
pushClass("no-" + name);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
for (var v = start; v <= stop; v++) {
|
||||
if (version < v) {
|
||||
pushClass("lt-" + browser + v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// IE lt9 specific
|
||||
if (browser === "ie" && version < 9) {
|
||||
// HTML5 support : you still need to add html5 css initialization styles to your site
|
||||
// See: assets/html5.css
|
||||
each("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"), function (el) {
|
||||
doc.createElement(el);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// CSS "router"
|
||||
each(loc.pathname.split("/"), function (el, i) {
|
||||
if (this.length > 2 && this[i + 1] !== undefined) {
|
||||
if (i) {
|
||||
pushClass(this.slice(1, i + 1).join("-").toLowerCase() + conf.section);
|
||||
}
|
||||
} else {
|
||||
// pageId
|
||||
var id = el || "index", index = id.indexOf(".");
|
||||
if (index > 0) {
|
||||
id = id.substring(0, index);
|
||||
}
|
||||
|
||||
html.id = id.toLowerCase() + conf.page;
|
||||
|
||||
// on root?
|
||||
if (!i) {
|
||||
pushClass("root" + conf.section);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// basic screen info
|
||||
api.screen = {
|
||||
height: win.screen.height,
|
||||
width : win.screen.width
|
||||
};
|
||||
|
||||
// screen resolution: w-100, lt-480, lt-1024 ...
|
||||
function screenSize() {
|
||||
// Viewport width
|
||||
var iw = win.innerWidth || html.clientWidth,
|
||||
ow = win.outerWidth || win.screen.width;
|
||||
|
||||
api.screen['innerWidth'] = iw;
|
||||
api.screen['outerWidth'] = ow;
|
||||
|
||||
|
||||
// START old code
|
||||
var w = win.outerWidth || html.clientWidth;
|
||||
|
||||
// remove earlier widths
|
||||
html.className = html.className.replace(/ (w|lt|portrait|no-portrait|landscape|no-landscape)-\d+/g, "");
|
||||
|
||||
// add new ones
|
||||
pushClass("w-" + Math.round(w / 100) * 100);
|
||||
|
||||
each(conf.screens, function (width) {
|
||||
if (w <= width) {
|
||||
pushClass("lt-" + width);
|
||||
}
|
||||
});
|
||||
// END old code
|
||||
|
||||
// Viewport height
|
||||
var ih = win.innerHeight || html.clientHeight,
|
||||
oh = win.outerHeight || win.screen.height;
|
||||
|
||||
api.screen['innerHeight'] = ih;
|
||||
api.screen['outerHeight'] = oh;
|
||||
|
||||
// no need for onChange event to detect this
|
||||
api.feature("portrait" , (ih > iw));
|
||||
api.feature("landscape", (ih < iw));
|
||||
}
|
||||
|
||||
screenSize();
|
||||
|
||||
// Throttle navigators from triggering too many resize events
|
||||
var resizeId = 0;
|
||||
function onResize() {
|
||||
win.clearTimeout(resizeId);
|
||||
resizeId = win.setTimeout(screenSize, 100);
|
||||
}
|
||||
|
||||
// Manually attach, as to not overwrite existing handler
|
||||
if (win.addEventListener) {
|
||||
win.addEventListener("resize", onResize, false);
|
||||
|
||||
} else {
|
||||
win.attachEvent("onresize", onResize);
|
||||
}
|
||||
})(window);
|
||||
|
||||
/**
|
||||
Head JS The only script in your <HEAD>
|
||||
Copyright Tero Piirainen (tipiirai)
|
||||
License MIT / http://bit.ly/mit-license
|
||||
Version 0.97a
|
||||
|
||||
http://headjs.com
|
||||
*/
|
||||
;(function(win, undefined) {
|
||||
"use strict";
|
||||
|
||||
var doc = win.document,
|
||||
nav = win.navigator,
|
||||
|
||||
/*
|
||||
To add a new test:
|
||||
|
||||
head.feature("video", function() {
|
||||
var tag = document.createElement('video');
|
||||
return !!tag.canPlayType;
|
||||
});
|
||||
|
||||
Good place to grab more tests
|
||||
|
||||
https://github.com/Modernizr/Modernizr/blob/master/modernizr.js
|
||||
*/
|
||||
|
||||
/* CSS modernizer */
|
||||
el = doc.createElement("i"),
|
||||
style = el.style,
|
||||
prefs = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '),
|
||||
domPrefs = 'Webkit Moz O ms Khtml'.split(' '),
|
||||
|
||||
head_var = win.head_conf && win.head_conf.head || "head",
|
||||
api = win[head_var];
|
||||
|
||||
// Thanks Paul Irish!
|
||||
function testProps(props) {
|
||||
for (var i in props) {
|
||||
if (style[props[i]] !== undefined) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function testAll(prop) {
|
||||
var camel = prop.charAt(0).toUpperCase() + prop.substr(1),
|
||||
props = (prop + ' ' + domPrefs.join(camel + ' ') + camel).split(' ');
|
||||
|
||||
return !!testProps(props);
|
||||
}
|
||||
|
||||
var tests = {
|
||||
|
||||
gradient: function() {
|
||||
var s1 = 'background-image:',
|
||||
s2 = 'gradient(linear,left top,right bottom,from(#9f9),to(#fff));',
|
||||
s3 = 'linear-gradient(left top,#eee,#fff);';
|
||||
|
||||
style.cssText = (s1 + prefs.join(s2 + s1) + prefs.join(s3 + s1)).slice(0,-s1.length);
|
||||
return !!style.backgroundImage;
|
||||
},
|
||||
|
||||
rgba: function() {
|
||||
style.cssText = "background-color:rgba(0,0,0,0.5)";
|
||||
return !!style.backgroundColor;
|
||||
},
|
||||
|
||||
opacity: function() {
|
||||
return el.style.opacity === "";
|
||||
},
|
||||
|
||||
textshadow: function() {
|
||||
return style.textShadow === '';
|
||||
},
|
||||
|
||||
multiplebgs: function() {
|
||||
style.cssText = "background:url(//:),url(//:),red url(//:)";
|
||||
return new RegExp("(url\\s*\\(.*?){3}").test(style.background);
|
||||
},
|
||||
|
||||
boxshadow: function() {
|
||||
return testAll("boxShadow");
|
||||
},
|
||||
|
||||
borderimage: function() {
|
||||
return testAll("borderImage");
|
||||
},
|
||||
|
||||
borderradius: function() {
|
||||
return testAll("borderRadius");
|
||||
},
|
||||
|
||||
cssreflections: function() {
|
||||
return testAll("boxReflect");
|
||||
},
|
||||
|
||||
csstransforms: function() {
|
||||
return testAll("transform");
|
||||
},
|
||||
|
||||
csstransitions: function() {
|
||||
return testAll("transition");
|
||||
},
|
||||
|
||||
/*
|
||||
font-face support. Uses browser sniffing but is synchronous.
|
||||
|
||||
http://paulirish.com/2009/font-face-feature-detection/
|
||||
*/
|
||||
fontface: function() {
|
||||
var ua = navigator.userAgent, parsed;
|
||||
|
||||
if (/*@cc_on@if(@_jscript_version>=5)!@end@*/0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (parsed = ua.match(/Chrome\/(\d+\.\d+\.\d+\.\d+)/)) {
|
||||
return parsed[1] >= '4.0.249.4' || 1 * parsed[1].split(".")[0] > 5;
|
||||
}
|
||||
|
||||
if ((parsed = ua.match(/Safari\/(\d+\.\d+)/)) && !/iPhone/.test(ua)) {
|
||||
return parsed[1] >= '525.13';
|
||||
}
|
||||
|
||||
if (/Opera/.test({}.toString.call(window.opera))) {
|
||||
return opera.version() >= '10.00';
|
||||
}
|
||||
|
||||
if (parsed = ua.match(/rv:(\d+\.\d+\.\d+)[^b].*Gecko\//)) {
|
||||
return parsed[1] >= '1.9.1';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// queue features
|
||||
for (var key in tests) {
|
||||
if (tests[key]) {
|
||||
api.feature(key, tests[key].call(), true);
|
||||
}
|
||||
}
|
||||
|
||||
// enable features at once
|
||||
api.feature();
|
||||
|
||||
})(window);
|
||||
/**
|
||||
Head JS The only script in your <HEAD>
|
||||
Copyright Tero Piirainen (tipiirai)
|
||||
License MIT / http://bit.ly/mit-license
|
||||
Version 0.97a
|
||||
|
||||
http://headjs.com
|
||||
*/
|
||||
;(function(win, undefined) {
|
||||
"use strict";
|
||||
|
||||
var doc = win.document,
|
||||
nav = win.navigator,
|
||||
head = doc.documentElement,
|
||||
isHeadReady,
|
||||
isDomReady,
|
||||
domWaiters = [],
|
||||
queue = [], // waiters for the "head ready" event
|
||||
handlers = {}, // user functions waiting for events
|
||||
scripts = {}, // loadable scripts in different states
|
||||
isAsync = doc.createElement("script").async === true || "MozAppearance" in doc.documentElement.style || win.opera,
|
||||
|
||||
/*** public API ***/
|
||||
head_var = win.head_conf && win.head_conf.head || "head",
|
||||
api = win[head_var] = (win[head_var] || function() { api.ready.apply(null, arguments); }),
|
||||
|
||||
// states
|
||||
PRELOADED = 1,
|
||||
PRELOADING = 2,
|
||||
LOADING = 3,
|
||||
LOADED = 4;
|
||||
|
||||
|
||||
// Method 1: simply load and let browser take care of ordering
|
||||
if (isAsync) {
|
||||
|
||||
api.js = function() {
|
||||
|
||||
var args = arguments,
|
||||
fn = args[args.length -1],
|
||||
els = {};
|
||||
|
||||
if (!isFunc(fn)) {
|
||||
fn = null;
|
||||
}
|
||||
|
||||
each(args, function(el, i) {
|
||||
|
||||
if (el != fn) {
|
||||
el = getScript(el);
|
||||
els[el.name] = el;
|
||||
|
||||
load(el, fn && i == args.length -2 ? function() {
|
||||
if (allLoaded(els)) {
|
||||
one(fn);
|
||||
}
|
||||
|
||||
} : null);
|
||||
}
|
||||
});
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
|
||||
// Method 2: preload with text/cache hack
|
||||
} else {
|
||||
|
||||
api.js = function() {
|
||||
|
||||
var args = arguments,
|
||||
rest = [].slice.call(args, 1),
|
||||
next = rest[0];
|
||||
|
||||
// wait for a while. immediate execution causes some browsers to ignore caching
|
||||
if (!isHeadReady) {
|
||||
queue.push(function() {
|
||||
api.js.apply(null, args);
|
||||
});
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
// multiple arguments
|
||||
if (next) {
|
||||
|
||||
// load
|
||||
each(rest, function(el) {
|
||||
if (!isFunc(el)) {
|
||||
preload(getScript(el));
|
||||
}
|
||||
});
|
||||
|
||||
// execute
|
||||
load(getScript(args[0]), isFunc(next) ? next : function() {
|
||||
api.js.apply(null, rest);
|
||||
});
|
||||
|
||||
|
||||
// single script
|
||||
} else {
|
||||
load(getScript(args[0]));
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
}
|
||||
|
||||
api.ready = function(key, fn) {
|
||||
|
||||
// DOM ready check: head.ready(document, function() { });
|
||||
if (key == doc) {
|
||||
if (isDomReady) {
|
||||
one(fn);
|
||||
}
|
||||
else {
|
||||
domWaiters.push(fn);
|
||||
}
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
// shift arguments
|
||||
if (isFunc(key)) {
|
||||
fn = key;
|
||||
key = "ALL";
|
||||
}
|
||||
|
||||
// make sure arguments are sane
|
||||
if (typeof key != 'string' || !isFunc(fn)) {
|
||||
return api;
|
||||
}
|
||||
|
||||
var script = scripts[key];
|
||||
|
||||
// script already loaded --> execute and return
|
||||
if (script && script.state == LOADED || key == 'ALL' && allLoaded() && isDomReady) {
|
||||
one(fn);
|
||||
return api;
|
||||
}
|
||||
|
||||
var arr = handlers[key];
|
||||
if (!arr) {
|
||||
arr = handlers[key] = [fn];
|
||||
}
|
||||
else {
|
||||
arr.push(fn);
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
|
||||
// perform this when DOM is ready
|
||||
api.ready(doc, function() {
|
||||
|
||||
if (allLoaded()) {
|
||||
each(handlers.ALL, function(fn) {
|
||||
one(fn);
|
||||
});
|
||||
}
|
||||
|
||||
if (api.feature) {
|
||||
api.feature("domloaded", true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/*** private functions ***/
|
||||
|
||||
|
||||
// call function once
|
||||
function one(fn) {
|
||||
if (fn._done) { return; }
|
||||
fn();
|
||||
fn._done = 1;
|
||||
}
|
||||
|
||||
|
||||
function toLabel(url) {
|
||||
var els = url.split("/"),
|
||||
name = els[els.length -1],
|
||||
i = name.indexOf("?");
|
||||
|
||||
return i != -1 ? name.substring(0, i) : name;
|
||||
}
|
||||
|
||||
|
||||
function getScript(url) {
|
||||
|
||||
var script;
|
||||
|
||||
if (typeof url == 'object') {
|
||||
for (var key in url) {
|
||||
if (url[key]) {
|
||||
script = { name: key, url: url[key] };
|
||||
}
|
||||
}
|
||||
} else {
|
||||
script = { name: toLabel(url), url: url };
|
||||
}
|
||||
|
||||
var existing = scripts[script.name];
|
||||
if (existing && existing.url === script.url) {
|
||||
return existing;
|
||||
}
|
||||
|
||||
scripts[script.name] = script;
|
||||
return script;
|
||||
}
|
||||
|
||||
|
||||
function each(arr, fn) {
|
||||
if (!arr) { return; }
|
||||
|
||||
// arguments special type
|
||||
if (typeof arr == 'object') { arr = [].slice.call(arr); }
|
||||
|
||||
// do the job
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
fn.call(arr, arr[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
function isFunc(el) {
|
||||
return Object.prototype.toString.call(el) == '[object Function]';
|
||||
}
|
||||
|
||||
function allLoaded(els) {
|
||||
|
||||
els = els || scripts;
|
||||
|
||||
var loaded;
|
||||
|
||||
for (var name in els) {
|
||||
if (els.hasOwnProperty(name) && els[name].state != LOADED) {
|
||||
return false;
|
||||
}
|
||||
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
return loaded;
|
||||
}
|
||||
|
||||
|
||||
function onPreload(script) {
|
||||
script.state = PRELOADED;
|
||||
|
||||
each(script.onpreload, function(el) {
|
||||
el.call();
|
||||
});
|
||||
}
|
||||
|
||||
function preload(script, callback) {
|
||||
|
||||
if (script.state === undefined) {
|
||||
|
||||
script.state = PRELOADING;
|
||||
script.onpreload = [];
|
||||
|
||||
scriptTag({ src: script.url, type: 'cache'}, function() {
|
||||
onPreload(script);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function load(script, callback) {
|
||||
|
||||
if (script.state == LOADED) {
|
||||
return callback && callback();
|
||||
}
|
||||
|
||||
if (script.state == LOADING) {
|
||||
return api.ready(script.name, callback);
|
||||
}
|
||||
|
||||
if (script.state == PRELOADING) {
|
||||
return script.onpreload.push(function() {
|
||||
load(script, callback);
|
||||
});
|
||||
}
|
||||
|
||||
script.state = LOADING;
|
||||
|
||||
scriptTag(script.url, function() {
|
||||
|
||||
script.state = LOADED;
|
||||
|
||||
if (callback) { callback(); }
|
||||
|
||||
// handlers for this script
|
||||
each(handlers[script.name], function(fn) {
|
||||
one(fn);
|
||||
});
|
||||
|
||||
// everything ready
|
||||
if (allLoaded() && isDomReady) {
|
||||
each(handlers.ALL, function(fn) {
|
||||
one(fn);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function scriptTag(src, callback) {
|
||||
|
||||
var s = doc.createElement('script');
|
||||
s.type = 'text/' + (src.type || 'javascript');
|
||||
s.src = src.src || src;
|
||||
s.async = false;
|
||||
|
||||
s.onreadystatechange = s.onload = function() {
|
||||
|
||||
var state = s.readyState;
|
||||
|
||||
if (!callback.done && (!state || /loaded|complete/.test(state))) {
|
||||
callback.done = true;
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
// use body if available. more safe in IE
|
||||
(doc.body || head).appendChild(s);
|
||||
}
|
||||
|
||||
/*
|
||||
The much desired DOM ready check
|
||||
Thanks to jQuery and http://javascript.nwbox.com/IEContentLoaded/
|
||||
*/
|
||||
|
||||
function fireReady() {
|
||||
if (!isDomReady) {
|
||||
isDomReady = true;
|
||||
each(domWaiters, function(fn) {
|
||||
one(fn);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// W3C
|
||||
if (win.addEventListener) {
|
||||
doc.addEventListener("DOMContentLoaded", fireReady, false);
|
||||
|
||||
// fallback. this is always called
|
||||
win.addEventListener("load", fireReady, false);
|
||||
|
||||
// IE
|
||||
} else if (win.attachEvent) {
|
||||
|
||||
// for iframes
|
||||
doc.attachEvent("onreadystatechange", function() {
|
||||
if (doc.readyState === "complete" ) {
|
||||
fireReady();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// avoid frames with different domains issue
|
||||
var frameElement = 1;
|
||||
|
||||
try {
|
||||
frameElement = win.frameElement;
|
||||
|
||||
} catch(e) {}
|
||||
|
||||
|
||||
if (!frameElement && head.doScroll) {
|
||||
|
||||
(function() {
|
||||
try {
|
||||
head.doScroll("left");
|
||||
fireReady();
|
||||
|
||||
} catch(e) {
|
||||
setTimeout(arguments.callee, 1);
|
||||
return;
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
// fallback
|
||||
win.attachEvent("onload", fireReady);
|
||||
}
|
||||
|
||||
|
||||
// enable document.readyState for Firefox <= 3.5
|
||||
if (!doc.readyState && doc.addEventListener) {
|
||||
doc.readyState = "loading";
|
||||
doc.addEventListener("DOMContentLoaded", handler = function () {
|
||||
doc.removeEventListener("DOMContentLoaded", handler, false);
|
||||
doc.readyState = "complete";
|
||||
}, false);
|
||||
}
|
||||
|
||||
/*
|
||||
We wait for 300 ms before script loading starts. for some reason this is needed
|
||||
to make sure scripts are cached. Not sure why this happens yet. A case study:
|
||||
|
||||
https://github.com/headjs/headjs/issues/closed#issue/83
|
||||
*/
|
||||
setTimeout(function() {
|
||||
isHeadReady = true;
|
||||
each(queue, function(fn) {
|
||||
fn();
|
||||
});
|
||||
|
||||
}, 300);
|
||||
|
||||
})(window);
|
411
lib/js/extra/headjs/dist/0.97a/head.load.js
vendored
Normal file
411
lib/js/extra/headjs/dist/0.97a/head.load.js
vendored
Normal file
|
@ -0,0 +1,411 @@
|
|||
/**
|
||||
Head JS The only script in your <HEAD>
|
||||
Copyright Tero Piirainen (tipiirai)
|
||||
License MIT / http://bit.ly/mit-license
|
||||
Version 0.97a
|
||||
|
||||
http://headjs.com
|
||||
*/
|
||||
;(function(win, undefined) {
|
||||
"use strict";
|
||||
|
||||
var doc = win.document,
|
||||
nav = win.navigator,
|
||||
head = doc.documentElement,
|
||||
isHeadReady,
|
||||
isDomReady,
|
||||
domWaiters = [],
|
||||
queue = [], // waiters for the "head ready" event
|
||||
handlers = {}, // user functions waiting for events
|
||||
scripts = {}, // loadable scripts in different states
|
||||
isAsync = doc.createElement("script").async === true || "MozAppearance" in doc.documentElement.style || win.opera,
|
||||
|
||||
/*** public API ***/
|
||||
head_var = win.head_conf && win.head_conf.head || "head",
|
||||
api = win[head_var] = (win[head_var] || function() { api.ready.apply(null, arguments); }),
|
||||
|
||||
// states
|
||||
PRELOADED = 1,
|
||||
PRELOADING = 2,
|
||||
LOADING = 3,
|
||||
LOADED = 4;
|
||||
|
||||
|
||||
// Method 1: simply load and let browser take care of ordering
|
||||
if (isAsync) {
|
||||
|
||||
api.js = function() {
|
||||
|
||||
var args = arguments,
|
||||
fn = args[args.length -1],
|
||||
els = {};
|
||||
|
||||
if (!isFunc(fn)) {
|
||||
fn = null;
|
||||
}
|
||||
|
||||
each(args, function(el, i) {
|
||||
|
||||
if (el != fn) {
|
||||
el = getScript(el);
|
||||
els[el.name] = el;
|
||||
|
||||
load(el, fn && i == args.length -2 ? function() {
|
||||
if (allLoaded(els)) {
|
||||
one(fn);
|
||||
}
|
||||
|
||||
} : null);
|
||||
}
|
||||
});
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
|
||||
// Method 2: preload with text/cache hack
|
||||
} else {
|
||||
|
||||
api.js = function() {
|
||||
|
||||
var args = arguments,
|
||||
rest = [].slice.call(args, 1),
|
||||
next = rest[0];
|
||||
|
||||
// wait for a while. immediate execution causes some browsers to ignore caching
|
||||
if (!isHeadReady) {
|
||||
queue.push(function() {
|
||||
api.js.apply(null, args);
|
||||
});
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
// multiple arguments
|
||||
if (next) {
|
||||
|
||||
// load
|
||||
each(rest, function(el) {
|
||||
if (!isFunc(el)) {
|
||||
preload(getScript(el));
|
||||
}
|
||||
});
|
||||
|
||||
// execute
|
||||
load(getScript(args[0]), isFunc(next) ? next : function() {
|
||||
api.js.apply(null, rest);
|
||||
});
|
||||
|
||||
|
||||
// single script
|
||||
} else {
|
||||
load(getScript(args[0]));
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
}
|
||||
|
||||
api.ready = function(key, fn) {
|
||||
|
||||
// DOM ready check: head.ready(document, function() { });
|
||||
if (key == doc) {
|
||||
if (isDomReady) {
|
||||
one(fn);
|
||||
}
|
||||
else {
|
||||
domWaiters.push(fn);
|
||||
}
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
// shift arguments
|
||||
if (isFunc(key)) {
|
||||
fn = key;
|
||||
key = "ALL";
|
||||
}
|
||||
|
||||
// make sure arguments are sane
|
||||
if (typeof key != 'string' || !isFunc(fn)) {
|
||||
return api;
|
||||
}
|
||||
|
||||
var script = scripts[key];
|
||||
|
||||
// script already loaded --> execute and return
|
||||
if (script && script.state == LOADED || key == 'ALL' && allLoaded() && isDomReady) {
|
||||
one(fn);
|
||||
return api;
|
||||
}
|
||||
|
||||
var arr = handlers[key];
|
||||
if (!arr) {
|
||||
arr = handlers[key] = [fn];
|
||||
}
|
||||
else {
|
||||
arr.push(fn);
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
|
||||
// perform this when DOM is ready
|
||||
api.ready(doc, function() {
|
||||
|
||||
if (allLoaded()) {
|
||||
each(handlers.ALL, function(fn) {
|
||||
one(fn);
|
||||
});
|
||||
}
|
||||
|
||||
if (api.feature) {
|
||||
api.feature("domloaded", true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/*** private functions ***/
|
||||
|
||||
|
||||
// call function once
|
||||
function one(fn) {
|
||||
if (fn._done) { return; }
|
||||
fn();
|
||||
fn._done = 1;
|
||||
}
|
||||
|
||||
|
||||
function toLabel(url) {
|
||||
var els = url.split("/"),
|
||||
name = els[els.length -1],
|
||||
i = name.indexOf("?");
|
||||
|
||||
return i != -1 ? name.substring(0, i) : name;
|
||||
}
|
||||
|
||||
|
||||
function getScript(url) {
|
||||
|
||||
var script;
|
||||
|
||||
if (typeof url == 'object') {
|
||||
for (var key in url) {
|
||||
if (url[key]) {
|
||||
script = { name: key, url: url[key] };
|
||||
}
|
||||
}
|
||||
} else {
|
||||
script = { name: toLabel(url), url: url };
|
||||
}
|
||||
|
||||
var existing = scripts[script.name];
|
||||
if (existing && existing.url === script.url) {
|
||||
return existing;
|
||||
}
|
||||
|
||||
scripts[script.name] = script;
|
||||
return script;
|
||||
}
|
||||
|
||||
|
||||
function each(arr, fn) {
|
||||
if (!arr) { return; }
|
||||
|
||||
// arguments special type
|
||||
if (typeof arr == 'object') { arr = [].slice.call(arr); }
|
||||
|
||||
// do the job
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
fn.call(arr, arr[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
function isFunc(el) {
|
||||
return Object.prototype.toString.call(el) == '[object Function]';
|
||||
}
|
||||
|
||||
function allLoaded(els) {
|
||||
|
||||
els = els || scripts;
|
||||
|
||||
var loaded;
|
||||
|
||||
for (var name in els) {
|
||||
if (els.hasOwnProperty(name) && els[name].state != LOADED) {
|
||||
return false;
|
||||
}
|
||||
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
return loaded;
|
||||
}
|
||||
|
||||
|
||||
function onPreload(script) {
|
||||
script.state = PRELOADED;
|
||||
|
||||
each(script.onpreload, function(el) {
|
||||
el.call();
|
||||
});
|
||||
}
|
||||
|
||||
function preload(script, callback) {
|
||||
|
||||
if (script.state === undefined) {
|
||||
|
||||
script.state = PRELOADING;
|
||||
script.onpreload = [];
|
||||
|
||||
scriptTag({ src: script.url, type: 'cache'}, function() {
|
||||
onPreload(script);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function load(script, callback) {
|
||||
|
||||
if (script.state == LOADED) {
|
||||
return callback && callback();
|
||||
}
|
||||
|
||||
if (script.state == LOADING) {
|
||||
return api.ready(script.name, callback);
|
||||
}
|
||||
|
||||
if (script.state == PRELOADING) {
|
||||
return script.onpreload.push(function() {
|
||||
load(script, callback);
|
||||
});
|
||||
}
|
||||
|
||||
script.state = LOADING;
|
||||
|
||||
scriptTag(script.url, function() {
|
||||
|
||||
script.state = LOADED;
|
||||
|
||||
if (callback) { callback(); }
|
||||
|
||||
// handlers for this script
|
||||
each(handlers[script.name], function(fn) {
|
||||
one(fn);
|
||||
});
|
||||
|
||||
// everything ready
|
||||
if (allLoaded() && isDomReady) {
|
||||
each(handlers.ALL, function(fn) {
|
||||
one(fn);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function scriptTag(src, callback) {
|
||||
|
||||
var s = doc.createElement('script');
|
||||
s.type = 'text/' + (src.type || 'javascript');
|
||||
s.src = src.src || src;
|
||||
s.async = false;
|
||||
|
||||
s.onreadystatechange = s.onload = function() {
|
||||
|
||||
var state = s.readyState;
|
||||
|
||||
if (!callback.done && (!state || /loaded|complete/.test(state))) {
|
||||
callback.done = true;
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
// use body if available. more safe in IE
|
||||
(doc.body || head).appendChild(s);
|
||||
}
|
||||
|
||||
/*
|
||||
The much desired DOM ready check
|
||||
Thanks to jQuery and http://javascript.nwbox.com/IEContentLoaded/
|
||||
*/
|
||||
|
||||
function fireReady() {
|
||||
if (!isDomReady) {
|
||||
isDomReady = true;
|
||||
each(domWaiters, function(fn) {
|
||||
one(fn);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// W3C
|
||||
if (win.addEventListener) {
|
||||
doc.addEventListener("DOMContentLoaded", fireReady, false);
|
||||
|
||||
// fallback. this is always called
|
||||
win.addEventListener("load", fireReady, false);
|
||||
|
||||
// IE
|
||||
} else if (win.attachEvent) {
|
||||
|
||||
// for iframes
|
||||
doc.attachEvent("onreadystatechange", function() {
|
||||
if (doc.readyState === "complete" ) {
|
||||
fireReady();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// avoid frames with different domains issue
|
||||
var frameElement = 1;
|
||||
|
||||
try {
|
||||
frameElement = win.frameElement;
|
||||
|
||||
} catch(e) {}
|
||||
|
||||
|
||||
if (!frameElement && head.doScroll) {
|
||||
|
||||
(function() {
|
||||
try {
|
||||
head.doScroll("left");
|
||||
fireReady();
|
||||
|
||||
} catch(e) {
|
||||
setTimeout(arguments.callee, 1);
|
||||
return;
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
// fallback
|
||||
win.attachEvent("onload", fireReady);
|
||||
}
|
||||
|
||||
|
||||
// enable document.readyState for Firefox <= 3.5
|
||||
if (!doc.readyState && doc.addEventListener) {
|
||||
doc.readyState = "loading";
|
||||
doc.addEventListener("DOMContentLoaded", handler = function () {
|
||||
doc.removeEventListener("DOMContentLoaded", handler, false);
|
||||
doc.readyState = "complete";
|
||||
}, false);
|
||||
}
|
||||
|
||||
/*
|
||||
We wait for 300 ms before script loading starts. for some reason this is needed
|
||||
to make sure scripts are cached. Not sure why this happens yet. A case study:
|
||||
|
||||
https://github.com/headjs/headjs/issues/closed#issue/83
|
||||
*/
|
||||
setTimeout(function() {
|
||||
isHeadReady = true;
|
||||
each(queue, function(fn) {
|
||||
fn();
|
||||
});
|
||||
|
||||
}, 300);
|
||||
|
||||
})(window);
|
1
lib/js/extra/headjs/dist/0.97a/head.load.min.js
vendored
Normal file
1
lib/js/extra/headjs/dist/0.97a/head.load.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
(function(e,t){"use strict";function y(e){if(e._done)return;e(),e._done=1}function b(e){var t=e.split("/"),n=t[t.length-1],r=n.indexOf("?");return r!=-1?n.substring(0,r):n}function w(e){var t;if(typeof e=="object")for(var n in e)e[n]&&(t={name:n,url:e[n]});else t={name:b(e),url:e};var r=l[t.name];return r&&r.url===t.url?r:(l[t.name]=t,t)}function E(e,t){if(!e)return;typeof e=="object"&&(e=[].slice.call(e));for(var n=0;n<e.length;n++)t.call(e,e[n],n)}function S(e){return Object.prototype.toString.call(e)=="[object Function]"}function x(e){e=e||l;var t;for(var n in e){if(e.hasOwnProperty(n)&&e[n].state!=g)return!1;t=!0}return t}function T(e){e.state=d,E(e.onpreload,function(e){e.call()})}function N(e,n){e.state===t&&(e.state=v,e.onpreload=[],k({src:e.url,type:"cache"},function(){T(e)}))}function C(e,t){if(e.state==g)return t&&t();if(e.state==m)return p.ready(e.name,t);if(e.state==v)return e.onpreload.push(function(){C(e,t)});e.state=m,k(e.url,function(){e.state=g,t&&t(),E(f[e.name],function(e){y(e)}),x()&&o&&E(f.ALL,function(e){y(e)})})}function k(e,t){var r=n.createElement("script");r.type="text/"+(e.type||"javascript"),r.src=e.src||e,r.async=!1,r.onreadystatechange=r.onload=function(){var e=r.readyState;!t.done&&(!e||/loaded|complete/.test(e))&&(t.done=!0,t())},(n.body||i).appendChild(r)}function L(){o||(o=!0,E(u,function(e){y(e)}))}var n=e.document,r=e.navigator,i=n.documentElement,s,o,u=[],a=[],f={},l={},c=n.createElement("script").async===!0||"MozAppearance"in n.documentElement.style||e.opera,h=e.head_conf&&e.head_conf.head||"head",p=e[h]=e[h]||function(){p.ready.apply(null,arguments)},d=1,v=2,m=3,g=4;c?p.js=function(){var e=arguments,t=e[e.length-1],n={};return S(t)||(t=null),E(e,function(r,i){r!=t&&(r=w(r),n[r.name]=r,C(r,t&&i==e.length-2?function(){x(n)&&y(t)}:null))}),p}:p.js=function(){var e=arguments,t=[].slice.call(e,1),n=t[0];return s?(n?(E(t,function(e){S(e)||N(w(e))}),C(w(e[0]),S(n)?n:function(){p.js.apply(null,t)})):C(w(e[0])),p):(a.push(function(){p.js.apply(null,e)}),p)},p.ready=function(e,t){if(e==n)return o?y(t):u.push(t),p;S(e)&&(t=e,e="ALL");if(typeof e!="string"||!S(t))return p;var r=l[e];if(r&&r.state==g||e=="ALL"&&x()&&o)return y(t),p;var i=f[e];return i?i.push(t):i=f[e]=[t],p},p.ready(n,function(){x()&&E(f.ALL,function(e){y(e)}),p.feature&&p.feature("domloaded",!0)});if(e.addEventListener)n.addEventListener("DOMContentLoaded",L,!1),e.addEventListener("load",L,!1);else if(e.attachEvent){n.attachEvent("onreadystatechange",function(){n.readyState==="complete"&&L()});var A=1;try{A=e.frameElement}catch(O){}!A&&i.doScroll&&function(){try{i.doScroll("left"),L()}catch(e){setTimeout(arguments.callee,1);return}}(),e.attachEvent("onload",L)}!n.readyState&&n.addEventListener&&(n.readyState="loading",n.addEventListener("DOMContentLoaded",handler=function(){n.removeEventListener("DOMContentLoaded",handler,!1),n.readyState="complete"},!1)),setTimeout(function(){s=!0,E(a,function(e){e()})},300)})(window)
|
1
lib/js/extra/headjs/dist/0.97a/head.min.js
vendored
Normal file
1
lib/js/extra/headjs/dist/0.97a/head.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
17
lib/js/extra/headjs/dist/0.98/README.md
vendored
Normal file
17
lib/js/extra/headjs/dist/0.98/README.md
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
#Prepackaged Files
|
||||
|
||||
###head.js / head.min.js
|
||||
|
||||
- Complete package containing: core.js, css3.js, and load.js
|
||||
|
||||
###head.css3.js / head.css3.min.js
|
||||
|
||||
- Package containing: core.js and css3.js
|
||||
|
||||
###head.core.js / head.core.min.js
|
||||
|
||||
- Package containing only core.js
|
||||
|
||||
###head.load.js / head.load.min.js
|
||||
|
||||
- Package containing only load.js
|
26
lib/js/extra/headjs/dist/0.98/changelog.txt
vendored
Normal file
26
lib/js/extra/headjs/dist/0.98/changelog.txt
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
0.98 (2012-11-09)
|
||||
- Load: Fixed loading bug in IE10
|
||||
- Load: Corrected some issues with loading from inside <head>
|
||||
- Load: Rewrite of large parts of code base
|
||||
- Started to massively document the sourcecode :)
|
||||
- Css3: moved "touch" detection from core to here
|
||||
- Css3: added "retina" detection
|
||||
- Css3: replaced "font-face" detection that was using "Conditional Comments" with simplisitc browser version detection
|
||||
- Core: Added gt, gte, lte, eq classes to width detection (lt existed already)
|
||||
- Core: Added gt, gte, lt, lte, eq classes for browser vendor & version detection
|
||||
- By default only lt/gt classes are activated
|
||||
- You can of course configure to your likings via head_conf
|
||||
|
||||
0.97a (2012-10-20)
|
||||
- Updated QUnit & got unit tests running again
|
||||
- Swictched to "use strict"
|
||||
- Fixed up some variable usage
|
||||
- Added browser detections other than just for ie-lt
|
||||
- updated browser regexes (firefox, safari, opera, ios, android, webkit)
|
||||
- detect if browser is: desktop, mobile, touch enabled
|
||||
- detect portrait/landscape mode
|
||||
- html5 shim now only triggers on ie-lt9
|
||||
- added a throttle to onResize, since some browsers fire tons of events/sec
|
||||
- added corrected height/width measurements, but only exposed via new object: head.screen
|
||||
- contains height/width, innerHeight/innerWidth, outerHeight/outerWidth
|
||||
- force all css router names to lowercase just in case ppl try typing in names with wierd casings
|
302
lib/js/extra/headjs/dist/0.98/head.core.js
vendored
Normal file
302
lib/js/extra/headjs/dist/0.98/head.core.js
vendored
Normal file
|
@ -0,0 +1,302 @@
|
|||
/*!
|
||||
* HeadJS The only script in your <HEAD>
|
||||
* Author Tero Piirainen (tipiirai)
|
||||
* Maintainer Robert Hoffmann (itechnology)
|
||||
* License MIT / http://bit.ly/mit-license
|
||||
*
|
||||
* Version 0.98
|
||||
* http://headjs.com
|
||||
*/
|
||||
; (function (win, undefined) {
|
||||
"use strict";
|
||||
|
||||
// gt, gte, lt, lte, eq breakpoints would have been more simple to write as ['gt','gte','lt','lte','eq']
|
||||
// but then we would have had to loop over the collection on each resize() event,
|
||||
// a simple object with a direct access to true/false is therefore much more efficient
|
||||
var doc = win.document,
|
||||
nav = win.navigator,
|
||||
loc = win.location,
|
||||
html = doc.documentElement,
|
||||
klass = [],
|
||||
conf = {
|
||||
screens : [240, 320, 480, 640, 768, 800, 1024, 1280, 1440, 1680, 1920],
|
||||
screensCss: { "gt": true, "gte": false, "lt": true, "lte": false, "eq": false },
|
||||
browsers : [
|
||||
{ ie : { min: 6, max: 10 } }
|
||||
//,{ chrome : { min: 8, max: 24 } }
|
||||
//,{ ff : { min: 3, max: 19 } }
|
||||
//,{ ios : { min: 3, max: 6 } }
|
||||
//,{ android: { min: 2, max: 4 } }
|
||||
//,{ webkit : { min: 9, max: 12 } }
|
||||
//,{ opera : { min: 9, max: 12 } }
|
||||
],
|
||||
browserCss: { "gt": true, "gte": false, "lt": true, "lte": false, "eq": true },
|
||||
section : "-section",
|
||||
page : "-page",
|
||||
head : "head"
|
||||
};
|
||||
|
||||
if (win.head_conf) {
|
||||
for (var item in win.head_conf) {
|
||||
if (win.head_conf[item] !== undefined) {
|
||||
conf[item] = win.head_conf[item];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function pushClass(name) {
|
||||
klass[klass.length] = name;
|
||||
}
|
||||
|
||||
function removeClass(name) {
|
||||
var re = new RegExp("\\b" + name + "\\b");
|
||||
html.className = html.className.replace(re, '');
|
||||
}
|
||||
|
||||
function each(arr, fn) {
|
||||
for (var i = 0, l = arr.length; i < l; i++) {
|
||||
fn.call(arr, arr[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
// API
|
||||
var api = win[conf.head] = function () {
|
||||
api.ready.apply(null, arguments);
|
||||
};
|
||||
|
||||
api.feature = function (key, enabled, queue) {
|
||||
|
||||
// internal: apply all classes
|
||||
if (!key) {
|
||||
html.className += ' ' + klass.join(' ');
|
||||
klass = [];
|
||||
return api;
|
||||
}
|
||||
|
||||
if (Object.prototype.toString.call(enabled) === '[object Function]') {
|
||||
enabled = enabled.call();
|
||||
}
|
||||
|
||||
pushClass((enabled ? '' : 'no-') + key);
|
||||
api[key] = !!enabled;
|
||||
|
||||
// apply class to HTML element
|
||||
if (!queue) {
|
||||
removeClass('no-' + key);
|
||||
removeClass(key);
|
||||
api.feature();
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
// no queue here, so we can remove any eventual pre-existing no-js class
|
||||
api.feature("js", true);
|
||||
|
||||
// browser type & version
|
||||
var ua = nav.userAgent.toLowerCase(),
|
||||
mobile = /mobile|midp/.test(ua);
|
||||
|
||||
// useful for enabling/disabling feature (we can consider a desktop navigator to have more cpu/gpu power)
|
||||
api.feature("mobile" , mobile , true);
|
||||
api.feature("desktop", !mobile, true);
|
||||
|
||||
// http://www.zytrax.com/tech/web/browser_ids.htm
|
||||
// http://www.zytrax.com/tech/web/mobile_ids.html
|
||||
ua = /(chrome|firefox)[ \/]([\w.]+)/.exec(ua) || // Chrome & Firefox
|
||||
/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile IOS
|
||||
/(android)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile Webkit
|
||||
/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Safari & Opera
|
||||
/(msie) ([\w.]+)/.exec(ua) || [];
|
||||
|
||||
|
||||
var browser = ua[1],
|
||||
version = parseFloat(ua[2]);
|
||||
|
||||
switch (browser) {
|
||||
case 'msie':
|
||||
browser = 'ie';
|
||||
version = doc.documentMode || version;
|
||||
break;
|
||||
|
||||
case 'firefox':
|
||||
browser = 'ff';
|
||||
break;
|
||||
|
||||
case 'ipod':
|
||||
case 'ipad':
|
||||
case 'iphone':
|
||||
browser = 'ios';
|
||||
break;
|
||||
|
||||
case 'webkit':
|
||||
browser = 'safari';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Browser vendor and version
|
||||
api.browser = {
|
||||
name : browser,
|
||||
version: version
|
||||
};
|
||||
api.browser[browser] = true;
|
||||
|
||||
for (var i = 0, l = conf.browsers.length; i < l; i++) {
|
||||
for (var key in conf.browsers[i]) {
|
||||
if (browser === key) {
|
||||
pushClass(key);
|
||||
|
||||
var min = conf.browsers[i][key].min;
|
||||
var max = conf.browsers[i][key].max;
|
||||
|
||||
for (var v = min; v <= max; v++) {
|
||||
if (version > v) {
|
||||
if (conf.browserCss["gt"])
|
||||
pushClass("gt-" + key + v);
|
||||
|
||||
if (conf.browserCss["gte"])
|
||||
pushClass("gte-" + key + v);
|
||||
}
|
||||
|
||||
else if (version < v) {
|
||||
if (conf.browserCss["lt"])
|
||||
pushClass("lt-" + key + v);
|
||||
|
||||
if (conf.browserCss["lte"])
|
||||
pushClass("lte-" + key + v);
|
||||
}
|
||||
|
||||
else if (version === v) {
|
||||
if (conf.browserCss["lte"])
|
||||
pushClass("lte-" + key + v);
|
||||
|
||||
if (conf.browserCss["eq"])
|
||||
pushClass("eq-" + key + v);
|
||||
|
||||
if (conf.browserCss["gte"])
|
||||
pushClass("gte-" + key + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
pushClass('no-' + key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// IE lt9 specific
|
||||
if (browser === "ie" && version < 9) {
|
||||
// HTML5 support : you still need to add html5 css initialization styles to your site
|
||||
// See: assets/html5.css
|
||||
each("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"), function (el) {
|
||||
doc.createElement(el);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// CSS "router"
|
||||
each(loc.pathname.split("/"), function (el, i) {
|
||||
if (this.length > 2 && this[i + 1] !== undefined) {
|
||||
if (i) {
|
||||
pushClass(this.slice(1, i + 1).join("-").toLowerCase() + conf.section);
|
||||
}
|
||||
} else {
|
||||
// pageId
|
||||
var id = el || "index", index = id.indexOf(".");
|
||||
if (index > 0) {
|
||||
id = id.substring(0, index);
|
||||
}
|
||||
|
||||
html.id = id.toLowerCase() + conf.page;
|
||||
|
||||
// on root?
|
||||
if (!i) {
|
||||
pushClass("root" + conf.section);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// basic screen info
|
||||
api.screen = {
|
||||
height: win.screen.height,
|
||||
width : win.screen.width
|
||||
};
|
||||
|
||||
// viewport resolutions: w-100, lt-480, lt-1024 ...
|
||||
function screenSize() {
|
||||
// remove earlier sizes
|
||||
html.className = html.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g, "");
|
||||
|
||||
// Viewport width
|
||||
var iw = win.innerWidth || html.clientWidth,
|
||||
ow = win.outerWidth || win.screen.width;
|
||||
|
||||
api.screen['innerWidth'] = iw;
|
||||
api.screen['outerWidth'] = ow;
|
||||
|
||||
// for debugging purposes, not really useful for anything else
|
||||
pushClass("w-" + iw);
|
||||
|
||||
each(conf.screens, function (width) {
|
||||
if (iw > width) {
|
||||
if (conf.screensCss["gt"])
|
||||
pushClass("gt-" + width);
|
||||
|
||||
if (conf.screensCss["gte"])
|
||||
pushClass("gte-" + width);
|
||||
}
|
||||
|
||||
else if (iw < width) {
|
||||
if (conf.screensCss["lt"])
|
||||
pushClass("lt-" + width);
|
||||
|
||||
if (conf.screensCss["lte"])
|
||||
pushClass("lte-" + width);
|
||||
}
|
||||
|
||||
else if (iw === width) {
|
||||
if (conf.screensCss["lte"])
|
||||
pushClass("lte-" + width);
|
||||
|
||||
if (conf.screensCss["eq"])
|
||||
pushClass("e-q" + width);
|
||||
|
||||
if (conf.screensCss["gte"])
|
||||
pushClass("gte-" + width);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Viewport height
|
||||
var ih = win.innerHeight || html.clientHeight,
|
||||
oh = win.outerHeight || win.screen.height;
|
||||
|
||||
api.screen['innerHeight'] = ih;
|
||||
api.screen['outerHeight'] = oh;
|
||||
|
||||
// no need for onChange event to detect this
|
||||
api.feature("portrait" , (ih > iw));
|
||||
api.feature("landscape", (ih < iw));
|
||||
}
|
||||
|
||||
screenSize();
|
||||
|
||||
// Throttle navigators from triggering too many resize events
|
||||
var resizeId = 0;
|
||||
function onResize() {
|
||||
win.clearTimeout(resizeId);
|
||||
resizeId = win.setTimeout(screenSize, 100);
|
||||
}
|
||||
|
||||
// Manually attach, as to not overwrite existing handler
|
||||
if (win.addEventListener) {
|
||||
win.addEventListener("resize", onResize, false);
|
||||
|
||||
} else {
|
||||
win.attachEvent("onresize", onResize);
|
||||
}
|
||||
})(window);
|
||||
|
6
lib/js/extra/headjs/dist/0.98/head.core.min.js
vendored
Normal file
6
lib/js/extra/headjs/dist/0.98/head.core.min.js
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
(function(b,p){function e(g){l[l.length]=g}function q(g){j.className=j.className.replace(RegExp("\\b"+g+"\\b"),"")}function m(g,c){for(var b=0,a=g.length;b<a;b++)c.call(g,g[b],b)}function r(){j.className=j.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g,"");var g=b.innerWidth||j.clientWidth,a=b.outerWidth||b.screen.width;d.screen.innerWidth=g;d.screen.outerWidth=a;e("w-"+g);m(c.screens,function(a){g>a?(c.screensCss.gt&&e("gt-"+a),c.screensCss.gte&&e("gte-"+
|
||||
a)):g<a?(c.screensCss.lt&&e("lt-"+a),c.screensCss.lte&&e("lte-"+a)):g===a&&(c.screensCss.lte&&e("lte-"+a),c.screensCss.eq&&e("e-q"+a),c.screensCss.gte&&e("gte-"+a))});var a=b.innerHeight||j.clientHeight,f=b.outerHeight||b.screen.height;d.screen.innerHeight=a;d.screen.outerHeight=f;d.feature("portrait",a>g);d.feature("landscape",a<g)}function s(){b.clearTimeout(t);t=b.setTimeout(r,100)}var n=b.document,f=b.navigator,u=b.location,j=n.documentElement,l=[],c={screens:[240,320,480,640,768,800,1024,1280,
|
||||
1440,1680,1920],screensCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!1},browsers:[{ie:{min:6,max:10}}],browserCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!0},section:"-section",page:"-page",head:"head"};if(b.head_conf)for(var a in b.head_conf)b.head_conf[a]!==p&&(c[a]=b.head_conf[a]);var d=b[c.head]=function(){d.ready.apply(null,arguments)};d.feature=function(a,b,c){if(!a)return j.className+=" "+l.join(" "),l=[],d;"[object Function]"===Object.prototype.toString.call(b)&&(b=b.call());e((b?"":"no-")+a);d[a]=!!b;c||(q("no-"+
|
||||
a),q(a),d.feature());return d};d.feature("js",!0);a=f.userAgent.toLowerCase();f=/mobile|midp/.test(a);d.feature("mobile",f,!0);d.feature("desktop",!f,!0);a=/(chrome|firefox)[ \/]([\w.]+)/.exec(a)||/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(android)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||[];f=a[1];a=parseFloat(a[2]);switch(f){case "msie":f="ie";a=n.documentMode||a;break;case "firefox":f="ff";break;case "ipod":case "ipad":case "iphone":f=
|
||||
"ios";break;case "webkit":f="safari"}d.browser={name:f,version:a};d.browser[f]=!0;for(var k=0,v=c.browsers.length;k<v;k++)for(var h in c.browsers[k])if(f===h){e(h);for(var w=c.browsers[k][h].max,i=c.browsers[k][h].min;i<=w;i++)a>i?(c.browserCss.gt&&e("gt-"+h+i),c.browserCss.gte&&e("gte-"+h+i)):a<i?(c.browserCss.lt&&e("lt-"+h+i),c.browserCss.lte&&e("lte-"+h+i)):a===i&&(c.browserCss.lte&&e("lte-"+h+i),c.browserCss.eq&&e("eq-"+h+i),c.browserCss.gte&&e("gte-"+h+i))}else e("no-"+h);"ie"===f&&9>a&&m("abbr article aside audio canvas details figcaption figure footer header hgroup mark meter nav output progress section summary time video".split(" "),
|
||||
function(a){n.createElement(a)});m(u.pathname.split("/"),function(a,b){if(2<this.length&&this[b+1]!==p)b&&e(this.slice(1,b+1).join("-").toLowerCase()+c.section);else{var d=a||"index",f=d.indexOf(".");0<f&&(d=d.substring(0,f));j.id=d.toLowerCase()+c.page;b||e("root"+c.section)}});d.screen={height:b.screen.height,width:b.screen.width};r();var t=0;b.addEventListener?b.addEventListener("resize",s,!1):b.attachEvent("onresize",s)})(window);
|
458
lib/js/extra/headjs/dist/0.98/head.css3.js
vendored
Normal file
458
lib/js/extra/headjs/dist/0.98/head.css3.js
vendored
Normal file
|
@ -0,0 +1,458 @@
|
|||
/*!
|
||||
* HeadJS The only script in your <HEAD>
|
||||
* Author Tero Piirainen (tipiirai)
|
||||
* Maintainer Robert Hoffmann (itechnology)
|
||||
* License MIT / http://bit.ly/mit-license
|
||||
*
|
||||
* Version 0.98
|
||||
* http://headjs.com
|
||||
*/
|
||||
; (function (win, undefined) {
|
||||
"use strict";
|
||||
|
||||
// gt, gte, lt, lte, eq breakpoints would have been more simple to write as ['gt','gte','lt','lte','eq']
|
||||
// but then we would have had to loop over the collection on each resize() event,
|
||||
// a simple object with a direct access to true/false is therefore much more efficient
|
||||
var doc = win.document,
|
||||
nav = win.navigator,
|
||||
loc = win.location,
|
||||
html = doc.documentElement,
|
||||
klass = [],
|
||||
conf = {
|
||||
screens : [240, 320, 480, 640, 768, 800, 1024, 1280, 1440, 1680, 1920],
|
||||
screensCss: { "gt": true, "gte": false, "lt": true, "lte": false, "eq": false },
|
||||
browsers : [
|
||||
{ ie : { min: 6, max: 10 } }
|
||||
//,{ chrome : { min: 8, max: 24 } }
|
||||
//,{ ff : { min: 3, max: 19 } }
|
||||
//,{ ios : { min: 3, max: 6 } }
|
||||
//,{ android: { min: 2, max: 4 } }
|
||||
//,{ webkit : { min: 9, max: 12 } }
|
||||
//,{ opera : { min: 9, max: 12 } }
|
||||
],
|
||||
browserCss: { "gt": true, "gte": false, "lt": true, "lte": false, "eq": true },
|
||||
section : "-section",
|
||||
page : "-page",
|
||||
head : "head"
|
||||
};
|
||||
|
||||
if (win.head_conf) {
|
||||
for (var item in win.head_conf) {
|
||||
if (win.head_conf[item] !== undefined) {
|
||||
conf[item] = win.head_conf[item];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function pushClass(name) {
|
||||
klass[klass.length] = name;
|
||||
}
|
||||
|
||||
function removeClass(name) {
|
||||
var re = new RegExp("\\b" + name + "\\b");
|
||||
html.className = html.className.replace(re, '');
|
||||
}
|
||||
|
||||
function each(arr, fn) {
|
||||
for (var i = 0, l = arr.length; i < l; i++) {
|
||||
fn.call(arr, arr[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
// API
|
||||
var api = win[conf.head] = function () {
|
||||
api.ready.apply(null, arguments);
|
||||
};
|
||||
|
||||
api.feature = function (key, enabled, queue) {
|
||||
|
||||
// internal: apply all classes
|
||||
if (!key) {
|
||||
html.className += ' ' + klass.join(' ');
|
||||
klass = [];
|
||||
return api;
|
||||
}
|
||||
|
||||
if (Object.prototype.toString.call(enabled) === '[object Function]') {
|
||||
enabled = enabled.call();
|
||||
}
|
||||
|
||||
pushClass((enabled ? '' : 'no-') + key);
|
||||
api[key] = !!enabled;
|
||||
|
||||
// apply class to HTML element
|
||||
if (!queue) {
|
||||
removeClass('no-' + key);
|
||||
removeClass(key);
|
||||
api.feature();
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
// no queue here, so we can remove any eventual pre-existing no-js class
|
||||
api.feature("js", true);
|
||||
|
||||
// browser type & version
|
||||
var ua = nav.userAgent.toLowerCase(),
|
||||
mobile = /mobile|midp/.test(ua);
|
||||
|
||||
// useful for enabling/disabling feature (we can consider a desktop navigator to have more cpu/gpu power)
|
||||
api.feature("mobile" , mobile , true);
|
||||
api.feature("desktop", !mobile, true);
|
||||
|
||||
// http://www.zytrax.com/tech/web/browser_ids.htm
|
||||
// http://www.zytrax.com/tech/web/mobile_ids.html
|
||||
ua = /(chrome|firefox)[ \/]([\w.]+)/.exec(ua) || // Chrome & Firefox
|
||||
/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile IOS
|
||||
/(android)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile Webkit
|
||||
/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Safari & Opera
|
||||
/(msie) ([\w.]+)/.exec(ua) || [];
|
||||
|
||||
|
||||
var browser = ua[1],
|
||||
version = parseFloat(ua[2]);
|
||||
|
||||
switch (browser) {
|
||||
case 'msie':
|
||||
browser = 'ie';
|
||||
version = doc.documentMode || version;
|
||||
break;
|
||||
|
||||
case 'firefox':
|
||||
browser = 'ff';
|
||||
break;
|
||||
|
||||
case 'ipod':
|
||||
case 'ipad':
|
||||
case 'iphone':
|
||||
browser = 'ios';
|
||||
break;
|
||||
|
||||
case 'webkit':
|
||||
browser = 'safari';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Browser vendor and version
|
||||
api.browser = {
|
||||
name : browser,
|
||||
version: version
|
||||
};
|
||||
api.browser[browser] = true;
|
||||
|
||||
for (var i = 0, l = conf.browsers.length; i < l; i++) {
|
||||
for (var key in conf.browsers[i]) {
|
||||
if (browser === key) {
|
||||
pushClass(key);
|
||||
|
||||
var min = conf.browsers[i][key].min;
|
||||
var max = conf.browsers[i][key].max;
|
||||
|
||||
for (var v = min; v <= max; v++) {
|
||||
if (version > v) {
|
||||
if (conf.browserCss["gt"])
|
||||
pushClass("gt-" + key + v);
|
||||
|
||||
if (conf.browserCss["gte"])
|
||||
pushClass("gte-" + key + v);
|
||||
}
|
||||
|
||||
else if (version < v) {
|
||||
if (conf.browserCss["lt"])
|
||||
pushClass("lt-" + key + v);
|
||||
|
||||
if (conf.browserCss["lte"])
|
||||
pushClass("lte-" + key + v);
|
||||
}
|
||||
|
||||
else if (version === v) {
|
||||
if (conf.browserCss["lte"])
|
||||
pushClass("lte-" + key + v);
|
||||
|
||||
if (conf.browserCss["eq"])
|
||||
pushClass("eq-" + key + v);
|
||||
|
||||
if (conf.browserCss["gte"])
|
||||
pushClass("gte-" + key + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
pushClass('no-' + key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// IE lt9 specific
|
||||
if (browser === "ie" && version < 9) {
|
||||
// HTML5 support : you still need to add html5 css initialization styles to your site
|
||||
// See: assets/html5.css
|
||||
each("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"), function (el) {
|
||||
doc.createElement(el);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// CSS "router"
|
||||
each(loc.pathname.split("/"), function (el, i) {
|
||||
if (this.length > 2 && this[i + 1] !== undefined) {
|
||||
if (i) {
|
||||
pushClass(this.slice(1, i + 1).join("-").toLowerCase() + conf.section);
|
||||
}
|
||||
} else {
|
||||
// pageId
|
||||
var id = el || "index", index = id.indexOf(".");
|
||||
if (index > 0) {
|
||||
id = id.substring(0, index);
|
||||
}
|
||||
|
||||
html.id = id.toLowerCase() + conf.page;
|
||||
|
||||
// on root?
|
||||
if (!i) {
|
||||
pushClass("root" + conf.section);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// basic screen info
|
||||
api.screen = {
|
||||
height: win.screen.height,
|
||||
width : win.screen.width
|
||||
};
|
||||
|
||||
// viewport resolutions: w-100, lt-480, lt-1024 ...
|
||||
function screenSize() {
|
||||
// remove earlier sizes
|
||||
html.className = html.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g, "");
|
||||
|
||||
// Viewport width
|
||||
var iw = win.innerWidth || html.clientWidth,
|
||||
ow = win.outerWidth || win.screen.width;
|
||||
|
||||
api.screen['innerWidth'] = iw;
|
||||
api.screen['outerWidth'] = ow;
|
||||
|
||||
// for debugging purposes, not really useful for anything else
|
||||
pushClass("w-" + iw);
|
||||
|
||||
each(conf.screens, function (width) {
|
||||
if (iw > width) {
|
||||
if (conf.screensCss["gt"])
|
||||
pushClass("gt-" + width);
|
||||
|
||||
if (conf.screensCss["gte"])
|
||||
pushClass("gte-" + width);
|
||||
}
|
||||
|
||||
else if (iw < width) {
|
||||
if (conf.screensCss["lt"])
|
||||
pushClass("lt-" + width);
|
||||
|
||||
if (conf.screensCss["lte"])
|
||||
pushClass("lte-" + width);
|
||||
}
|
||||
|
||||
else if (iw === width) {
|
||||
if (conf.screensCss["lte"])
|
||||
pushClass("lte-" + width);
|
||||
|
||||
if (conf.screensCss["eq"])
|
||||
pushClass("e-q" + width);
|
||||
|
||||
if (conf.screensCss["gte"])
|
||||
pushClass("gte-" + width);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Viewport height
|
||||
var ih = win.innerHeight || html.clientHeight,
|
||||
oh = win.outerHeight || win.screen.height;
|
||||
|
||||
api.screen['innerHeight'] = ih;
|
||||
api.screen['outerHeight'] = oh;
|
||||
|
||||
// no need for onChange event to detect this
|
||||
api.feature("portrait" , (ih > iw));
|
||||
api.feature("landscape", (ih < iw));
|
||||
}
|
||||
|
||||
screenSize();
|
||||
|
||||
// Throttle navigators from triggering too many resize events
|
||||
var resizeId = 0;
|
||||
function onResize() {
|
||||
win.clearTimeout(resizeId);
|
||||
resizeId = win.setTimeout(screenSize, 100);
|
||||
}
|
||||
|
||||
// Manually attach, as to not overwrite existing handler
|
||||
if (win.addEventListener) {
|
||||
win.addEventListener("resize", onResize, false);
|
||||
|
||||
} else {
|
||||
win.attachEvent("onresize", onResize);
|
||||
}
|
||||
})(window);
|
||||
|
||||
/*!
|
||||
* HeadJS The only script in your <HEAD>
|
||||
* Author Tero Piirainen (tipiirai)
|
||||
* Maintainer Robert Hoffmann (itechnology)
|
||||
* License MIT / http://bit.ly/mit-license
|
||||
*
|
||||
* Version 0.98
|
||||
* http://headjs.com
|
||||
*/
|
||||
;(function(win, undefined) {
|
||||
"use strict";
|
||||
|
||||
var doc = win.document,
|
||||
/*
|
||||
To add a new test:
|
||||
|
||||
head.feature("video", function() {
|
||||
var tag = document.createElement('video');
|
||||
return !!tag.canPlayType;
|
||||
});
|
||||
|
||||
Good place to grab more tests
|
||||
|
||||
https://github.com/Modernizr/Modernizr/blob/master/modernizr.js
|
||||
*/
|
||||
|
||||
/* CSS modernizer */
|
||||
el = doc.createElement("i"),
|
||||
style = el.style,
|
||||
prefs = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '),
|
||||
domPrefs = 'Webkit Moz O ms Khtml'.split(' '),
|
||||
|
||||
headVar = win.head_conf && win.head_conf.head || "head",
|
||||
api = win[headVar];
|
||||
|
||||
// Thanks Paul Irish!
|
||||
function testProps(props) {
|
||||
for (var i in props) {
|
||||
if (style[props[i]] !== undefined) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function testAll(prop) {
|
||||
var camel = prop.charAt(0).toUpperCase() + prop.substr(1),
|
||||
props = (prop + ' ' + domPrefs.join(camel + ' ') + camel).split(' ');
|
||||
|
||||
return !!testProps(props);
|
||||
}
|
||||
|
||||
var tests = {
|
||||
gradient: function() {
|
||||
var s1 = 'background-image:',
|
||||
s2 = 'gradient(linear,left top,right bottom,from(#9f9),to(#fff));',
|
||||
s3 = 'linear-gradient(left top,#eee,#fff);';
|
||||
|
||||
style.cssText = (s1 + prefs.join(s2 + s1) + prefs.join(s3 + s1)).slice(0,-s1.length);
|
||||
return !!style.backgroundImage;
|
||||
},
|
||||
|
||||
rgba: function() {
|
||||
style.cssText = "background-color:rgba(0,0,0,0.5)";
|
||||
return !!style.backgroundColor;
|
||||
},
|
||||
|
||||
opacity: function() {
|
||||
return el.style.opacity === "";
|
||||
},
|
||||
|
||||
textshadow: function() {
|
||||
return style.textShadow === '';
|
||||
},
|
||||
|
||||
multiplebgs: function() {
|
||||
style.cssText = "background:url(//:),url(//:),red url(//:)";
|
||||
return new RegExp("(url\\s*\\(.*?){3}").test(style.background);
|
||||
},
|
||||
|
||||
boxshadow: function() {
|
||||
return testAll("boxShadow");
|
||||
},
|
||||
|
||||
borderimage: function() {
|
||||
return testAll("borderImage");
|
||||
},
|
||||
|
||||
borderradius: function() {
|
||||
return testAll("borderRadius");
|
||||
},
|
||||
|
||||
cssreflections: function() {
|
||||
return testAll("boxReflect");
|
||||
},
|
||||
|
||||
csstransforms: function() {
|
||||
return testAll("transform");
|
||||
},
|
||||
|
||||
csstransitions: function() {
|
||||
return testAll("transition");
|
||||
},
|
||||
touch: function () {
|
||||
return 'ontouchstart' in win;
|
||||
},
|
||||
retina: function () {
|
||||
return (win.devicePixelRatio > 1);
|
||||
},
|
||||
|
||||
/*
|
||||
font-face support. Uses browser sniffing but is synchronous.
|
||||
http://paulirish.com/2009/font-face-feature-detection/
|
||||
*/
|
||||
fontface: function() {
|
||||
var browser = api.browser.name, version = api.browser.version;
|
||||
|
||||
switch (browser) {
|
||||
case "ie":
|
||||
return version >= 9;
|
||||
|
||||
case "chrome":
|
||||
return version >= 13;
|
||||
|
||||
case "ff":
|
||||
return version >= 6;
|
||||
|
||||
case "ios":
|
||||
return version >= 5;
|
||||
|
||||
case "android":
|
||||
return false;
|
||||
|
||||
case "webkit":
|
||||
return version >= 5.1;
|
||||
|
||||
case "opera":
|
||||
return version >= 10;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// queue features
|
||||
for (var key in tests) {
|
||||
if (tests[key]) {
|
||||
api.feature(key, tests[key].call(), true);
|
||||
}
|
||||
}
|
||||
|
||||
// enable features at once
|
||||
api.feature();
|
||||
|
||||
})(window);
|
9
lib/js/extra/headjs/dist/0.98/head.css3.min.js
vendored
Normal file
9
lib/js/extra/headjs/dist/0.98/head.css3.min.js
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
(function(a,q){function d(b){r[r.length]=b}function m(b){j.className=j.className.replace(RegExp("\\b"+b+"\\b"),"")}function h(b,a){for(var d=0,j=b.length;d<j;d++)a.call(b,b[d],d)}function n(){j.className=j.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g,"");var c=a.innerWidth||j.clientWidth,e=a.outerWidth||a.screen.width;f.screen.innerWidth=c;f.screen.outerWidth=e;d("w-"+c);h(b.screens,function(a){c>a?(b.screensCss.gt&&d("gt-"+a),b.screensCss.gte&&d("gte-"+
|
||||
a)):c<a?(b.screensCss.lt&&d("lt-"+a),b.screensCss.lte&&d("lte-"+a)):c===a&&(b.screensCss.lte&&d("lte-"+a),b.screensCss.eq&&d("e-q"+a),b.screensCss.gte&&d("gte-"+a))});var e=a.innerHeight||j.clientHeight,g=a.outerHeight||a.screen.height;f.screen.innerHeight=e;f.screen.outerHeight=g;f.feature("portrait",e>c);f.feature("landscape",e<c)}function s(){a.clearTimeout(t);t=a.setTimeout(n,100)}var k=a.document,e=a.navigator,l=a.location,j=k.documentElement,r=[],b={screens:[240,320,480,640,768,800,1024,1280,
|
||||
1440,1680,1920],screensCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!1},browsers:[{ie:{min:6,max:10}}],browserCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!0},section:"-section",page:"-page",head:"head"};if(a.head_conf)for(var c in a.head_conf)a.head_conf[c]!==q&&(b[c]=a.head_conf[c]);var f=a[b.head]=function(){f.ready.apply(null,arguments)};f.feature=function(a,b,c){if(!a)return j.className+=" "+r.join(" "),r=[],f;"[object Function]"===Object.prototype.toString.call(b)&&(b=b.call());d((b?"":"no-")+a);f[a]=!!b;c||(m("no-"+
|
||||
a),m(a),f.feature());return f};f.feature("js",!0);c=e.userAgent.toLowerCase();e=/mobile|midp/.test(c);f.feature("mobile",e,!0);f.feature("desktop",!e,!0);c=/(chrome|firefox)[ \/]([\w.]+)/.exec(c)||/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(c)||/(android)(?:.*version)?[ \/]([\w.]+)/.exec(c)||/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(c)||/(msie) ([\w.]+)/.exec(c)||[];e=c[1];c=parseFloat(c[2]);switch(e){case "msie":e="ie";c=k.documentMode||c;break;case "firefox":e="ff";break;case "ipod":case "ipad":case "iphone":e=
|
||||
"ios";break;case "webkit":e="safari"}f.browser={name:e,version:c};f.browser[e]=!0;for(var p=0,u=b.browsers.length;p<u;p++)for(var g in b.browsers[p])if(e===g){d(g);for(var v=b.browsers[p][g].max,i=b.browsers[p][g].min;i<=v;i++)c>i?(b.browserCss.gt&&d("gt-"+g+i),b.browserCss.gte&&d("gte-"+g+i)):c<i?(b.browserCss.lt&&d("lt-"+g+i),b.browserCss.lte&&d("lte-"+g+i)):c===i&&(b.browserCss.lte&&d("lte-"+g+i),b.browserCss.eq&&d("eq-"+g+i),b.browserCss.gte&&d("gte-"+g+i))}else d("no-"+g);"ie"===e&&9>c&&h("abbr article aside audio canvas details figcaption figure footer header hgroup mark meter nav output progress section summary time video".split(" "),
|
||||
function(a){k.createElement(a)});h(l.pathname.split("/"),function(a,c){if(2<this.length&&this[c+1]!==q)c&&d(this.slice(1,c+1).join("-").toLowerCase()+b.section);else{var e=a||"index",f=e.indexOf(".");0<f&&(e=e.substring(0,f));j.id=e.toLowerCase()+b.page;c||d("root"+b.section)}});f.screen={height:a.screen.height,width:a.screen.width};n();var t=0;a.addEventListener?a.addEventListener("resize",s,!1):a.attachEvent("onresize",s)})(window);
|
||||
(function(a,q){function d(a){var d=a.charAt(0).toUpperCase()+a.substr(1),a=(a+" "+s.join(d+" ")+d).split(" "),b;a:{for(b in a)if(h[a[b]]!==q){b=!0;break a}b=void 0}return!!b}var m=a.document.createElement("i"),h=m.style,n=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),s=["Webkit","Moz","O","ms","Khtml"],k=a[a.head_conf&&a.head_conf.head||"head"],e={gradient:function(){h.cssText=("background-image:"+n.join("gradient(linear,left top,right bottom,from(#9f9),to(#fff));background-image:")+n.join("linear-gradient(left top,#eee,#fff);background-image:")).slice(0,
|
||||
-17);return!!h.backgroundImage},rgba:function(){h.cssText="background-color:rgba(0,0,0,0.5)";return!!h.backgroundColor},opacity:function(){return""===m.style.opacity},textshadow:function(){return""===h.textShadow},multiplebgs:function(){h.cssText="background:url(//:),url(//:),red url(//:)";return/(url\s*\(.*?){3}/.test(h.background)},boxshadow:function(){return d("boxShadow")},borderimage:function(){return d("borderImage")},borderradius:function(){return d("borderRadius")},cssreflections:function(){return d("boxReflect")},
|
||||
csstransforms:function(){return d("transform")},csstransitions:function(){return d("transition")},touch:function(){return"ontouchstart"in a},retina:function(){return 1<a.devicePixelRatio},fontface:function(){var a=k.browser.version;switch(k.browser.name){case "ie":return 9<=a;case "chrome":return 13<=a;case "ff":return 6<=a;case "ios":return 5<=a;case "android":return!1;case "webkit":return 5.1<=a;case "opera":return 10<=a;default:return!1}}},l;for(l in e)e[l]&&k.feature(l,e[l].call(),!0);k.feature()})(window);
|
1077
lib/js/extra/headjs/dist/0.98/head.js
vendored
Normal file
1077
lib/js/extra/headjs/dist/0.98/head.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
619
lib/js/extra/headjs/dist/0.98/head.load.js
vendored
Normal file
619
lib/js/extra/headjs/dist/0.98/head.load.js
vendored
Normal file
|
@ -0,0 +1,619 @@
|
|||
/*!
|
||||
* HeadJS The only script in your <HEAD>
|
||||
* Author Tero Piirainen (tipiirai)
|
||||
* Maintainer Robert Hoffmann (itechnology)
|
||||
* License MIT / http://bit.ly/mit-license
|
||||
*
|
||||
* Version 0.98
|
||||
* http://headjs.com
|
||||
*/
|
||||
; (function (win, undefined) {
|
||||
"use strict";
|
||||
|
||||
var doc = win.document,
|
||||
domWaiters = [],
|
||||
queue = [], // waiters for the "head ready" event
|
||||
handlers = {}, // user functions waiting for events
|
||||
scripts = {}, // loadable scripts in different states
|
||||
isAsync = "async" in doc.createElement("script") || "MozAppearance" in doc.documentElement.style || win.opera,
|
||||
isHeadReady,
|
||||
isDomReady,
|
||||
|
||||
/*** public API ***/
|
||||
headVar = win.head_conf && win.head_conf.head || "head",
|
||||
api = win[headVar] = (win[headVar] || function () { api.ready.apply(null, arguments); }),
|
||||
|
||||
// states
|
||||
PRELOADING = 1,
|
||||
PRELOADED = 2,
|
||||
LOADING = 3,
|
||||
LOADED = 4;
|
||||
|
||||
// Method 1: simply load and let browser take care of ordering
|
||||
if (isAsync) {
|
||||
api.load = function () {
|
||||
///<summary>
|
||||
/// INFO: use cases
|
||||
/// head.load("http://domain.com/file.js","http://domain.com/file.js", callBack)
|
||||
/// head.load({ label1: "http://domain.com/file.js" }, { label2: "http://domain.com/file.js" }, callBack)
|
||||
///</summary>
|
||||
var args = arguments,
|
||||
callback = args[args.length - 1],
|
||||
items = {};
|
||||
|
||||
if (!isFunction(callback)) {
|
||||
callback = null;
|
||||
}
|
||||
|
||||
each(args, function (item, i) {
|
||||
if (item !== callback) {
|
||||
item = getScript(item);
|
||||
items[item.name] = item;
|
||||
|
||||
load(item, callback && i === args.length - 2 ? function () {
|
||||
if (allLoaded(items)) {
|
||||
one(callback);
|
||||
}
|
||||
|
||||
} : null);
|
||||
}
|
||||
});
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
|
||||
// Method 2: preload with text/cache hack
|
||||
} else {
|
||||
api.load = function () {
|
||||
var args = arguments,
|
||||
rest = [].slice.call(args, 1),
|
||||
next = rest[0];
|
||||
|
||||
// wait for a while. immediate execution causes some browsers to ignore caching
|
||||
if (!isHeadReady) {
|
||||
queue.push(function () {
|
||||
api.load.apply(null, args);
|
||||
});
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
// multiple arguments
|
||||
if (next) {
|
||||
/* Preload with text/cache hack (not good!)
|
||||
* http://blog.getify.com/on-script-loaders/
|
||||
* http://www.nczonline.net/blog/2010/12/21/thoughts-on-script-loaders/
|
||||
* If caching is not configured correctly on the server, then scripts will load twice !
|
||||
**************************************************************************************/
|
||||
each(rest, function (item) {
|
||||
if (!isFunction(item)) {
|
||||
preLoad(getScript(item));
|
||||
}
|
||||
});
|
||||
|
||||
// execute
|
||||
load(getScript(args[0]), isFunction(next) ? next : function () {
|
||||
api.load.apply(null, rest);
|
||||
});
|
||||
|
||||
|
||||
// single script
|
||||
}
|
||||
else {
|
||||
load(getScript(args[0]));
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
}
|
||||
|
||||
// INFO: for retro compatibility
|
||||
api.js = api.load;
|
||||
|
||||
api.test = function (test, success, failure, callback) {
|
||||
///<summary>
|
||||
/// INFO: use cases:
|
||||
/// head.test(condition, null , "file.NOk" , callback);
|
||||
/// head.test(condition, "fileOk.js", null , callback);
|
||||
/// head.test(condition, "fileOk.js", "file.NOk" , callback);
|
||||
/// head.test(condition, "fileOk.js", ["file.NOk", "file.NOk"], callback);
|
||||
/// head.test({
|
||||
/// test : condition,
|
||||
/// success : [{ label1: "file1Ok.js" }, { label2: "file2Ok.js" }],
|
||||
/// failure : [{ label1: "file1NOk.js" }, { label2: "file2NOk.js" }],
|
||||
/// callback: callback
|
||||
/// );
|
||||
/// head.test({
|
||||
/// test : condition,
|
||||
/// success : ["file1Ok.js" , "file2Ok.js"],
|
||||
/// failure : ["file1NOk.js", "file2NOk.js"],
|
||||
/// callback: callback
|
||||
/// );
|
||||
///</summary>
|
||||
var obj = (typeof test === 'object') ? test : {
|
||||
test: test,
|
||||
success: !!success ? isArray(success) ? success : [success] : false,
|
||||
failure: !!failure ? isArray(failure) ? failure : [failure] : false,
|
||||
callback: callback || noop
|
||||
};
|
||||
|
||||
// Test Passed ?
|
||||
var passed = !!obj.test;
|
||||
|
||||
// Do we have a success case
|
||||
if (passed && !!obj.success) {
|
||||
obj.success.push(obj.callback);
|
||||
api.load.apply(null, obj.success);
|
||||
}
|
||||
// Do we have a fail case
|
||||
else if (!passed && !!obj.failure) {
|
||||
obj.failure.push(obj.callback);
|
||||
api.load.apply(null, obj.failure);
|
||||
}
|
||||
else {
|
||||
callback();
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
api.ready = function (key, callback) {
|
||||
///<summary>
|
||||
/// INFO: use cases:
|
||||
/// head.ready(callBack)
|
||||
/// head.ready(document , callBack)
|
||||
/// head.ready("file.js", callBack);
|
||||
/// head.ready("label" , callBack);
|
||||
///</summary>
|
||||
|
||||
// DOM ready check: head.ready(document, function() { });
|
||||
if (key === doc) {
|
||||
if (isDomReady) {
|
||||
one(callback);
|
||||
}
|
||||
else {
|
||||
domWaiters.push(callback);
|
||||
}
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
// shift arguments
|
||||
if (isFunction(key)) {
|
||||
callback = key;
|
||||
key = "ALL";
|
||||
}
|
||||
|
||||
// make sure arguments are sane
|
||||
if (typeof key !== 'string' || !isFunction(callback)) {
|
||||
return api;
|
||||
}
|
||||
|
||||
// This can also be called when we trigger events based on filenames & labels
|
||||
var script = scripts[key];
|
||||
|
||||
// script already loaded --> execute and return
|
||||
if (script && script.state === LOADED || key === 'ALL' && allLoaded() && isDomReady) {
|
||||
one(callback);
|
||||
return api;
|
||||
}
|
||||
|
||||
var arr = handlers[key];
|
||||
if (!arr) {
|
||||
arr = handlers[key] = [callback];
|
||||
}
|
||||
else {
|
||||
arr.push(callback);
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
|
||||
// perform this when DOM is ready
|
||||
api.ready(doc, function () {
|
||||
|
||||
if (allLoaded()) {
|
||||
each(handlers.ALL, function (callback) {
|
||||
one(callback);
|
||||
});
|
||||
}
|
||||
|
||||
if (api.feature) {
|
||||
api.feature("domloaded", true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* private functions
|
||||
*********************/
|
||||
function noop() {
|
||||
// does nothing
|
||||
}
|
||||
|
||||
function each(arr, callback) {
|
||||
if (!arr) {
|
||||
return;
|
||||
}
|
||||
|
||||
// arguments special type
|
||||
if (typeof arr === 'object') {
|
||||
arr = [].slice.call(arr);
|
||||
}
|
||||
|
||||
// do the job
|
||||
for (var i = 0, l = arr.length; i < l; i++) {
|
||||
callback.call(arr, arr[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
/* A must read: http://bonsaiden.github.com/JavaScript-Garden
|
||||
************************************************************/
|
||||
function is(type, obj) {
|
||||
var clas = Object.prototype.toString.call(obj).slice(8, -1);
|
||||
return obj !== undefined && obj !== null && clas === type;
|
||||
}
|
||||
|
||||
function isFunction(item) {
|
||||
return is("Function", item);
|
||||
}
|
||||
|
||||
function isArray(item) {
|
||||
return is("Array", item);
|
||||
}
|
||||
|
||||
function toLabel(url) {
|
||||
///<summary>Converts a url to a file label</summary>
|
||||
var items = url.split("/"),
|
||||
name = items[items.length - 1],
|
||||
i = name.indexOf("?");
|
||||
|
||||
return i !== -1 ? name.substring(0, i) : name;
|
||||
}
|
||||
|
||||
// INFO: this look like a "im triggering callbacks all over the place, but only wanna run it one time function" ..should try to make everything work without it if possible
|
||||
// INFO: Even better. Look into promises/defered's like jQuery is doing
|
||||
function one(callback) {
|
||||
///<summary>Execute a callback only once</summary>
|
||||
callback = callback || noop;
|
||||
|
||||
if (callback._done) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback();
|
||||
callback._done = 1;
|
||||
}
|
||||
|
||||
function getScript(item) {
|
||||
///<summary>
|
||||
/// Gets a script in the form of
|
||||
/// {
|
||||
/// name: label,
|
||||
/// url : url
|
||||
/// }
|
||||
///</summary>
|
||||
var script = {};
|
||||
|
||||
if (typeof item === 'object') {
|
||||
for (var label in item) {
|
||||
if (!!item[label]) {
|
||||
script = {
|
||||
name: label,
|
||||
url: item[label]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
script = {
|
||||
name: toLabel(item),
|
||||
url: item
|
||||
};
|
||||
}
|
||||
|
||||
// is the item already existant
|
||||
var existing = scripts[script.name];
|
||||
if (existing && existing.url === script.url) {
|
||||
return existing;
|
||||
}
|
||||
|
||||
scripts[script.name] = script;
|
||||
return script;
|
||||
}
|
||||
|
||||
function allLoaded(items) {
|
||||
items = items || scripts;
|
||||
|
||||
for (var name in items) {
|
||||
if (items.hasOwnProperty(name) && items[name].state !== LOADED) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function onPreload(script) {
|
||||
script.state = PRELOADED;
|
||||
|
||||
each(script.onpreload, function (afterPreload) {
|
||||
afterPreload.call();
|
||||
});
|
||||
}
|
||||
|
||||
function preLoad(script, callback) {
|
||||
if (script.state === undefined) {
|
||||
|
||||
script.state = PRELOADING;
|
||||
script.onpreload = [];
|
||||
|
||||
scriptTag({ src: script.url, type: 'cache' }, function () {
|
||||
onPreload(script);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function load(script, callback) {
|
||||
///<summary>Used with normal loading logic</summary>
|
||||
callback = callback || noop;
|
||||
|
||||
if (script.state === LOADED) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
// INFO: why would we trigger a ready event when its not really loaded yet ?
|
||||
if (script.state === LOADING) {
|
||||
api.ready(script.name, callback);
|
||||
return;
|
||||
}
|
||||
|
||||
if (script.state === PRELOADING) {
|
||||
script.onpreload.push(function () {
|
||||
load(script, callback);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
script.state = LOADING;
|
||||
|
||||
scriptTag(script.url, function () {
|
||||
script.state = LOADED;
|
||||
callback();
|
||||
|
||||
// handlers for this script
|
||||
each(handlers[script.name], function (fn) {
|
||||
one(fn);
|
||||
});
|
||||
|
||||
// dom is ready & no scripts are queued for loading
|
||||
// INFO: shouldn't we be doing the same test above ?
|
||||
if (isDomReady && allLoaded()) {
|
||||
each(handlers.ALL, function (fn) {
|
||||
one(fn);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function scriptTag(src, callback) {
|
||||
var s;
|
||||
|
||||
if (/\.css[^\.]*$/.test(src)) {
|
||||
s = doc.createElement('link');
|
||||
s.type = 'text/' + (src.type || 'css');
|
||||
s.rel = 'stylesheet';
|
||||
s.href = src.src || src;
|
||||
}
|
||||
else {
|
||||
s = doc.createElement('script');
|
||||
s.type = 'text/' + (src.type || 'javascript');
|
||||
s.src = src.src || src;
|
||||
}
|
||||
|
||||
loadAsset(s, callback);
|
||||
}
|
||||
|
||||
/* Parts inspired from: https://github.com/cujojs/curl
|
||||
******************************************************/
|
||||
function loadAsset(s, callback) {
|
||||
callback = callback || noop;
|
||||
|
||||
s.onload = s.onreadystatechange = process;
|
||||
s.onerror = error;
|
||||
|
||||
/* Good read, but doesn't give much hope !
|
||||
* http://blog.getify.com/on-script-loaders/
|
||||
* http://www.nczonline.net/blog/2010/12/21/thoughts-on-script-loaders/
|
||||
* https://hacks.mozilla.org/2009/06/defer/
|
||||
*/
|
||||
|
||||
// ASYNC: load in parellel and execute as soon as possible
|
||||
s.async = false;
|
||||
// DEFER: load in parallel but maintain execution order
|
||||
s.defer = false;
|
||||
|
||||
function error(event) {
|
||||
// need some more detailed error handling here
|
||||
|
||||
// release event listeners
|
||||
s.onload = s.onreadystatechange = s.onerror = null;
|
||||
|
||||
// do callback
|
||||
callback();
|
||||
}
|
||||
|
||||
function process(event) {
|
||||
event = event || win.event;
|
||||
|
||||
// IE 7/8 (2 events on 1st load)
|
||||
// 1) event.type = readystatechange, s.readyState = loading
|
||||
// 2) event.type = readystatechange, s.readyState = loaded
|
||||
|
||||
// IE 7/8 (1 event on reload)
|
||||
// 1) event.type = readystatechange, s.readyState = complete
|
||||
|
||||
// event.type === 'readystatechange' && /loaded|complete/.test(s.readyState)
|
||||
|
||||
// IE 9 (3 events on 1st load)
|
||||
// 1) event.type = readystatechange, s.readyState = loading
|
||||
// 2) event.type = readystatechange, s.readyState = loaded
|
||||
// 3) event.type = load , s.readyState = loaded
|
||||
|
||||
// IE 9 (2 events on reload)
|
||||
// 1) event.type = readystatechange, s.readyState = complete
|
||||
// 2) event.type = load , s.readyState = complete
|
||||
|
||||
// event.type === 'load' && /loaded|complete/.test(s.readyState)
|
||||
// event.type === 'readystatechange' && /loaded|complete/.test(s.readyState)
|
||||
|
||||
// IE 10 (3 events on 1st load)
|
||||
// 1) event.type = readystatechange, s.readyState = loading
|
||||
// 2) event.type = load , s.readyState = complete
|
||||
// 3) event.type = readystatechange, s.readyState = loaded
|
||||
|
||||
// IE 10 (3 events on reload)
|
||||
// 1) event.type = readystatechange, s.readyState = loaded
|
||||
// 2) event.type = load , s.readyState = complete
|
||||
// 3) event.type = readystatechange, s.readyState = complete
|
||||
|
||||
// event.type === 'load' && /loaded|complete/.test(s.readyState)
|
||||
// event.type === 'readystatechange' && /complete/.test(s.readyState)
|
||||
|
||||
// Other Browsers (1 event on 1st load)
|
||||
// 1) event.type = load, s.readyState = undefined
|
||||
|
||||
// Other Browsers (1 event on reload)
|
||||
// 1) event.type = load, s.readyState = undefined
|
||||
|
||||
// event.type == 'load' && s.readyState = undefined
|
||||
|
||||
|
||||
// IE: i hate you, i hate you, i hate you !
|
||||
// I'm sure there are somekind of internal jokes going on at MS, where they break something and have a laugh while we pull our hair out
|
||||
if (event.type === 'load' || /loaded|complete/.test(s.readyState) && doc.documentMode < 9) {
|
||||
// release event listeners
|
||||
s.onload = s.onreadystatechange = s.onerror = null;
|
||||
// do callback
|
||||
callback();
|
||||
}
|
||||
|
||||
// emulates error on browsers that don't create an exception
|
||||
// INFO: timeout not clearing ..why ?
|
||||
//s.timeout = win.setTimeout(function () {
|
||||
// error({ type: "timeout" });
|
||||
//}, 7000);
|
||||
}
|
||||
|
||||
// use insertBefore to keep IE from throwing Operation Aborted (thx Bryan Forbes!)
|
||||
var head = doc['head'] || doc.getElementsByTagName('head')[0];
|
||||
// but insert at end of head, because otherwise if it is a stylesheet, it will not ovverride values
|
||||
head.insertBefore(s, head.lastChild);
|
||||
}
|
||||
|
||||
/* Mix of stuff from jQuery & IEContentLoaded
|
||||
* http://dev.w3.org/html5/spec/the-end.html#the-end
|
||||
***************************************************/
|
||||
function domReady() {
|
||||
// Make sure body exists, at least, in case IE gets a little overzealous (jQuery ticket #5443).
|
||||
if (!doc.body) {
|
||||
// let's not get nasty by setting a timeout too small.. (loop mania guaranteed if scripts are queued)
|
||||
win.clearTimeout(api.readyTimeout);
|
||||
api.readyTimeout = win.setTimeout(domReady, 50);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isDomReady) {
|
||||
isDomReady = true;
|
||||
each(domWaiters, function (fn) {
|
||||
one(fn);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function domContentLoaded() {
|
||||
// W3C
|
||||
if (doc.addEventListener) {
|
||||
doc.removeEventListener("DOMContentLoaded", domContentLoaded, false);
|
||||
domReady();
|
||||
}
|
||||
|
||||
// IE
|
||||
else if (doc.readyState === "complete") {
|
||||
// we're here because readyState === "complete" in oldIE
|
||||
// which is good enough for us to call the dom ready!
|
||||
doc.detachEvent("onreadystatechange", domContentLoaded);
|
||||
domReady();
|
||||
}
|
||||
};
|
||||
|
||||
// Catch cases where ready() is called after the browser event has already occurred.
|
||||
// we once tried to use readyState "interactive" here, but it caused issues like the one
|
||||
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
|
||||
if (doc.readyState === "complete") {
|
||||
domReady();
|
||||
}
|
||||
|
||||
// W3C
|
||||
else if (doc.addEventListener) {
|
||||
doc.addEventListener("DOMContentLoaded", domContentLoaded, false);
|
||||
|
||||
// A fallback to window.onload, that will always work
|
||||
win.addEventListener("load", domReady, false);
|
||||
}
|
||||
|
||||
// IE
|
||||
else {
|
||||
// Ensure firing before onload, maybe late but safe also for iframes
|
||||
doc.attachEvent("onreadystatechange", domContentLoaded);
|
||||
|
||||
// A fallback to window.onload, that will always work
|
||||
win.attachEvent("onload", domReady);
|
||||
|
||||
// If IE and not a frame
|
||||
// continually check to see if the document is ready
|
||||
var top = false;
|
||||
|
||||
try {
|
||||
top = win.frameElement == null && doc.documentElement;
|
||||
} catch (e) { }
|
||||
|
||||
if (top && top.doScroll) {
|
||||
(function doScrollCheck() {
|
||||
if (!isDomReady) {
|
||||
try {
|
||||
// Use the trick by Diego Perini
|
||||
// http://javascript.nwbox.com/IEContentLoaded/
|
||||
top.doScroll("left");
|
||||
} catch (error) {
|
||||
// let's not get nasty by setting a timeout too small.. (loop mania guaranteed if scripts are queued)
|
||||
win.clearTimeout(api.readyTimeout);
|
||||
api.readyTimeout = win.setTimeout(doScrollCheck, 50);
|
||||
return;
|
||||
}
|
||||
|
||||
// and execute any waiting functions
|
||||
domReady();
|
||||
}
|
||||
})();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
We wait for 300 ms before script loading starts. for some reason this is needed
|
||||
to make sure scripts are cached. Not sure why this happens yet. A case study:
|
||||
|
||||
https://github.com/headjs/headjs/issues/closed#issue/83
|
||||
*/
|
||||
setTimeout(function () {
|
||||
isHeadReady = true;
|
||||
each(queue, function (fn) {
|
||||
fn();
|
||||
});
|
||||
|
||||
}, 300);
|
||||
|
||||
})(window);
|
8
lib/js/extra/headjs/dist/0.98/head.load.min.js
vendored
Normal file
8
lib/js/extra/headjs/dist/0.98/head.load.min.js
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
(function(g,x){function n(){}function h(a,b){if(a){"object"===typeof a&&(a=[].slice.call(a));for(var c=0,f=a.length;c<f;c++)b.call(a,a[c],c)}}function w(a,b){var c=Object.prototype.toString.call(b).slice(8,-1);return b!==x&&null!==b&&c===a}function l(a){return w("Function",a)}function i(a){a=a||n;a._done||(a(),a._done=1)}function p(a){var b={};if("object"===typeof a)for(var c in a)a[c]&&(b={name:c,url:a[c]});else b=a.split("/"),b=b[b.length-1],c=b.indexOf("?"),b={name:-1!==c?b.substring(0,c):b,url:a};
|
||||
return(a=q[b.name])&&a.url===b.url?a:q[b.name]=b}function r(a){var a=a||q,b;for(b in a)if(a.hasOwnProperty(b)&&a[b].state!==s)return!1;return!0}function t(a,b){b=b||n;a.state===s?b():a.state===y?d.ready(a.name,b):a.state===z?a.onpreload.push(function(){t(a,b)}):(a.state=y,A(a.url,function(){a.state=s;b();h(m[a.name],function(a){i(a)});k&&r()&&h(m.ALL,function(a){i(a)})}))}function A(a,b){var c;/\.css[^\.]*$/.test(a)?(c=e.createElement("link"),c.type="text/"+(a.type||"css"),c.rel="stylesheet",c.href=
|
||||
a.src||a):(c=e.createElement("script"),c.type="text/"+(a.type||"javascript"),c.src=a.src||a);var f=c,d=b,d=d||n;f.onload=f.onreadystatechange=function(a){a=a||g.event;if("load"===a.type||/loaded|complete/.test(f.readyState)&&9>e.documentMode)f.onload=f.onreadystatechange=f.onerror=null,d()};f.onerror=function(){f.onload=f.onreadystatechange=f.onerror=null;d()};f.async=!1;f.defer=!1;c=e.head||e.getElementsByTagName("head")[0];c.insertBefore(f,c.lastChild)}function j(){e.body?k||(k=!0,h(B,function(a){i(a)})):
|
||||
(g.clearTimeout(d.readyTimeout),d.readyTimeout=g.setTimeout(j,50))}function u(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",u,!1),j()):"complete"===e.readyState&&(e.detachEvent("onreadystatechange",u),j())}var e=g.document,B=[],C=[],m={},q={},F="async"in e.createElement("script")||"MozAppearance"in e.documentElement.style||g.opera,D,k,E=g.head_conf&&g.head_conf.head||"head",d=g[E]=g[E]||function(){d.ready.apply(null,arguments)},z=1,y=3,s=4;d.load=F?function(){var a=arguments,b=a[a.length-
|
||||
1],c={};l(b)||(b=null);h(a,function(d,e){d!==b&&(d=p(d),c[d.name]=d,t(d,b&&e===a.length-2?function(){r(c)&&i(b)}:null))});return d}:function(){var a=arguments,b=[].slice.call(a,1),c=b[0];if(!D)return C.push(function(){d.load.apply(null,a)}),d;c?(h(b,function(a){if(!l(a)){var b=p(a);b.state===x&&(b.state=z,b.onpreload=[],A({src:b.url,type:"cache"},function(){b.state=2;h(b.onpreload,function(a){a.call()})}))}}),t(p(a[0]),l(c)?c:function(){d.load.apply(null,b)})):t(p(a[0]));return d};d.js=d.load;d.test=
|
||||
function(a,b,c,e){a="object"===typeof a?a:{test:a,success:b?w("Array",b)?b:[b]:!1,failure:c?w("Array",c)?c:[c]:!1,callback:e||n};(b=!!a.test)&&a.success?(a.success.push(a.callback),d.load.apply(null,a.success)):!b&&a.failure?(a.failure.push(a.callback),d.load.apply(null,a.failure)):e();return d};d.ready=function(a,b){if(a===e)return k?i(b):B.push(b),d;l(a)&&(b=a,a="ALL");if("string"!==typeof a||!l(b))return d;var c=q[a];if(c&&c.state===s||"ALL"===a&&r()&&k)return i(b),d;(c=m[a])?c.push(b):m[a]=[b];
|
||||
return d};d.ready(e,function(){r()&&h(m.ALL,function(a){i(a)});d.feature&&d.feature("domloaded",!0)});if("complete"===e.readyState)j();else if(e.addEventListener)e.addEventListener("DOMContentLoaded",u,!1),g.addEventListener("load",j,!1);else{e.attachEvent("onreadystatechange",u);g.attachEvent("onload",j);var v=!1;try{v=null==g.frameElement&&e.documentElement}catch(G){}v&&v.doScroll&&function b(){if(!k){try{v.doScroll("left")}catch(c){g.clearTimeout(d.readyTimeout);d.readyTimeout=g.setTimeout(b,50);
|
||||
return}j()}}()}setTimeout(function(){D=!0;h(C,function(b){b()})},300)})(window);
|
17
lib/js/extra/headjs/dist/0.98/head.min.js
vendored
Normal file
17
lib/js/extra/headjs/dist/0.98/head.min.js
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
(function(a,v){function f(a){n[n.length]=a}function l(a){p.className=p.className.replace(RegExp("\\b"+a+"\\b"),"")}function j(a,d){for(var b=0,c=a.length;b<c;b++)d.call(a,a[b],b)}function r(){p.className=p.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g,"");var b=a.innerWidth||p.clientWidth,d=a.outerWidth||a.screen.width;g.screen.innerWidth=b;g.screen.outerWidth=d;f("w-"+b);j(c.screens,function(a){b>a?(c.screensCss.gt&&f("gt-"+a),c.screensCss.gte&&f("gte-"+
|
||||
a)):b<a?(c.screensCss.lt&&f("lt-"+a),c.screensCss.lte&&f("lte-"+a)):b===a&&(c.screensCss.lte&&f("lte-"+a),c.screensCss.eq&&f("e-q"+a),c.screensCss.gte&&f("gte-"+a))});var d=a.innerHeight||p.clientHeight,e=a.outerHeight||a.screen.height;g.screen.innerHeight=d;g.screen.outerHeight=e;g.feature("portrait",d>b);g.feature("landscape",d<b)}function q(){a.clearTimeout(t);t=a.setTimeout(r,100)}var m=a.document,e=a.navigator,s=a.location,p=m.documentElement,n=[],c={screens:[240,320,480,640,768,800,1024,1280,
|
||||
1440,1680,1920],screensCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!1},browsers:[{ie:{min:6,max:10}}],browserCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!0},section:"-section",page:"-page",head:"head"};if(a.head_conf)for(var b in a.head_conf)a.head_conf[b]!==v&&(c[b]=a.head_conf[b]);var g=a[c.head]=function(){g.ready.apply(null,arguments)};g.feature=function(a,b,c){if(!a)return p.className+=" "+n.join(" "),n=[],g;"[object Function]"===Object.prototype.toString.call(b)&&(b=b.call());f((b?"":"no-")+a);g[a]=!!b;c||(l("no-"+
|
||||
a),l(a),g.feature());return g};g.feature("js",!0);b=e.userAgent.toLowerCase();e=/mobile|midp/.test(b);g.feature("mobile",e,!0);g.feature("desktop",!e,!0);b=/(chrome|firefox)[ \/]([\w.]+)/.exec(b)||/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(b)||/(android)(?:.*version)?[ \/]([\w.]+)/.exec(b)||/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(b)||/(msie) ([\w.]+)/.exec(b)||[];e=b[1];b=parseFloat(b[2]);switch(e){case "msie":e="ie";b=m.documentMode||b;break;case "firefox":e="ff";break;case "ipod":case "ipad":case "iphone":e=
|
||||
"ios";break;case "webkit":e="safari"}g.browser={name:e,version:b};g.browser[e]=!0;for(var u=0,w=c.browsers.length;u<w;u++)for(var i in c.browsers[u])if(e===i){f(i);for(var z=c.browsers[u][i].max,k=c.browsers[u][i].min;k<=z;k++)b>k?(c.browserCss.gt&&f("gt-"+i+k),c.browserCss.gte&&f("gte-"+i+k)):b<k?(c.browserCss.lt&&f("lt-"+i+k),c.browserCss.lte&&f("lte-"+i+k)):b===k&&(c.browserCss.lte&&f("lte-"+i+k),c.browserCss.eq&&f("eq-"+i+k),c.browserCss.gte&&f("gte-"+i+k))}else f("no-"+i);"ie"===e&&9>b&&j("abbr article aside audio canvas details figcaption figure footer header hgroup mark meter nav output progress section summary time video".split(" "),
|
||||
function(a){m.createElement(a)});j(s.pathname.split("/"),function(a,b){if(2<this.length&&this[b+1]!==v)b&&f(this.slice(1,b+1).join("-").toLowerCase()+c.section);else{var e=a||"index",g=e.indexOf(".");0<g&&(e=e.substring(0,g));p.id=e.toLowerCase()+c.page;b||f("root"+c.section)}});g.screen={height:a.screen.height,width:a.screen.width};r();var t=0;a.addEventListener?a.addEventListener("resize",q,!1):a.attachEvent("onresize",q)})(window);
|
||||
(function(a,v){function f(a){var f=a.charAt(0).toUpperCase()+a.substr(1),a=(a+" "+q.join(f+" ")+f).split(" "),c;a:{for(c in a)if(j[a[c]]!==v){c=!0;break a}c=void 0}return!!c}var l=a.document.createElement("i"),j=l.style,r=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),q=["Webkit","Moz","O","ms","Khtml"],m=a[a.head_conf&&a.head_conf.head||"head"],e={gradient:function(){j.cssText=("background-image:"+r.join("gradient(linear,left top,right bottom,from(#9f9),to(#fff));background-image:")+r.join("linear-gradient(left top,#eee,#fff);background-image:")).slice(0,
|
||||
-17);return!!j.backgroundImage},rgba:function(){j.cssText="background-color:rgba(0,0,0,0.5)";return!!j.backgroundColor},opacity:function(){return""===l.style.opacity},textshadow:function(){return""===j.textShadow},multiplebgs:function(){j.cssText="background:url(//:),url(//:),red url(//:)";return/(url\s*\(.*?){3}/.test(j.background)},boxshadow:function(){return f("boxShadow")},borderimage:function(){return f("borderImage")},borderradius:function(){return f("borderRadius")},cssreflections:function(){return f("boxReflect")},
|
||||
csstransforms:function(){return f("transform")},csstransitions:function(){return f("transition")},touch:function(){return"ontouchstart"in a},retina:function(){return 1<a.devicePixelRatio},fontface:function(){var a=m.browser.version;switch(m.browser.name){case "ie":return 9<=a;case "chrome":return 13<=a;case "ff":return 6<=a;case "ios":return 5<=a;case "android":return!1;case "webkit":return 5.1<=a;case "opera":return 10<=a;default:return!1}}},s;for(s in e)e[s]&&m.feature(s,e[s].call(),!0);m.feature()})(window);
|
||||
(function(a,v){function f(){}function l(h,a){if(h){"object"===typeof h&&(h=[].slice.call(h));for(var b=0,c=h.length;b<c;b++)a.call(h,h[b],b)}}function j(h,a){var b=Object.prototype.toString.call(a).slice(8,-1);return a!==v&&null!==a&&b===h}function r(a){return j("Function",a)}function q(a){a=a||f;a._done||(a(),a._done=1)}function m(a){var b={};if("object"===typeof a)for(var c in a)a[c]&&(b={name:c,url:a[c]});else b=a.split("/"),b=b[b.length-1],c=b.indexOf("?"),b={name:-1!==c?b.substring(0,c):b,url:a};
|
||||
return(a=i[b.name])&&a.url===b.url?a:i[b.name]=b}function e(a){var a=a||i,b;for(b in a)if(a.hasOwnProperty(b)&&a[b].state!==x)return!1;return!0}function s(a,b){b=b||f;a.state===x?b():a.state===C?d.ready(a.name,b):a.state===B?a.onpreload.push(function(){s(a,b)}):(a.state=C,p(a.url,function(){a.state=x;b();l(w[a.name],function(a){q(a)});t&&e()&&l(w.ALL,function(a){q(a)})}))}function p(h,c){var d;/\.css[^\.]*$/.test(h)?(d=b.createElement("link"),d.type="text/"+(h.type||"css"),d.rel="stylesheet",d.href=
|
||||
h.src||h):(d=b.createElement("script"),d.type="text/"+(h.type||"javascript"),d.src=h.src||h);var e=d,g=c,g=g||f;e.onload=e.onreadystatechange=function(h){h=h||a.event;if("load"===h.type||/loaded|complete/.test(e.readyState)&&9>b.documentMode)e.onload=e.onreadystatechange=e.onerror=null,g()};e.onerror=function(){e.onload=e.onreadystatechange=e.onerror=null;g()};e.async=!1;e.defer=!1;d=b.head||b.getElementsByTagName("head")[0];d.insertBefore(e,d.lastChild)}function n(){b.body?t||(t=!0,l(g,function(a){q(a)})):
|
||||
(a.clearTimeout(d.readyTimeout),d.readyTimeout=a.setTimeout(n,50))}function c(){b.addEventListener?(b.removeEventListener("DOMContentLoaded",c,!1),n()):"complete"===b.readyState&&(b.detachEvent("onreadystatechange",c),n())}var b=a.document,g=[],u=[],w={},i={},z="async"in b.createElement("script")||"MozAppearance"in b.documentElement.style||a.opera,k,t,A=a.head_conf&&a.head_conf.head||"head",d=a[A]=a[A]||function(){d.ready.apply(null,arguments)},B=1,C=3,x=4;d.load=z?function(){var a=arguments,b=a[a.length-
|
||||
1],c={};r(b)||(b=null);l(a,function(d,f){d!==b&&(d=m(d),c[d.name]=d,s(d,b&&f===a.length-2?function(){e(c)&&q(b)}:null))});return d}:function(){var a=arguments,b=[].slice.call(a,1),c=b[0];if(!k)return u.push(function(){d.load.apply(null,a)}),d;c?(l(b,function(a){if(!r(a)){var b=m(a);b.state===v&&(b.state=B,b.onpreload=[],p({src:b.url,type:"cache"},function(){b.state=2;l(b.onpreload,function(a){a.call()})}))}}),s(m(a[0]),r(c)?c:function(){d.load.apply(null,b)})):s(m(a[0]));return d};d.js=d.load;d.test=
|
||||
function(a,b,c,e){a="object"===typeof a?a:{test:a,success:b?j("Array",b)?b:[b]:!1,failure:c?j("Array",c)?c:[c]:!1,callback:e||f};(b=!!a.test)&&a.success?(a.success.push(a.callback),d.load.apply(null,a.success)):!b&&a.failure?(a.failure.push(a.callback),d.load.apply(null,a.failure)):e();return d};d.ready=function(a,c){if(a===b)return t?q(c):g.push(c),d;r(a)&&(c=a,a="ALL");if("string"!==typeof a||!r(c))return d;var f=i[a];if(f&&f.state===x||"ALL"===a&&e()&&t)return q(c),d;(f=w[a])?f.push(c):w[a]=[c];
|
||||
return d};d.ready(b,function(){e()&&l(w.ALL,function(a){q(a)});d.feature&&d.feature("domloaded",!0)});if("complete"===b.readyState)n();else if(b.addEventListener)b.addEventListener("DOMContentLoaded",c,!1),a.addEventListener("load",n,!1);else{b.attachEvent("onreadystatechange",c);a.attachEvent("onload",n);var y=!1;try{y=null==a.frameElement&&b.documentElement}catch(E){}y&&y.doScroll&&function D(){if(!t){try{y.doScroll("left")}catch(b){a.clearTimeout(d.readyTimeout);d.readyTimeout=a.setTimeout(D,50);
|
||||
return}n()}}()}setTimeout(function(){k=!0;l(u,function(a){a()})},300)})(window);
|
25
lib/js/extra/headjs/dist/0.99/README.md
vendored
Normal file
25
lib/js/extra/headjs/dist/0.99/README.md
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
##Prepackaged Files
|
||||
|
||||
###Full: Responsive Design + Feature Detections + Asset Loader
|
||||
####head.js / head.min.js
|
||||
|
||||
- Contains: core.js, css3.js, and load.js
|
||||
- For Debug: head.min.js.map ([js source map](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/))
|
||||
|
||||
###Bundle: Responsive Design + Feature Detections
|
||||
####head.css3.js / head.css3.min.js
|
||||
|
||||
- Contains: core.js and css3.js
|
||||
- For Debug: head.css3.min.js.map ([js source map](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/))
|
||||
|
||||
###Bundle: Responsive Design
|
||||
####head.core.js / head.core.min.js
|
||||
|
||||
- Contains: core.js
|
||||
- For Debug: head.core.min.js.map ([js source map](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/))
|
||||
|
||||
###Bundle: Asset Loader
|
||||
####head.load.js / head.load.min.js
|
||||
|
||||
- Contains: load.js
|
||||
- For Debug: head.load.min.js.map ([js source map](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/))
|
40
lib/js/extra/headjs/dist/0.99/changelog.txt
vendored
Normal file
40
lib/js/extra/headjs/dist/0.99/changelog.txt
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
0.99 (2012-11-15)
|
||||
- Load: Fixed regression in IE6, caused by IE10 fix
|
||||
- Load: CSS loading seems to work in all browsers.
|
||||
- However a few will not trigger the callback. Over 90% do.
|
||||
- Either don't use it, or only load css in situations when you don't need the callback triggered.
|
||||
- Load: Conditional loading with head.test() now in evaluation phase
|
||||
- try it, but don't rely on it yet
|
||||
- head.test(bool, "ok.js", "failed.js", callback)
|
||||
- All: CDN is now availiable thanks to: http://cloudflare.com
|
||||
- Info in download section on main site
|
||||
- Unit Tests
|
||||
- Integrated with main site so that everyone can participate
|
||||
- They have also been hooked up to automatically report stats back to http://browserscope.org
|
||||
|
||||
0.98 (2012-11-09)
|
||||
- Load: Fixed loading bug in IE10
|
||||
- Load: Corrected some issues with loading from inside <head>
|
||||
- Load: Rewrite of large parts of code base
|
||||
- Started to massively document the sourcecode :)
|
||||
- Css3: moved "touch" detection from core to here
|
||||
- Css3: added "retina" detection
|
||||
- Css3: replaced "font-face" detection that was using "Conditional Comments" with simplisitc browser version detection
|
||||
- Core: Added gt, gte, lte, eq classes to width detection (lt existed already)
|
||||
- Core: Added gt, gte, lt, lte, eq classes for browser vendor & version detection
|
||||
- By default only lt/gt classes are activated
|
||||
- You can of course configure to your likings via head_conf
|
||||
|
||||
0.97a (2012-10-20)
|
||||
- Updated QUnit & got unit tests running again
|
||||
- Swictched to "use strict"
|
||||
- Fixed up some variable usage
|
||||
- Added browser detections other than just for ie-lt
|
||||
- updated browser regexes (firefox, safari, opera, ios, android, webkit)
|
||||
- detect if browser is: desktop, mobile, touch enabled
|
||||
- detect portrait/landscape mode
|
||||
- html5 shim now only triggers on ie-lt9
|
||||
- added a throttle to onResize, since some browsers fire tons of events/sec
|
||||
- added corrected height/width measurements, but only exposed via new object: head.screen
|
||||
- contains height/width, innerHeight/innerWidth, outerHeight/outerWidth
|
||||
- force all css router names to lowercase just in case ppl try typing in names with wierd casings
|
301
lib/js/extra/headjs/dist/0.99/head.core.js
vendored
Normal file
301
lib/js/extra/headjs/dist/0.99/head.core.js
vendored
Normal file
|
@ -0,0 +1,301 @@
|
|||
///#source 1 1 /src/0.99/core.js
|
||||
/*! head.core v0.99 */
|
||||
/*
|
||||
* HeadJS The only script in your <HEAD>
|
||||
* Author Tero Piirainen (tipiirai)
|
||||
* Maintainer Robert Hoffmann (itechnology)
|
||||
* License MIT / http://bit.ly/mit-license
|
||||
*
|
||||
* Version 0.99
|
||||
* http://headjs.com
|
||||
*/
|
||||
; (function (win, undefined) {
|
||||
"use strict";
|
||||
|
||||
// gt, gte, lt, lte, eq breakpoints would have been more simple to write as ['gt','gte','lt','lte','eq']
|
||||
// but then we would have had to loop over the collection on each resize() event,
|
||||
// a simple object with a direct access to true/false is therefore much more efficient
|
||||
var doc = win.document,
|
||||
nav = win.navigator,
|
||||
loc = win.location,
|
||||
html = doc.documentElement,
|
||||
klass = [],
|
||||
conf = {
|
||||
screens : [240, 320, 480, 640, 768, 800, 1024, 1280, 1440, 1680, 1920],
|
||||
screensCss: { "gt": true, "gte": false, "lt": true, "lte": false, "eq": false },
|
||||
browsers : [
|
||||
{ ie : { min: 6, max: 11 } }
|
||||
//,{ chrome : { min: 8, max: 29 } }
|
||||
//,{ ff : { min: 3, max: 24 } }
|
||||
//,{ ios : { min: 3, max: 6 } }
|
||||
//,{ android: { min: 2, max: 4 } }
|
||||
//,{ webkit : { min: 9, max: 12 } }
|
||||
//,{ opera : { min: 9, max: 12 } }
|
||||
],
|
||||
browserCss: { "gt": true, "gte": false, "lt": true, "lte": false, "eq": true },
|
||||
section : "-section",
|
||||
page : "-page",
|
||||
head : "head"
|
||||
};
|
||||
|
||||
if (win.head_conf) {
|
||||
for (var item in win.head_conf) {
|
||||
if (win.head_conf[item] !== undefined) {
|
||||
conf[item] = win.head_conf[item];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function pushClass(name) {
|
||||
klass[klass.length] = name;
|
||||
}
|
||||
|
||||
function removeClass(name) {
|
||||
var re = new RegExp(" \\b" + name + "\\b");
|
||||
html.className = html.className.replace(re, '');
|
||||
}
|
||||
|
||||
function each(arr, fn) {
|
||||
for (var i = 0, l = arr.length; i < l; i++) {
|
||||
fn.call(arr, arr[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
// API
|
||||
var api = win[conf.head] = function () {
|
||||
api.ready.apply(null, arguments);
|
||||
};
|
||||
|
||||
api.feature = function (key, enabled, queue) {
|
||||
|
||||
// internal: apply all classes
|
||||
if (!key) {
|
||||
html.className += ' ' + klass.join(' ');
|
||||
klass = [];
|
||||
return api;
|
||||
}
|
||||
|
||||
if (Object.prototype.toString.call(enabled) === '[object Function]') {
|
||||
enabled = enabled.call();
|
||||
}
|
||||
|
||||
pushClass((enabled ? '' : 'no-') + key);
|
||||
api[key] = !!enabled;
|
||||
|
||||
// apply class to HTML element
|
||||
if (!queue) {
|
||||
removeClass('no-' + key);
|
||||
removeClass(key);
|
||||
api.feature();
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
// no queue here, so we can remove any eventual pre-existing no-js class
|
||||
api.feature("js", true);
|
||||
|
||||
// browser type & version
|
||||
var ua = nav.userAgent.toLowerCase(),
|
||||
mobile = /mobile|android|kindle|silk|midp|(windows nt 6\.2.+arm|touch)/.test(ua);
|
||||
|
||||
// useful for enabling/disabling feature (we can consider a desktop navigator to have more cpu/gpu power)
|
||||
api.feature("mobile" , mobile , true);
|
||||
api.feature("desktop", !mobile, true);
|
||||
|
||||
// http://www.zytrax.com/tech/web/browser_ids.htm
|
||||
// http://www.zytrax.com/tech/web/mobile_ids.html
|
||||
ua = /(chrome|firefox)[ \/]([\w.]+)/.exec(ua) || // Chrome & Firefox
|
||||
/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile IOS
|
||||
/(android)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile Webkit
|
||||
/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Safari & Opera
|
||||
/(msie) ([\w.]+)/.exec(ua) || [];
|
||||
|
||||
|
||||
var browser = ua[1],
|
||||
version = parseFloat(ua[2]);
|
||||
|
||||
switch (browser) {
|
||||
case 'msie':
|
||||
browser = 'ie';
|
||||
version = doc.documentMode || version;
|
||||
break;
|
||||
|
||||
case 'firefox':
|
||||
browser = 'ff';
|
||||
break;
|
||||
|
||||
case 'ipod':
|
||||
case 'ipad':
|
||||
case 'iphone':
|
||||
browser = 'ios';
|
||||
break;
|
||||
|
||||
case 'webkit':
|
||||
browser = 'safari';
|
||||
break;
|
||||
}
|
||||
|
||||
// Browser vendor and version
|
||||
api.browser = {
|
||||
name : browser,
|
||||
version: version
|
||||
};
|
||||
api.browser[browser] = true;
|
||||
|
||||
for (var i = 0, l = conf.browsers.length; i < l; i++) {
|
||||
for (var key in conf.browsers[i]) {
|
||||
if (browser === key) {
|
||||
pushClass(key);
|
||||
|
||||
var min = conf.browsers[i][key].min;
|
||||
var max = conf.browsers[i][key].max;
|
||||
|
||||
for (var v = min; v <= max; v++) {
|
||||
if (version > v) {
|
||||
if (conf.browserCss.gt)
|
||||
pushClass("gt-" + key + v);
|
||||
|
||||
if (conf.browserCss.gte)
|
||||
pushClass("gte-" + key + v);
|
||||
}
|
||||
|
||||
else if (version < v) {
|
||||
if (conf.browserCss.lt)
|
||||
pushClass("lt-" + key + v);
|
||||
|
||||
if (conf.browserCss.lte)
|
||||
pushClass("lte-" + key + v);
|
||||
}
|
||||
|
||||
else if (version === v) {
|
||||
if (conf.browserCss.lte)
|
||||
pushClass("lte-" + key + v);
|
||||
|
||||
if (conf.browserCss.eq)
|
||||
pushClass("eq-" + key + v);
|
||||
|
||||
if (conf.browserCss.gte)
|
||||
pushClass("gte-" + key + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
pushClass('no-' + key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pushClass(browser);
|
||||
pushClass(browser + parseInt(version, 10));
|
||||
|
||||
// IE lt9 specific
|
||||
if (browser === "ie" && version < 9) {
|
||||
// HTML5 support : you still need to add html5 css initialization styles to your site
|
||||
// See: assets/html5.css
|
||||
each("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|progress|section|summary|time|video".split("|"), function (el) {
|
||||
doc.createElement(el);
|
||||
});
|
||||
}
|
||||
|
||||
// CSS "router"
|
||||
each(loc.pathname.split("/"), function (el, i) {
|
||||
if (this.length > 2 && this[i + 1] !== undefined) {
|
||||
if (i) {
|
||||
pushClass(this.slice(i, i + 1).join("-").toLowerCase() + conf.section);
|
||||
}
|
||||
} else {
|
||||
// pageId
|
||||
var id = el || "index", index = id.indexOf(".");
|
||||
if (index > 0) {
|
||||
id = id.substring(0, index);
|
||||
}
|
||||
|
||||
html.id = id.toLowerCase() + conf.page;
|
||||
|
||||
// on root?
|
||||
if (!i) {
|
||||
pushClass("root" + conf.section);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// basic screen info
|
||||
api.screen = {
|
||||
height: win.screen.height,
|
||||
width : win.screen.width
|
||||
};
|
||||
|
||||
// viewport resolutions: w-100, lt-480, lt-1024 ...
|
||||
function screenSize() {
|
||||
// remove earlier sizes
|
||||
html.className = html.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g, "");
|
||||
|
||||
// Viewport width
|
||||
var iw = win.innerWidth || html.clientWidth,
|
||||
ow = win.outerWidth || win.screen.width;
|
||||
|
||||
api.screen.innerWidth = iw;
|
||||
api.screen.outerWidth = ow;
|
||||
|
||||
// for debugging purposes, not really useful for anything else
|
||||
pushClass("w-" + iw);
|
||||
|
||||
each(conf.screens, function (width) {
|
||||
if (iw > width) {
|
||||
if (conf.screensCss.gt)
|
||||
pushClass("gt-" + width);
|
||||
|
||||
if (conf.screensCss.gte)
|
||||
pushClass("gte-" + width);
|
||||
}
|
||||
|
||||
else if (iw < width) {
|
||||
if (conf.screensCss.lt)
|
||||
pushClass("lt-" + width);
|
||||
|
||||
if (conf.screensCss.lte)
|
||||
pushClass("lte-" + width);
|
||||
}
|
||||
|
||||
else if (iw === width) {
|
||||
if (conf.screensCss.lte)
|
||||
pushClass("lte-" + width);
|
||||
|
||||
if (conf.screensCss.eq)
|
||||
pushClass("e-q" + width);
|
||||
|
||||
if (conf.screensCss.gte)
|
||||
pushClass("gte-" + width);
|
||||
}
|
||||
});
|
||||
|
||||
// Viewport height
|
||||
var ih = win.innerHeight || html.clientHeight,
|
||||
oh = win.outerHeight || win.screen.height;
|
||||
|
||||
api.screen.innerHeight = ih;
|
||||
api.screen.outerHeight = oh;
|
||||
|
||||
// no need for onChange event to detect this
|
||||
api.feature("portrait" , (ih > iw));
|
||||
api.feature("landscape", (ih < iw));
|
||||
}
|
||||
|
||||
screenSize();
|
||||
|
||||
// Throttle navigators from triggering too many resize events
|
||||
var resizeId = 0;
|
||||
function onResize() {
|
||||
win.clearTimeout(resizeId);
|
||||
resizeId = win.setTimeout(screenSize, 50);
|
||||
}
|
||||
|
||||
// Manually attach, as to not overwrite existing handler
|
||||
if (win.addEventListener) {
|
||||
win.addEventListener("resize", onResize, false);
|
||||
|
||||
} else {
|
||||
win.attachEvent("onresize", onResize);
|
||||
}
|
||||
})(window);
|
5
lib/js/extra/headjs/dist/0.99/head.core.min.js
vendored
Normal file
5
lib/js/extra/headjs/dist/0.99/head.core.min.js
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
/*! head.core v0.99 */
|
||||
(function(n,t){"use strict";function r(n){a[a.length]=n}function k(n){var t=new RegExp(" \\b"+n+"\\b");c.className=c.className.replace(t,"")}function p(n,t){for(var i=0,r=n.length;i<r;i++)t.call(n,n[i],i)}function tt(){var t,e,f,o;c.className=c.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g,"");t=n.innerWidth||c.clientWidth;e=n.outerWidth||n.screen.width;u.screen.innerWidth=t;u.screen.outerWidth=e;r("w-"+t);p(i.screens,function(n){t>n?(i.screensCss.gt&&r("gt-"+n),i.screensCss.gte&&r("gte-"+n)):t<n?(i.screensCss.lt&&r("lt-"+n),i.screensCss.lte&&r("lte-"+n)):t===n&&(i.screensCss.lte&&r("lte-"+n),i.screensCss.eq&&r("e-q"+n),i.screensCss.gte&&r("gte-"+n))});f=n.innerHeight||c.clientHeight;o=n.outerHeight||n.screen.height;u.screen.innerHeight=f;u.screen.outerHeight=o;u.feature("portrait",f>t);u.feature("landscape",f<t)}function it(){n.clearTimeout(b);b=n.setTimeout(tt,50)}var y=n.document,rt=n.navigator,ut=n.location,c=y.documentElement,a=[],i={screens:[240,320,480,640,768,800,1024,1280,1440,1680,1920],screensCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!1},browsers:[{ie:{min:6,max:11}}],browserCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!0},section:"-section",page:"-page",head:"head"},v,u,s,w,o,h,l,d,f,g,nt,e,b;if(n.head_conf)for(v in n.head_conf)n.head_conf[v]!==t&&(i[v]=n.head_conf[v]);u=n[i.head]=function(){u.ready.apply(null,arguments)};u.feature=function(n,t,i){return n?(Object.prototype.toString.call(t)==="[object Function]"&&(t=t.call()),r((t?"":"no-")+n),u[n]=!!t,i||(k("no-"+n),k(n),u.feature()),u):(c.className+=" "+a.join(" "),a=[],u)};u.feature("js",!0);s=rt.userAgent.toLowerCase();w=/mobile|android|kindle|silk|midp|(windows nt 6\.2.+arm|touch)/.test(s);u.feature("mobile",w,!0);u.feature("desktop",!w,!0);s=/(chrome|firefox)[ \/]([\w.]+)/.exec(s)||/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(android)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(msie) ([\w.]+)/.exec(s)||[];o=s[1];h=parseFloat(s[2]);switch(o){case"msie":o="ie";h=y.documentMode||h;break;case"firefox":o="ff";break;case"ipod":case"ipad":case"iphone":o="ios";break;case"webkit":o="safari"}for(u.browser={name:o,version:h},u.browser[o]=!0,l=0,d=i.browsers.length;l<d;l++)for(f in i.browsers[l])if(o===f)for(r(f),g=i.browsers[l][f].min,nt=i.browsers[l][f].max,e=g;e<=nt;e++)h>e?(i.browserCss.gt&&r("gt-"+f+e),i.browserCss.gte&&r("gte-"+f+e)):h<e?(i.browserCss.lt&&r("lt-"+f+e),i.browserCss.lte&&r("lte-"+f+e)):h===e&&(i.browserCss.lte&&r("lte-"+f+e),i.browserCss.eq&&r("eq-"+f+e),i.browserCss.gte&&r("gte-"+f+e));else r("no-"+f);r(o);r(o+parseInt(h,10));o==="ie"&&h<9&&p("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|progress|section|summary|time|video".split("|"),function(n){y.createElement(n)});p(ut.pathname.split("/"),function(n,u){if(this.length>2&&this[u+1]!==t)u&&r(this.slice(u,u+1).join("-").toLowerCase()+i.section);else{var f=n||"index",e=f.indexOf(".");e>0&&(f=f.substring(0,e));c.id=f.toLowerCase()+i.page;u||r("root"+i.section)}});u.screen={height:n.screen.height,width:n.screen.width};tt();b=0;n.addEventListener?n.addEventListener("resize",it,!1):n.attachEvent("onresize",it)})(window);
|
||||
/*
|
||||
//# sourceMappingURL=head.core.min.js.map
|
||||
*/
|
8
lib/js/extra/headjs/dist/0.99/head.core.min.js.map
vendored
Normal file
8
lib/js/extra/headjs/dist/0.99/head.core.min.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
466
lib/js/extra/headjs/dist/0.99/head.css3.js
vendored
Normal file
466
lib/js/extra/headjs/dist/0.99/head.css3.js
vendored
Normal file
|
@ -0,0 +1,466 @@
|
|||
///#source 1 1 /src/0.99/core.js
|
||||
/*! head.core v0.99 */
|
||||
/*
|
||||
* HeadJS The only script in your <HEAD>
|
||||
* Author Tero Piirainen (tipiirai)
|
||||
* Maintainer Robert Hoffmann (itechnology)
|
||||
* License MIT / http://bit.ly/mit-license
|
||||
*
|
||||
* Version 0.99
|
||||
* http://headjs.com
|
||||
*/
|
||||
; (function (win, undefined) {
|
||||
"use strict";
|
||||
|
||||
// gt, gte, lt, lte, eq breakpoints would have been more simple to write as ['gt','gte','lt','lte','eq']
|
||||
// but then we would have had to loop over the collection on each resize() event,
|
||||
// a simple object with a direct access to true/false is therefore much more efficient
|
||||
var doc = win.document,
|
||||
nav = win.navigator,
|
||||
loc = win.location,
|
||||
html = doc.documentElement,
|
||||
klass = [],
|
||||
conf = {
|
||||
screens : [240, 320, 480, 640, 768, 800, 1024, 1280, 1440, 1680, 1920],
|
||||
screensCss: { "gt": true, "gte": false, "lt": true, "lte": false, "eq": false },
|
||||
browsers : [
|
||||
{ ie : { min: 6, max: 11 } }
|
||||
//,{ chrome : { min: 8, max: 29 } }
|
||||
//,{ ff : { min: 3, max: 24 } }
|
||||
//,{ ios : { min: 3, max: 6 } }
|
||||
//,{ android: { min: 2, max: 4 } }
|
||||
//,{ webkit : { min: 9, max: 12 } }
|
||||
//,{ opera : { min: 9, max: 12 } }
|
||||
],
|
||||
browserCss: { "gt": true, "gte": false, "lt": true, "lte": false, "eq": true },
|
||||
section : "-section",
|
||||
page : "-page",
|
||||
head : "head"
|
||||
};
|
||||
|
||||
if (win.head_conf) {
|
||||
for (var item in win.head_conf) {
|
||||
if (win.head_conf[item] !== undefined) {
|
||||
conf[item] = win.head_conf[item];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function pushClass(name) {
|
||||
klass[klass.length] = name;
|
||||
}
|
||||
|
||||
function removeClass(name) {
|
||||
var re = new RegExp(" \\b" + name + "\\b");
|
||||
html.className = html.className.replace(re, '');
|
||||
}
|
||||
|
||||
function each(arr, fn) {
|
||||
for (var i = 0, l = arr.length; i < l; i++) {
|
||||
fn.call(arr, arr[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
// API
|
||||
var api = win[conf.head] = function () {
|
||||
api.ready.apply(null, arguments);
|
||||
};
|
||||
|
||||
api.feature = function (key, enabled, queue) {
|
||||
|
||||
// internal: apply all classes
|
||||
if (!key) {
|
||||
html.className += ' ' + klass.join(' ');
|
||||
klass = [];
|
||||
return api;
|
||||
}
|
||||
|
||||
if (Object.prototype.toString.call(enabled) === '[object Function]') {
|
||||
enabled = enabled.call();
|
||||
}
|
||||
|
||||
pushClass((enabled ? '' : 'no-') + key);
|
||||
api[key] = !!enabled;
|
||||
|
||||
// apply class to HTML element
|
||||
if (!queue) {
|
||||
removeClass('no-' + key);
|
||||
removeClass(key);
|
||||
api.feature();
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
// no queue here, so we can remove any eventual pre-existing no-js class
|
||||
api.feature("js", true);
|
||||
|
||||
// browser type & version
|
||||
var ua = nav.userAgent.toLowerCase(),
|
||||
mobile = /mobile|android|kindle|silk|midp|(windows nt 6\.2.+arm|touch)/.test(ua);
|
||||
|
||||
// useful for enabling/disabling feature (we can consider a desktop navigator to have more cpu/gpu power)
|
||||
api.feature("mobile" , mobile , true);
|
||||
api.feature("desktop", !mobile, true);
|
||||
|
||||
// http://www.zytrax.com/tech/web/browser_ids.htm
|
||||
// http://www.zytrax.com/tech/web/mobile_ids.html
|
||||
ua = /(chrome|firefox)[ \/]([\w.]+)/.exec(ua) || // Chrome & Firefox
|
||||
/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile IOS
|
||||
/(android)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile Webkit
|
||||
/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Safari & Opera
|
||||
/(msie) ([\w.]+)/.exec(ua) || [];
|
||||
|
||||
|
||||
var browser = ua[1],
|
||||
version = parseFloat(ua[2]);
|
||||
|
||||
switch (browser) {
|
||||
case 'msie':
|
||||
browser = 'ie';
|
||||
version = doc.documentMode || version;
|
||||
break;
|
||||
|
||||
case 'firefox':
|
||||
browser = 'ff';
|
||||
break;
|
||||
|
||||
case 'ipod':
|
||||
case 'ipad':
|
||||
case 'iphone':
|
||||
browser = 'ios';
|
||||
break;
|
||||
|
||||
case 'webkit':
|
||||
browser = 'safari';
|
||||
break;
|
||||
}
|
||||
|
||||
// Browser vendor and version
|
||||
api.browser = {
|
||||
name : browser,
|
||||
version: version
|
||||
};
|
||||
api.browser[browser] = true;
|
||||
|
||||
for (var i = 0, l = conf.browsers.length; i < l; i++) {
|
||||
for (var key in conf.browsers[i]) {
|
||||
if (browser === key) {
|
||||
pushClass(key);
|
||||
|
||||
var min = conf.browsers[i][key].min;
|
||||
var max = conf.browsers[i][key].max;
|
||||
|
||||
for (var v = min; v <= max; v++) {
|
||||
if (version > v) {
|
||||
if (conf.browserCss.gt)
|
||||
pushClass("gt-" + key + v);
|
||||
|
||||
if (conf.browserCss.gte)
|
||||
pushClass("gte-" + key + v);
|
||||
}
|
||||
|
||||
else if (version < v) {
|
||||
if (conf.browserCss.lt)
|
||||
pushClass("lt-" + key + v);
|
||||
|
||||
if (conf.browserCss.lte)
|
||||
pushClass("lte-" + key + v);
|
||||
}
|
||||
|
||||
else if (version === v) {
|
||||
if (conf.browserCss.lte)
|
||||
pushClass("lte-" + key + v);
|
||||
|
||||
if (conf.browserCss.eq)
|
||||
pushClass("eq-" + key + v);
|
||||
|
||||
if (conf.browserCss.gte)
|
||||
pushClass("gte-" + key + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
pushClass('no-' + key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pushClass(browser);
|
||||
pushClass(browser + parseInt(version, 10));
|
||||
|
||||
// IE lt9 specific
|
||||
if (browser === "ie" && version < 9) {
|
||||
// HTML5 support : you still need to add html5 css initialization styles to your site
|
||||
// See: assets/html5.css
|
||||
each("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|progress|section|summary|time|video".split("|"), function (el) {
|
||||
doc.createElement(el);
|
||||
});
|
||||
}
|
||||
|
||||
// CSS "router"
|
||||
each(loc.pathname.split("/"), function (el, i) {
|
||||
if (this.length > 2 && this[i + 1] !== undefined) {
|
||||
if (i) {
|
||||
pushClass(this.slice(i, i + 1).join("-").toLowerCase() + conf.section);
|
||||
}
|
||||
} else {
|
||||
// pageId
|
||||
var id = el || "index", index = id.indexOf(".");
|
||||
if (index > 0) {
|
||||
id = id.substring(0, index);
|
||||
}
|
||||
|
||||
html.id = id.toLowerCase() + conf.page;
|
||||
|
||||
// on root?
|
||||
if (!i) {
|
||||
pushClass("root" + conf.section);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// basic screen info
|
||||
api.screen = {
|
||||
height: win.screen.height,
|
||||
width : win.screen.width
|
||||
};
|
||||
|
||||
// viewport resolutions: w-100, lt-480, lt-1024 ...
|
||||
function screenSize() {
|
||||
// remove earlier sizes
|
||||
html.className = html.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g, "");
|
||||
|
||||
// Viewport width
|
||||
var iw = win.innerWidth || html.clientWidth,
|
||||
ow = win.outerWidth || win.screen.width;
|
||||
|
||||
api.screen.innerWidth = iw;
|
||||
api.screen.outerWidth = ow;
|
||||
|
||||
// for debugging purposes, not really useful for anything else
|
||||
pushClass("w-" + iw);
|
||||
|
||||
each(conf.screens, function (width) {
|
||||
if (iw > width) {
|
||||
if (conf.screensCss.gt)
|
||||
pushClass("gt-" + width);
|
||||
|
||||
if (conf.screensCss.gte)
|
||||
pushClass("gte-" + width);
|
||||
}
|
||||
|
||||
else if (iw < width) {
|
||||
if (conf.screensCss.lt)
|
||||
pushClass("lt-" + width);
|
||||
|
||||
if (conf.screensCss.lte)
|
||||
pushClass("lte-" + width);
|
||||
}
|
||||
|
||||
else if (iw === width) {
|
||||
if (conf.screensCss.lte)
|
||||
pushClass("lte-" + width);
|
||||
|
||||
if (conf.screensCss.eq)
|
||||
pushClass("e-q" + width);
|
||||
|
||||
if (conf.screensCss.gte)
|
||||
pushClass("gte-" + width);
|
||||
}
|
||||
});
|
||||
|
||||
// Viewport height
|
||||
var ih = win.innerHeight || html.clientHeight,
|
||||
oh = win.outerHeight || win.screen.height;
|
||||
|
||||
api.screen.innerHeight = ih;
|
||||
api.screen.outerHeight = oh;
|
||||
|
||||
// no need for onChange event to detect this
|
||||
api.feature("portrait" , (ih > iw));
|
||||
api.feature("landscape", (ih < iw));
|
||||
}
|
||||
|
||||
screenSize();
|
||||
|
||||
// Throttle navigators from triggering too many resize events
|
||||
var resizeId = 0;
|
||||
function onResize() {
|
||||
win.clearTimeout(resizeId);
|
||||
resizeId = win.setTimeout(screenSize, 50);
|
||||
}
|
||||
|
||||
// Manually attach, as to not overwrite existing handler
|
||||
if (win.addEventListener) {
|
||||
win.addEventListener("resize", onResize, false);
|
||||
|
||||
} else {
|
||||
win.attachEvent("onresize", onResize);
|
||||
}
|
||||
})(window);
|
||||
///#source 1 1 /src/0.99/css3.js
|
||||
/*! head.css3 v0.99 */
|
||||
/*
|
||||
* HeadJS The only script in your <HEAD>
|
||||
* Author Tero Piirainen (tipiirai)
|
||||
* Maintainer Robert Hoffmann (itechnology)
|
||||
* License MIT / http://bit.ly/mit-license
|
||||
*
|
||||
* Version 0.99
|
||||
* http://headjs.com
|
||||
*/
|
||||
;(function(win, undefined) {
|
||||
"use strict";
|
||||
|
||||
var doc = win.document,
|
||||
/*
|
||||
To add a new test:
|
||||
|
||||
head.feature("video", function() {
|
||||
var tag = document.createElement('video');
|
||||
return !!tag.canPlayType;
|
||||
});
|
||||
|
||||
Good place to grab more tests
|
||||
|
||||
https://github.com/Modernizr/Modernizr/blob/master/modernizr.js
|
||||
*/
|
||||
|
||||
/* CSS modernizer */
|
||||
el = doc.createElement("i"),
|
||||
style = el.style,
|
||||
prefs = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '),
|
||||
domPrefs = 'Webkit Moz O ms Khtml'.split(' '),
|
||||
|
||||
headVar = win.head_conf && win.head_conf.head || "head",
|
||||
api = win[headVar];
|
||||
|
||||
// Thanks Paul Irish!
|
||||
function testProps(props) {
|
||||
for (var i in props) {
|
||||
if (style[props[i]] !== undefined) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function testAll(prop) {
|
||||
var camel = prop.charAt(0).toUpperCase() + prop.substr(1),
|
||||
props = (prop + ' ' + domPrefs.join(camel + ' ') + camel).split(' ');
|
||||
|
||||
return !!testProps(props);
|
||||
}
|
||||
|
||||
var tests = {
|
||||
gradient: function() {
|
||||
var s1 = 'background-image:',
|
||||
s2 = 'gradient(linear,left top,right bottom,from(#9f9),to(#fff));',
|
||||
s3 = 'linear-gradient(left top,#eee,#fff);';
|
||||
|
||||
style.cssText = (s1 + prefs.join(s2 + s1) + prefs.join(s3 + s1)).slice(0,-s1.length);
|
||||
return !!style.backgroundImage;
|
||||
},
|
||||
|
||||
rgba: function() {
|
||||
style.cssText = "background-color:rgba(0,0,0,0.5)";
|
||||
return !!style.backgroundColor;
|
||||
},
|
||||
|
||||
opacity: function() {
|
||||
return el.style.opacity === "";
|
||||
},
|
||||
|
||||
textshadow: function() {
|
||||
return style.textShadow === '';
|
||||
},
|
||||
|
||||
multiplebgs: function() {
|
||||
style.cssText = 'background:url(https://),url(https://),red url(https://)';
|
||||
|
||||
// If the UA supports multiple backgrounds, there should be three occurrences
|
||||
// of the string "url(" in the return value for elemStyle.background
|
||||
var result = (style.background || "").match(/url/g);
|
||||
|
||||
return Object.prototype.toString.call(result) === '[object Array]' && result.length === 3;
|
||||
},
|
||||
|
||||
boxshadow: function() {
|
||||
return testAll("boxShadow");
|
||||
},
|
||||
|
||||
borderimage: function() {
|
||||
return testAll("borderImage");
|
||||
},
|
||||
|
||||
borderradius: function() {
|
||||
return testAll("borderRadius");
|
||||
},
|
||||
|
||||
cssreflections: function() {
|
||||
return testAll("boxReflect");
|
||||
},
|
||||
|
||||
csstransforms: function() {
|
||||
return testAll("transform");
|
||||
},
|
||||
|
||||
csstransitions: function() {
|
||||
return testAll("transition");
|
||||
},
|
||||
touch: function () {
|
||||
return 'ontouchstart' in win;
|
||||
},
|
||||
retina: function () {
|
||||
return (win.devicePixelRatio > 1);
|
||||
},
|
||||
|
||||
/*
|
||||
font-face support. Uses browser sniffing but is synchronous.
|
||||
http://paulirish.com/2009/font-face-feature-detection/
|
||||
*/
|
||||
fontface: function() {
|
||||
var browser = api.browser.name, version = api.browser.version;
|
||||
|
||||
switch (browser) {
|
||||
case "ie":
|
||||
return version >= 9;
|
||||
|
||||
case "chrome":
|
||||
return version >= 13;
|
||||
|
||||
case "ff":
|
||||
return version >= 6;
|
||||
|
||||
case "ios":
|
||||
return version >= 5;
|
||||
|
||||
case "android":
|
||||
return false;
|
||||
|
||||
case "webkit":
|
||||
return version >= 5.1;
|
||||
|
||||
case "opera":
|
||||
return version >= 10;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// queue features
|
||||
for (var key in tests) {
|
||||
if (tests[key]) {
|
||||
api.feature(key, tests[key].call(), true);
|
||||
}
|
||||
}
|
||||
|
||||
// enable features at once
|
||||
api.feature();
|
||||
|
||||
})(window);
|
7
lib/js/extra/headjs/dist/0.99/head.css3.min.js
vendored
Normal file
7
lib/js/extra/headjs/dist/0.99/head.css3.min.js
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
/*! head.core v0.99 */
|
||||
(function(n,t){"use strict";function r(n){a[a.length]=n}function k(n){var t=new RegExp(" \\b"+n+"\\b");c.className=c.className.replace(t,"")}function p(n,t){for(var i=0,r=n.length;i<r;i++)t.call(n,n[i],i)}function tt(){var t,e,f,o;c.className=c.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g,"");t=n.innerWidth||c.clientWidth;e=n.outerWidth||n.screen.width;u.screen.innerWidth=t;u.screen.outerWidth=e;r("w-"+t);p(i.screens,function(n){t>n?(i.screensCss.gt&&r("gt-"+n),i.screensCss.gte&&r("gte-"+n)):t<n?(i.screensCss.lt&&r("lt-"+n),i.screensCss.lte&&r("lte-"+n)):t===n&&(i.screensCss.lte&&r("lte-"+n),i.screensCss.eq&&r("e-q"+n),i.screensCss.gte&&r("gte-"+n))});f=n.innerHeight||c.clientHeight;o=n.outerHeight||n.screen.height;u.screen.innerHeight=f;u.screen.outerHeight=o;u.feature("portrait",f>t);u.feature("landscape",f<t)}function it(){n.clearTimeout(b);b=n.setTimeout(tt,50)}var y=n.document,rt=n.navigator,ut=n.location,c=y.documentElement,a=[],i={screens:[240,320,480,640,768,800,1024,1280,1440,1680,1920],screensCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!1},browsers:[{ie:{min:6,max:11}}],browserCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!0},section:"-section",page:"-page",head:"head"},v,u,s,w,o,h,l,d,f,g,nt,e,b;if(n.head_conf)for(v in n.head_conf)n.head_conf[v]!==t&&(i[v]=n.head_conf[v]);u=n[i.head]=function(){u.ready.apply(null,arguments)};u.feature=function(n,t,i){return n?(Object.prototype.toString.call(t)==="[object Function]"&&(t=t.call()),r((t?"":"no-")+n),u[n]=!!t,i||(k("no-"+n),k(n),u.feature()),u):(c.className+=" "+a.join(" "),a=[],u)};u.feature("js",!0);s=rt.userAgent.toLowerCase();w=/mobile|android|kindle|silk|midp|(windows nt 6\.2.+arm|touch)/.test(s);u.feature("mobile",w,!0);u.feature("desktop",!w,!0);s=/(chrome|firefox)[ \/]([\w.]+)/.exec(s)||/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(android)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(msie) ([\w.]+)/.exec(s)||[];o=s[1];h=parseFloat(s[2]);switch(o){case"msie":o="ie";h=y.documentMode||h;break;case"firefox":o="ff";break;case"ipod":case"ipad":case"iphone":o="ios";break;case"webkit":o="safari"}for(u.browser={name:o,version:h},u.browser[o]=!0,l=0,d=i.browsers.length;l<d;l++)for(f in i.browsers[l])if(o===f)for(r(f),g=i.browsers[l][f].min,nt=i.browsers[l][f].max,e=g;e<=nt;e++)h>e?(i.browserCss.gt&&r("gt-"+f+e),i.browserCss.gte&&r("gte-"+f+e)):h<e?(i.browserCss.lt&&r("lt-"+f+e),i.browserCss.lte&&r("lte-"+f+e)):h===e&&(i.browserCss.lte&&r("lte-"+f+e),i.browserCss.eq&&r("eq-"+f+e),i.browserCss.gte&&r("gte-"+f+e));else r("no-"+f);r(o);r(o+parseInt(h,10));o==="ie"&&h<9&&p("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|progress|section|summary|time|video".split("|"),function(n){y.createElement(n)});p(ut.pathname.split("/"),function(n,u){if(this.length>2&&this[u+1]!==t)u&&r(this.slice(u,u+1).join("-").toLowerCase()+i.section);else{var f=n||"index",e=f.indexOf(".");e>0&&(f=f.substring(0,e));c.id=f.toLowerCase()+i.page;u||r("root"+i.section)}});u.screen={height:n.screen.height,width:n.screen.width};tt();b=0;n.addEventListener?n.addEventListener("resize",it,!1):n.attachEvent("onresize",it)})(window);
|
||||
/*! head.css3 v0.99 */
|
||||
(function(n,t){"use strict";function a(n){for(var r in n)if(i[n[r]]!==t)return!0;return!1}function r(n){var t=n.charAt(0).toUpperCase()+n.substr(1),i=(n+" "+c.join(t+" ")+t).split(" ");return!!a(i)}var h=n.document,o=h.createElement("i"),i=o.style,s=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),c="Webkit Moz O ms Khtml".split(" "),l=n.head_conf&&n.head_conf.head||"head",u=n[l],f={gradient:function(){var n="background-image:";return i.cssText=(n+s.join("gradient(linear,left top,right bottom,from(#9f9),to(#fff));"+n)+s.join("linear-gradient(left top,#eee,#fff);"+n)).slice(0,-n.length),!!i.backgroundImage},rgba:function(){return i.cssText="background-color:rgba(0,0,0,0.5)",!!i.backgroundColor},opacity:function(){return o.style.opacity===""},textshadow:function(){return i.textShadow===""},multiplebgs:function(){i.cssText="background:url(https://),url(https://),red url(https://)";var n=(i.background||"").match(/url/g);return Object.prototype.toString.call(n)==="[object Array]"&&n.length===3},boxshadow:function(){return r("boxShadow")},borderimage:function(){return r("borderImage")},borderradius:function(){return r("borderRadius")},cssreflections:function(){return r("boxReflect")},csstransforms:function(){return r("transform")},csstransitions:function(){return r("transition")},touch:function(){return"ontouchstart"in n},retina:function(){return n.devicePixelRatio>1},fontface:function(){var t=u.browser.name,n=u.browser.version;switch(t){case"ie":return n>=9;case"chrome":return n>=13;case"ff":return n>=6;case"ios":return n>=5;case"android":return!1;case"webkit":return n>=5.1;case"opera":return n>=10;default:return!1}}};for(var e in f)f[e]&&u.feature(e,f[e].call(),!0);u.feature()})(window);
|
||||
/*
|
||||
//# sourceMappingURL=head.css3.min.js.map
|
||||
*/
|
8
lib/js/extra/headjs/dist/0.99/head.css3.min.js.map
vendored
Normal file
8
lib/js/extra/headjs/dist/0.99/head.css3.min.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
1082
lib/js/extra/headjs/dist/0.99/head.js
vendored
Normal file
1082
lib/js/extra/headjs/dist/0.99/head.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
616
lib/js/extra/headjs/dist/0.99/head.load.js
vendored
Normal file
616
lib/js/extra/headjs/dist/0.99/head.load.js
vendored
Normal file
|
@ -0,0 +1,616 @@
|
|||
///#source 1 1 /src/0.99/load.js
|
||||
/*! head.load v0.99 */
|
||||
/*
|
||||
* HeadJS The only script in your <HEAD>
|
||||
* Author Tero Piirainen (tipiirai)
|
||||
* Maintainer Robert Hoffmann (itechnology)
|
||||
* License MIT / http://bit.ly/mit-license
|
||||
*
|
||||
* Version 0.99
|
||||
* http://headjs.com
|
||||
*/
|
||||
; (function (win, undefined) {
|
||||
"use strict";
|
||||
|
||||
var doc = win.document,
|
||||
domWaiters = [],
|
||||
queue = [], // waiters for the "head ready" event
|
||||
handlers = {}, // user functions waiting for events
|
||||
assets = {}, // loadable items in various states
|
||||
isAsync = "async" in doc.createElement("script") || "MozAppearance" in doc.documentElement.style || win.opera,
|
||||
isHeadReady,
|
||||
isDomReady,
|
||||
|
||||
/*** public API ***/
|
||||
headVar = win.head_conf && win.head_conf.head || "head",
|
||||
api = win[headVar] = (win[headVar] || function () { api.ready.apply(null, arguments); }),
|
||||
|
||||
// states
|
||||
PRELOADING = 1,
|
||||
PRELOADED = 2,
|
||||
LOADING = 3,
|
||||
LOADED = 4;
|
||||
|
||||
// Method 1: simply load and let browser take care of ordering
|
||||
if (isAsync) {
|
||||
api.load = function () {
|
||||
///<summary>
|
||||
/// INFO: use cases
|
||||
/// head.load("http://domain.com/file.js","http://domain.com/file.js", callBack)
|
||||
/// head.load({ label1: "http://domain.com/file.js" }, { label2: "http://domain.com/file.js" }, callBack)
|
||||
///</summary>
|
||||
var args = arguments,
|
||||
callback = args[args.length - 1],
|
||||
items = {};
|
||||
|
||||
if (!isFunction(callback)) {
|
||||
callback = null;
|
||||
}
|
||||
|
||||
each(args, function (item, i) {
|
||||
if (item !== callback) {
|
||||
item = getAsset(item);
|
||||
items[item.name] = item;
|
||||
|
||||
load(item, callback && i === args.length - 2 ? function () {
|
||||
if (allLoaded(items)) {
|
||||
one(callback);
|
||||
}
|
||||
|
||||
} : null);
|
||||
}
|
||||
});
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
|
||||
// Method 2: preload with text/cache hack
|
||||
} else {
|
||||
api.load = function () {
|
||||
var args = arguments,
|
||||
rest = [].slice.call(args, 1),
|
||||
next = rest[0];
|
||||
|
||||
// wait for a while. immediate execution causes some browsers to ignore caching
|
||||
if (!isHeadReady) {
|
||||
queue.push(function () {
|
||||
api.load.apply(null, args);
|
||||
});
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
// multiple arguments
|
||||
if (!!next) {
|
||||
/* Preload with text/cache hack (not good!)
|
||||
* http://blog.getify.com/on-script-loaders/
|
||||
* http://www.nczonline.net/blog/2010/12/21/thoughts-on-script-loaders/
|
||||
* If caching is not configured correctly on the server, then items could load twice !
|
||||
*************************************************************************************/
|
||||
each(rest, function (item) {
|
||||
if (!isFunction(item)) {
|
||||
preLoad(getAsset(item));
|
||||
}
|
||||
});
|
||||
|
||||
// execute
|
||||
load(getAsset(args[0]), isFunction(next) ? next : function () {
|
||||
api.load.apply(null, rest);
|
||||
});
|
||||
}
|
||||
else {
|
||||
// single item
|
||||
load(getAsset(args[0]));
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
}
|
||||
|
||||
// INFO: for retro compatibility
|
||||
api.js = api.load;
|
||||
|
||||
api.test = function (test, success, failure, callback) {
|
||||
///<summary>
|
||||
/// INFO: use cases:
|
||||
/// head.test(condition, null , "file.NOk" , callback);
|
||||
/// head.test(condition, "fileOk.js", null , callback);
|
||||
/// head.test(condition, "fileOk.js", "file.NOk" , callback);
|
||||
/// head.test(condition, "fileOk.js", ["file.NOk", "file.NOk"], callback);
|
||||
/// head.test({
|
||||
/// test : condition,
|
||||
/// success : [{ label1: "file1Ok.js" }, { label2: "file2Ok.js" }],
|
||||
/// failure : [{ label1: "file1NOk.js" }, { label2: "file2NOk.js" }],
|
||||
/// callback: callback
|
||||
/// );
|
||||
/// head.test({
|
||||
/// test : condition,
|
||||
/// success : ["file1Ok.js" , "file2Ok.js"],
|
||||
/// failure : ["file1NOk.js", "file2NOk.js"],
|
||||
/// callback: callback
|
||||
/// );
|
||||
///</summary>
|
||||
var obj = (typeof test === 'object') ? test : {
|
||||
test: test,
|
||||
success: !!success ? isArray(success) ? success : [success] : false,
|
||||
failure: !!failure ? isArray(failure) ? failure : [failure] : false,
|
||||
callback: callback || noop
|
||||
};
|
||||
|
||||
// Test Passed ?
|
||||
var passed = !!obj.test;
|
||||
|
||||
// Do we have a success case
|
||||
if (passed && !!obj.success) {
|
||||
obj.success.push(obj.callback);
|
||||
api.load.apply(null, obj.success);
|
||||
}
|
||||
// Do we have a fail case
|
||||
else if (!passed && !!obj.failure) {
|
||||
obj.failure.push(obj.callback);
|
||||
api.load.apply(null, obj.failure);
|
||||
}
|
||||
else {
|
||||
callback();
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
api.ready = function (key, callback) {
|
||||
///<summary>
|
||||
/// INFO: use cases:
|
||||
/// head.ready(callBack)
|
||||
/// head.ready(document , callBack)
|
||||
/// head.ready("file.js", callBack);
|
||||
/// head.ready("label" , callBack);
|
||||
///</summary>
|
||||
|
||||
// DOM ready check: head.ready(document, function() { });
|
||||
if (key === doc) {
|
||||
if (isDomReady) {
|
||||
one(callback);
|
||||
}
|
||||
else {
|
||||
domWaiters.push(callback);
|
||||
}
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
// shift arguments
|
||||
if (isFunction(key)) {
|
||||
callback = key;
|
||||
key = "ALL";
|
||||
}
|
||||
|
||||
// make sure arguments are sane
|
||||
if (typeof key !== 'string' || !isFunction(callback)) {
|
||||
return api;
|
||||
}
|
||||
|
||||
// This can also be called when we trigger events based on filenames & labels
|
||||
var asset = assets[key];
|
||||
|
||||
// item already loaded --> execute and return
|
||||
if (asset && asset.state === LOADED || key === 'ALL' && allLoaded() && isDomReady) {
|
||||
one(callback);
|
||||
return api;
|
||||
}
|
||||
|
||||
var arr = handlers[key];
|
||||
if (!arr) {
|
||||
arr = handlers[key] = [callback];
|
||||
}
|
||||
else {
|
||||
arr.push(callback);
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
|
||||
// perform this when DOM is ready
|
||||
api.ready(doc, function () {
|
||||
|
||||
if (allLoaded()) {
|
||||
each(handlers.ALL, function (callback) {
|
||||
one(callback);
|
||||
});
|
||||
}
|
||||
|
||||
if (api.feature) {
|
||||
api.feature("domloaded", true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* private functions
|
||||
*********************/
|
||||
function noop() {
|
||||
// does nothing
|
||||
}
|
||||
|
||||
function each(arr, callback) {
|
||||
if (!arr) {
|
||||
return;
|
||||
}
|
||||
|
||||
// arguments special type
|
||||
if (typeof arr === 'object') {
|
||||
arr = [].slice.call(arr);
|
||||
}
|
||||
|
||||
// do the job
|
||||
for (var i = 0, l = arr.length; i < l; i++) {
|
||||
callback.call(arr, arr[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
/* A must read: http://bonsaiden.github.com/JavaScript-Garden
|
||||
************************************************************/
|
||||
function is(type, obj) {
|
||||
var clas = Object.prototype.toString.call(obj).slice(8, -1);
|
||||
return obj !== undefined && obj !== null && clas === type;
|
||||
}
|
||||
|
||||
function isFunction(item) {
|
||||
return is("Function", item);
|
||||
}
|
||||
|
||||
function isArray(item) {
|
||||
return is("Array", item);
|
||||
}
|
||||
|
||||
function toLabel(url) {
|
||||
///<summary>Converts a url to a file label</summary>
|
||||
var items = url.split("/"),
|
||||
name = items[items.length - 1],
|
||||
i = name.indexOf("?");
|
||||
|
||||
return i !== -1 ? name.substring(0, i) : name;
|
||||
}
|
||||
|
||||
// INFO: this look like a "im triggering callbacks all over the place, but only wanna run it one time function" ..should try to make everything work without it if possible
|
||||
// INFO: Even better. Look into promises/defered's like jQuery is doing
|
||||
function one(callback) {
|
||||
///<summary>Execute a callback only once</summary>
|
||||
callback = callback || noop;
|
||||
|
||||
if (callback._done) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback();
|
||||
callback._done = 1;
|
||||
}
|
||||
|
||||
function getAsset(item) {
|
||||
///<summary>
|
||||
/// Assets are in the form of
|
||||
/// {
|
||||
/// name : label,
|
||||
/// url : url,
|
||||
/// state: state
|
||||
/// }
|
||||
///</summary>
|
||||
var asset = {};
|
||||
|
||||
if (typeof item === 'object') {
|
||||
for (var label in item) {
|
||||
if (!!item[label]) {
|
||||
asset = {
|
||||
name: label,
|
||||
url : item[label]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
asset = {
|
||||
name: toLabel(item),
|
||||
url : item
|
||||
};
|
||||
}
|
||||
|
||||
// is the item already existant
|
||||
var existing = assets[asset.name];
|
||||
if (existing && existing.url === asset.url) {
|
||||
return existing;
|
||||
}
|
||||
|
||||
assets[asset.name] = asset;
|
||||
return asset;
|
||||
}
|
||||
|
||||
function allLoaded(items) {
|
||||
items = items || assets;
|
||||
|
||||
for (var name in items) {
|
||||
if (items.hasOwnProperty(name) && items[name].state !== LOADED) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function onPreload(asset) {
|
||||
asset.state = PRELOADED;
|
||||
|
||||
each(asset.onpreload, function (afterPreload) {
|
||||
afterPreload.call();
|
||||
});
|
||||
}
|
||||
|
||||
function preLoad(asset, callback) {
|
||||
if (asset.state === undefined) {
|
||||
|
||||
asset.state = PRELOADING;
|
||||
asset.onpreload = [];
|
||||
|
||||
loadAsset({ url: asset.url, type: 'cache' }, function () {
|
||||
onPreload(asset);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function load(asset, callback) {
|
||||
///<summary>Used with normal loading logic</summary>
|
||||
callback = callback || noop;
|
||||
|
||||
if (asset.state === LOADED) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
// INFO: why would we trigger a ready event when its not really loaded yet ?
|
||||
if (asset.state === LOADING) {
|
||||
api.ready(asset.name, callback);
|
||||
return;
|
||||
}
|
||||
|
||||
if (asset.state === PRELOADING) {
|
||||
asset.onpreload.push(function () {
|
||||
load(asset, callback);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
asset.state = LOADING;
|
||||
|
||||
loadAsset(asset, function () {
|
||||
asset.state = LOADED;
|
||||
callback();
|
||||
|
||||
// handlers for this asset
|
||||
each(handlers[asset.name], function (fn) {
|
||||
one(fn);
|
||||
});
|
||||
|
||||
// dom is ready & no assets are queued for loading
|
||||
// INFO: shouldn't we be doing the same test above ?
|
||||
if (isDomReady && allLoaded()) {
|
||||
each(handlers.ALL, function (fn) {
|
||||
one(fn);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* Parts inspired from: https://github.com/cujojs/curl
|
||||
******************************************************/
|
||||
function loadAsset(asset, callback) {
|
||||
callback = callback || noop;
|
||||
|
||||
var ele;
|
||||
if (/\.css[^\.]*$/.test(asset.url)) {
|
||||
ele = doc.createElement('link');
|
||||
ele.type = 'text/' + (asset.type || 'css');
|
||||
ele.rel = 'stylesheet';
|
||||
ele.href = asset.url;
|
||||
}
|
||||
else {
|
||||
ele = doc.createElement('script');
|
||||
ele.type = 'text/' + (asset.type || 'javascript');
|
||||
ele.src = asset.url;
|
||||
}
|
||||
|
||||
ele.onload = ele.onreadystatechange = process;
|
||||
ele.onerror = error;
|
||||
|
||||
/* Good read, but doesn't give much hope !
|
||||
* http://blog.getify.com/on-script-loaders/
|
||||
* http://www.nczonline.net/blog/2010/12/21/thoughts-on-script-loaders/
|
||||
* https://hacks.mozilla.org/2009/06/defer/
|
||||
*/
|
||||
|
||||
// ASYNC: load in parellel and execute as soon as possible
|
||||
ele.async = false;
|
||||
// DEFER: load in parallel but maintain execution order
|
||||
ele.defer = false;
|
||||
|
||||
function error(event) {
|
||||
event = event || win.event;
|
||||
|
||||
// need some more detailed error handling here
|
||||
|
||||
// release event listeners
|
||||
ele.onload = ele.onreadystatechange = ele.onerror = null;
|
||||
|
||||
// do callback
|
||||
callback();
|
||||
}
|
||||
|
||||
function process(event) {
|
||||
event = event || win.event;
|
||||
|
||||
// IE 7/8 (2 events on 1st load)
|
||||
// 1) event.type = readystatechange, s.readyState = loading
|
||||
// 2) event.type = readystatechange, s.readyState = loaded
|
||||
|
||||
// IE 7/8 (1 event on reload)
|
||||
// 1) event.type = readystatechange, s.readyState = complete
|
||||
|
||||
// event.type === 'readystatechange' && /loaded|complete/.test(s.readyState)
|
||||
|
||||
// IE 9 (3 events on 1st load)
|
||||
// 1) event.type = readystatechange, s.readyState = loading
|
||||
// 2) event.type = readystatechange, s.readyState = loaded
|
||||
// 3) event.type = load , s.readyState = loaded
|
||||
|
||||
// IE 9 (2 events on reload)
|
||||
// 1) event.type = readystatechange, s.readyState = complete
|
||||
// 2) event.type = load , s.readyState = complete
|
||||
|
||||
// event.type === 'load' && /loaded|complete/.test(s.readyState)
|
||||
// event.type === 'readystatechange' && /loaded|complete/.test(s.readyState)
|
||||
|
||||
// IE 10 (3 events on 1st load)
|
||||
// 1) event.type = readystatechange, s.readyState = loading
|
||||
// 2) event.type = load , s.readyState = complete
|
||||
// 3) event.type = readystatechange, s.readyState = loaded
|
||||
|
||||
// IE 10 (3 events on reload)
|
||||
// 1) event.type = readystatechange, s.readyState = loaded
|
||||
// 2) event.type = load , s.readyState = complete
|
||||
// 3) event.type = readystatechange, s.readyState = complete
|
||||
|
||||
// event.type === 'load' && /loaded|complete/.test(s.readyState)
|
||||
// event.type === 'readystatechange' && /complete/.test(s.readyState)
|
||||
|
||||
// Other Browsers (1 event on 1st load)
|
||||
// 1) event.type = load, s.readyState = undefined
|
||||
|
||||
// Other Browsers (1 event on reload)
|
||||
// 1) event.type = load, s.readyState = undefined
|
||||
|
||||
// event.type == 'load' && s.readyState = undefined
|
||||
|
||||
|
||||
// !doc.documentMode is for IE6/7, IE8+ have documentMode
|
||||
if (event.type === 'load' || (/loaded|complete/.test(ele.readyState) && (!doc.documentMode || doc.documentMode < 9))) {
|
||||
// release event listeners
|
||||
ele.onload = ele.onreadystatechange = ele.onerror = null;
|
||||
|
||||
// do callback
|
||||
callback();
|
||||
}
|
||||
|
||||
// emulates error on browsers that don't create an exception
|
||||
// INFO: timeout not clearing ..why ?
|
||||
//asset.timeout = win.setTimeout(function () {
|
||||
// error({ type: "timeout" });
|
||||
//}, 3000);
|
||||
}
|
||||
|
||||
// use insertBefore to keep IE from throwing Operation Aborted (thx Bryan Forbes!)
|
||||
var head = doc.head || doc.getElementsByTagName('head')[0];
|
||||
// but insert at end of head, because otherwise if it is a stylesheet, it will not ovverride values
|
||||
head.insertBefore(ele, head.lastChild);
|
||||
}
|
||||
|
||||
/* Mix of stuff from jQuery & IEContentLoaded
|
||||
* http://dev.w3.org/html5/spec/the-end.html#the-end
|
||||
***************************************************/
|
||||
function domReady() {
|
||||
// Make sure body exists, at least, in case IE gets a little overzealous (jQuery ticket #5443).
|
||||
if (!doc.body) {
|
||||
// let's not get nasty by setting a timeout too small.. (loop mania guaranteed if assets are queued)
|
||||
win.clearTimeout(api.readyTimeout);
|
||||
api.readyTimeout = win.setTimeout(domReady, 50);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isDomReady) {
|
||||
isDomReady = true;
|
||||
each(domWaiters, function (fn) {
|
||||
one(fn);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function domContentLoaded() {
|
||||
// W3C
|
||||
if (doc.addEventListener) {
|
||||
doc.removeEventListener("DOMContentLoaded", domContentLoaded, false);
|
||||
domReady();
|
||||
}
|
||||
|
||||
// IE
|
||||
else if (doc.readyState === "complete") {
|
||||
// we're here because readyState === "complete" in oldIE
|
||||
// which is good enough for us to call the dom ready!
|
||||
doc.detachEvent("onreadystatechange", domContentLoaded);
|
||||
domReady();
|
||||
}
|
||||
}
|
||||
|
||||
// Catch cases where ready() is called after the browser event has already occurred.
|
||||
// we once tried to use readyState "interactive" here, but it caused issues like the one
|
||||
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
|
||||
if (doc.readyState === "complete") {
|
||||
domReady();
|
||||
}
|
||||
|
||||
// W3C
|
||||
else if (doc.addEventListener) {
|
||||
doc.addEventListener("DOMContentLoaded", domContentLoaded, false);
|
||||
|
||||
// A fallback to window.onload, that will always work
|
||||
win.addEventListener("load", domReady, false);
|
||||
}
|
||||
|
||||
// IE
|
||||
else {
|
||||
// Ensure firing before onload, maybe late but safe also for iframes
|
||||
doc.attachEvent("onreadystatechange", domContentLoaded);
|
||||
|
||||
// A fallback to window.onload, that will always work
|
||||
win.attachEvent("onload", domReady);
|
||||
|
||||
// If IE and not a frame
|
||||
// continually check to see if the document is ready
|
||||
var top = false;
|
||||
|
||||
try {
|
||||
top = !win.frameElement && doc.documentElement;
|
||||
} catch (e) { }
|
||||
|
||||
if (top && top.doScroll) {
|
||||
(function doScrollCheck() {
|
||||
if (!isDomReady) {
|
||||
try {
|
||||
// Use the trick by Diego Perini
|
||||
// http://javascript.nwbox.com/IEContentLoaded/
|
||||
top.doScroll("left");
|
||||
} catch (error) {
|
||||
// let's not get nasty by setting a timeout too small.. (loop mania guaranteed if assets are queued)
|
||||
win.clearTimeout(api.readyTimeout);
|
||||
api.readyTimeout = win.setTimeout(doScrollCheck, 50);
|
||||
return;
|
||||
}
|
||||
|
||||
// and execute any waiting functions
|
||||
domReady();
|
||||
}
|
||||
})();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
We wait for 300 ms before asset loading starts. for some reason this is needed
|
||||
to make sure assets are cached. Not sure why this happens yet. A case study:
|
||||
|
||||
https://github.com/headjs/headjs/issues/closed#issue/83
|
||||
*/
|
||||
setTimeout(function () {
|
||||
isHeadReady = true;
|
||||
each(queue, function (fn) {
|
||||
fn();
|
||||
});
|
||||
|
||||
}, 300);
|
||||
|
||||
})(window);
|
5
lib/js/extra/headjs/dist/0.99/head.load.min.js
vendored
Normal file
5
lib/js/extra/headjs/dist/0.99/head.load.min.js
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
/*! head.load v0.99 */
|
||||
(function(n,t){"use strict";function v(){}function u(n,t){if(n){typeof n=="object"&&(n=[].slice.call(n));for(var i=0,r=n.length;i<r;i++)t.call(n,n[i],i)}}function rt(n,i){var r=Object.prototype.toString.call(i).slice(8,-1);return i!==t&&i!==null&&r===n}function h(n){return rt("Function",n)}function ut(n){return rt("Array",n)}function st(n){var i=n.split("/"),t=i[i.length-1],r=t.indexOf("?");return r!==-1?t.substring(0,r):t}function f(n){(n=n||v,n._done)||(n(),n._done=1)}function y(n){var t={},i,r;if(typeof n=="object")for(i in n)!n[i]||(t={name:i,url:n[i]});else t={name:st(n),url:n};return(r=l[t.name],r&&r.url===t.url)?r:(l[t.name]=t,t)}function p(n){n=n||l;for(var t in n)if(n.hasOwnProperty(t)&&n[t].state!==a)return!1;return!0}function ht(n){n.state=ot;u(n.onpreload,function(n){n.call()})}function ct(n){n.state===t&&(n.state=tt,n.onpreload=[],ft({url:n.url,type:"cache"},function(){ht(n)}))}function w(n,t){if(t=t||v,n.state===a){t();return}if(n.state===it){i.ready(n.name,t);return}if(n.state===tt){n.onpreload.push(function(){w(n,t)});return}n.state=it;ft(n,function(){n.state=a;t();u(s[n.name],function(n){f(n)});o&&p()&&u(s.ALL,function(n){f(n)})})}function ft(t,i){function e(t){t=t||n.event;u.onload=u.onreadystatechange=u.onerror=null;i()}function o(t){t=t||n.event;(t.type==="load"||/loaded|complete/.test(u.readyState)&&(!r.documentMode||r.documentMode<9))&&(u.onload=u.onreadystatechange=u.onerror=null,i())}var u,f;i=i||v;/\.css[^\.]*$/.test(t.url)?(u=r.createElement("link"),u.type="text/"+(t.type||"css"),u.rel="stylesheet",u.href=t.url):(u=r.createElement("script"),u.type="text/"+(t.type||"javascript"),u.src=t.url);u.onload=u.onreadystatechange=o;u.onerror=e;u.async=!1;u.defer=!1;f=r.head||r.getElementsByTagName("head")[0];f.insertBefore(u,f.lastChild)}function e(){if(!r.body){n.clearTimeout(i.readyTimeout);i.readyTimeout=n.setTimeout(e,50);return}o||(o=!0,u(k,function(n){f(n)}))}function b(){r.addEventListener?(r.removeEventListener("DOMContentLoaded",b,!1),e()):r.readyState==="complete"&&(r.detachEvent("onreadystatechange",b),e())}var r=n.document,k=[],d=[],s={},l={},et="async"in r.createElement("script")||"MozAppearance"in r.documentElement.style||n.opera,g,o,nt=n.head_conf&&n.head_conf.head||"head",i=n[nt]=n[nt]||function(){i.ready.apply(null,arguments)},tt=1,ot=2,it=3,a=4,c;if(i.load=et?function(){var t=arguments,n=t[t.length-1],r={};return h(n)||(n=null),u(t,function(i,u){i!==n&&(i=y(i),r[i.name]=i,w(i,n&&u===t.length-2?function(){p(r)&&f(n)}:null))}),i}:function(){var n=arguments,t=[].slice.call(n,1),r=t[0];return g?(r?(u(t,function(n){h(n)||ct(y(n))}),w(y(n[0]),h(r)?r:function(){i.load.apply(null,t)})):w(y(n[0])),i):(d.push(function(){i.load.apply(null,n)}),i)},i.js=i.load,i.test=function(n,t,r,u){var f=typeof n=="object"?n:{test:n,success:!t?!1:ut(t)?t:[t],failure:!r?!1:ut(r)?r:[r],callback:u||v},e=!!f.test;return e&&!!f.success?(f.success.push(f.callback),i.load.apply(null,f.success)):e||!f.failure?u():(f.failure.push(f.callback),i.load.apply(null,f.failure)),i},i.ready=function(n,t){var e,u;return n===r?(o?f(t):k.push(t),i):(h(n)&&(t=n,n="ALL"),typeof n!="string"||!h(t))?i:(e=l[n],e&&e.state===a||n==="ALL"&&p()&&o)?(f(t),i):(u=s[n],u?u.push(t):u=s[n]=[t],i)},i.ready(r,function(){p()&&u(s.ALL,function(n){f(n)});i.feature&&i.feature("domloaded",!0)}),r.readyState==="complete")e();else if(r.addEventListener)r.addEventListener("DOMContentLoaded",b,!1),n.addEventListener("load",e,!1);else{r.attachEvent("onreadystatechange",b);n.attachEvent("onload",e);c=!1;try{c=!n.frameElement&&r.documentElement}catch(at){}c&&c.doScroll&&function lt(){if(!o){try{c.doScroll("left")}catch(t){n.clearTimeout(i.readyTimeout);i.readyTimeout=n.setTimeout(lt,50);return}e()}}()}setTimeout(function(){g=!0;u(d,function(n){n()})},300)})(window);
|
||||
/*
|
||||
//# sourceMappingURL=head.load.min.js.map
|
||||
*/
|
8
lib/js/extra/headjs/dist/0.99/head.load.min.js.map
vendored
Normal file
8
lib/js/extra/headjs/dist/0.99/head.load.min.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
9
lib/js/extra/headjs/dist/0.99/head.min.js
vendored
Normal file
9
lib/js/extra/headjs/dist/0.99/head.min.js
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
/*! head.core v0.99 */
|
||||
(function(n,t){"use strict";function r(n){a[a.length]=n}function k(n){var t=new RegExp(" \\b"+n+"\\b");c.className=c.className.replace(t,"")}function p(n,t){for(var i=0,r=n.length;i<r;i++)t.call(n,n[i],i)}function tt(){var t,e,f,o;c.className=c.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g,"");t=n.innerWidth||c.clientWidth;e=n.outerWidth||n.screen.width;u.screen.innerWidth=t;u.screen.outerWidth=e;r("w-"+t);p(i.screens,function(n){t>n?(i.screensCss.gt&&r("gt-"+n),i.screensCss.gte&&r("gte-"+n)):t<n?(i.screensCss.lt&&r("lt-"+n),i.screensCss.lte&&r("lte-"+n)):t===n&&(i.screensCss.lte&&r("lte-"+n),i.screensCss.eq&&r("e-q"+n),i.screensCss.gte&&r("gte-"+n))});f=n.innerHeight||c.clientHeight;o=n.outerHeight||n.screen.height;u.screen.innerHeight=f;u.screen.outerHeight=o;u.feature("portrait",f>t);u.feature("landscape",f<t)}function it(){n.clearTimeout(b);b=n.setTimeout(tt,50)}var y=n.document,rt=n.navigator,ut=n.location,c=y.documentElement,a=[],i={screens:[240,320,480,640,768,800,1024,1280,1440,1680,1920],screensCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!1},browsers:[{ie:{min:6,max:11}}],browserCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!0},section:"-section",page:"-page",head:"head"},v,u,s,w,o,h,l,d,f,g,nt,e,b;if(n.head_conf)for(v in n.head_conf)n.head_conf[v]!==t&&(i[v]=n.head_conf[v]);u=n[i.head]=function(){u.ready.apply(null,arguments)};u.feature=function(n,t,i){return n?(Object.prototype.toString.call(t)==="[object Function]"&&(t=t.call()),r((t?"":"no-")+n),u[n]=!!t,i||(k("no-"+n),k(n),u.feature()),u):(c.className+=" "+a.join(" "),a=[],u)};u.feature("js",!0);s=rt.userAgent.toLowerCase();w=/mobile|android|kindle|silk|midp|(windows nt 6\.2.+arm|touch)/.test(s);u.feature("mobile",w,!0);u.feature("desktop",!w,!0);s=/(chrome|firefox)[ \/]([\w.]+)/.exec(s)||/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(android)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(msie) ([\w.]+)/.exec(s)||[];o=s[1];h=parseFloat(s[2]);switch(o){case"msie":o="ie";h=y.documentMode||h;break;case"firefox":o="ff";break;case"ipod":case"ipad":case"iphone":o="ios";break;case"webkit":o="safari"}for(u.browser={name:o,version:h},u.browser[o]=!0,l=0,d=i.browsers.length;l<d;l++)for(f in i.browsers[l])if(o===f)for(r(f),g=i.browsers[l][f].min,nt=i.browsers[l][f].max,e=g;e<=nt;e++)h>e?(i.browserCss.gt&&r("gt-"+f+e),i.browserCss.gte&&r("gte-"+f+e)):h<e?(i.browserCss.lt&&r("lt-"+f+e),i.browserCss.lte&&r("lte-"+f+e)):h===e&&(i.browserCss.lte&&r("lte-"+f+e),i.browserCss.eq&&r("eq-"+f+e),i.browserCss.gte&&r("gte-"+f+e));else r("no-"+f);r(o);r(o+parseInt(h,10));o==="ie"&&h<9&&p("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|progress|section|summary|time|video".split("|"),function(n){y.createElement(n)});p(ut.pathname.split("/"),function(n,u){if(this.length>2&&this[u+1]!==t)u&&r(this.slice(u,u+1).join("-").toLowerCase()+i.section);else{var f=n||"index",e=f.indexOf(".");e>0&&(f=f.substring(0,e));c.id=f.toLowerCase()+i.page;u||r("root"+i.section)}});u.screen={height:n.screen.height,width:n.screen.width};tt();b=0;n.addEventListener?n.addEventListener("resize",it,!1):n.attachEvent("onresize",it)})(window);
|
||||
/*! head.css3 v0.99 */
|
||||
(function(n,t){"use strict";function a(n){for(var r in n)if(i[n[r]]!==t)return!0;return!1}function r(n){var t=n.charAt(0).toUpperCase()+n.substr(1),i=(n+" "+c.join(t+" ")+t).split(" ");return!!a(i)}var h=n.document,o=h.createElement("i"),i=o.style,s=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),c="Webkit Moz O ms Khtml".split(" "),l=n.head_conf&&n.head_conf.head||"head",u=n[l],f={gradient:function(){var n="background-image:";return i.cssText=(n+s.join("gradient(linear,left top,right bottom,from(#9f9),to(#fff));"+n)+s.join("linear-gradient(left top,#eee,#fff);"+n)).slice(0,-n.length),!!i.backgroundImage},rgba:function(){return i.cssText="background-color:rgba(0,0,0,0.5)",!!i.backgroundColor},opacity:function(){return o.style.opacity===""},textshadow:function(){return i.textShadow===""},multiplebgs:function(){i.cssText="background:url(https://),url(https://),red url(https://)";var n=(i.background||"").match(/url/g);return Object.prototype.toString.call(n)==="[object Array]"&&n.length===3},boxshadow:function(){return r("boxShadow")},borderimage:function(){return r("borderImage")},borderradius:function(){return r("borderRadius")},cssreflections:function(){return r("boxReflect")},csstransforms:function(){return r("transform")},csstransitions:function(){return r("transition")},touch:function(){return"ontouchstart"in n},retina:function(){return n.devicePixelRatio>1},fontface:function(){var t=u.browser.name,n=u.browser.version;switch(t){case"ie":return n>=9;case"chrome":return n>=13;case"ff":return n>=6;case"ios":return n>=5;case"android":return!1;case"webkit":return n>=5.1;case"opera":return n>=10;default:return!1}}};for(var e in f)f[e]&&u.feature(e,f[e].call(),!0);u.feature()})(window);
|
||||
/*! head.load v0.99 */
|
||||
(function(n,t){"use strict";function v(){}function u(n,t){if(n){typeof n=="object"&&(n=[].slice.call(n));for(var i=0,r=n.length;i<r;i++)t.call(n,n[i],i)}}function rt(n,i){var r=Object.prototype.toString.call(i).slice(8,-1);return i!==t&&i!==null&&r===n}function h(n){return rt("Function",n)}function ut(n){return rt("Array",n)}function st(n){var i=n.split("/"),t=i[i.length-1],r=t.indexOf("?");return r!==-1?t.substring(0,r):t}function f(n){(n=n||v,n._done)||(n(),n._done=1)}function y(n){var t={},i,r;if(typeof n=="object")for(i in n)!n[i]||(t={name:i,url:n[i]});else t={name:st(n),url:n};return(r=l[t.name],r&&r.url===t.url)?r:(l[t.name]=t,t)}function p(n){n=n||l;for(var t in n)if(n.hasOwnProperty(t)&&n[t].state!==a)return!1;return!0}function ht(n){n.state=ot;u(n.onpreload,function(n){n.call()})}function ct(n){n.state===t&&(n.state=tt,n.onpreload=[],ft({url:n.url,type:"cache"},function(){ht(n)}))}function w(n,t){if(t=t||v,n.state===a){t();return}if(n.state===it){i.ready(n.name,t);return}if(n.state===tt){n.onpreload.push(function(){w(n,t)});return}n.state=it;ft(n,function(){n.state=a;t();u(s[n.name],function(n){f(n)});o&&p()&&u(s.ALL,function(n){f(n)})})}function ft(t,i){function e(t){t=t||n.event;u.onload=u.onreadystatechange=u.onerror=null;i()}function o(t){t=t||n.event;(t.type==="load"||/loaded|complete/.test(u.readyState)&&(!r.documentMode||r.documentMode<9))&&(u.onload=u.onreadystatechange=u.onerror=null,i())}var u,f;i=i||v;/\.css[^\.]*$/.test(t.url)?(u=r.createElement("link"),u.type="text/"+(t.type||"css"),u.rel="stylesheet",u.href=t.url):(u=r.createElement("script"),u.type="text/"+(t.type||"javascript"),u.src=t.url);u.onload=u.onreadystatechange=o;u.onerror=e;u.async=!1;u.defer=!1;f=r.head||r.getElementsByTagName("head")[0];f.insertBefore(u,f.lastChild)}function e(){if(!r.body){n.clearTimeout(i.readyTimeout);i.readyTimeout=n.setTimeout(e,50);return}o||(o=!0,u(k,function(n){f(n)}))}function b(){r.addEventListener?(r.removeEventListener("DOMContentLoaded",b,!1),e()):r.readyState==="complete"&&(r.detachEvent("onreadystatechange",b),e())}var r=n.document,k=[],d=[],s={},l={},et="async"in r.createElement("script")||"MozAppearance"in r.documentElement.style||n.opera,g,o,nt=n.head_conf&&n.head_conf.head||"head",i=n[nt]=n[nt]||function(){i.ready.apply(null,arguments)},tt=1,ot=2,it=3,a=4,c;if(i.load=et?function(){var t=arguments,n=t[t.length-1],r={};return h(n)||(n=null),u(t,function(i,u){i!==n&&(i=y(i),r[i.name]=i,w(i,n&&u===t.length-2?function(){p(r)&&f(n)}:null))}),i}:function(){var n=arguments,t=[].slice.call(n,1),r=t[0];return g?(r?(u(t,function(n){h(n)||ct(y(n))}),w(y(n[0]),h(r)?r:function(){i.load.apply(null,t)})):w(y(n[0])),i):(d.push(function(){i.load.apply(null,n)}),i)},i.js=i.load,i.test=function(n,t,r,u){var f=typeof n=="object"?n:{test:n,success:!t?!1:ut(t)?t:[t],failure:!r?!1:ut(r)?r:[r],callback:u||v},e=!!f.test;return e&&!!f.success?(f.success.push(f.callback),i.load.apply(null,f.success)):e||!f.failure?u():(f.failure.push(f.callback),i.load.apply(null,f.failure)),i},i.ready=function(n,t){var e,u;return n===r?(o?f(t):k.push(t),i):(h(n)&&(t=n,n="ALL"),typeof n!="string"||!h(t))?i:(e=l[n],e&&e.state===a||n==="ALL"&&p()&&o)?(f(t),i):(u=s[n],u?u.push(t):u=s[n]=[t],i)},i.ready(r,function(){p()&&u(s.ALL,function(n){f(n)});i.feature&&i.feature("domloaded",!0)}),r.readyState==="complete")e();else if(r.addEventListener)r.addEventListener("DOMContentLoaded",b,!1),n.addEventListener("load",e,!1);else{r.attachEvent("onreadystatechange",b);n.attachEvent("onload",e);c=!1;try{c=!n.frameElement&&r.documentElement}catch(at){}c&&c.doScroll&&function lt(){if(!o){try{c.doScroll("left")}catch(t){n.clearTimeout(i.readyTimeout);i.readyTimeout=n.setTimeout(lt,50);return}e()}}()}setTimeout(function(){g=!0;u(d,function(n){n()})},300)})(window);
|
||||
/*
|
||||
//# sourceMappingURL=head.min.js.map
|
||||
*/
|
8
lib/js/extra/headjs/dist/0.99/head.min.js.map
vendored
Normal file
8
lib/js/extra/headjs/dist/0.99/head.min.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
61
lib/js/extra/headjs/dist/0.99/head.nuspec
vendored
Normal file
61
lib/js/extra/headjs/dist/0.99/head.nuspec
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>HeadJS</id>
|
||||
<version>0.99</version>
|
||||
<title>HeadJS</title>
|
||||
<authors>Tero Piirainen,Robert Hoffmann</authors>
|
||||
<owners>itechnology</owners>
|
||||
<licenseUrl>http://bit.ly/mit-license</licenseUrl>
|
||||
<projectUrl>http://headjs.com</projectUrl>
|
||||
<iconUrl>http://headjs.com/favicon.png</iconUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>At under 5K minified & gzipped
|
||||
|
||||
HeadJS provides you with:
|
||||
|
||||
* Asset Loader
|
||||
Load scripts and stylesheets when you need them.
|
||||
head.load("file1.js" , "file2.js" , function() { done(); })
|
||||
head.load("file1.css", "file2.css", function() { done(); })
|
||||
|
||||
* JavaScript Organizer
|
||||
Defer execution to the bottom of page.
|
||||
head.ready(function() { imReady(); })
|
||||
|
||||
* Responsive Design
|
||||
Detect and react to resolutions with simple css classes or js tests that work without media query support.
|
||||
.landscape, .lt-800, .gt-1680, if (head.mobile) { }
|
||||
|
||||
* Browser Detection
|
||||
Detect browsers & their version, and apply css or js logic to them.
|
||||
.gt-ie6, .lt-ie10, if (head.browser.ios) { }
|
||||
|
||||
* Feature Detection
|
||||
Detect browser features like cssreflections, touch-enabled
|
||||
.no-touch if (!head.touch) { }
|
||||
|
||||
* CSS Moderniser
|
||||
Detect css support like box-shadow, border-radius
|
||||
.no-borderradius, if (!head.borderradius) { }
|
||||
|
||||
* CSS Router
|
||||
Detect which page and section someone is on and target it with specific css.
|
||||
.index-page, .register-page, .root-section, .user-section,
|
||||
|
||||
* HTML5 Shim
|
||||
Need to support the new HTML5 tags in older browsers ? No problem !
|
||||
|
||||
* And more
|
||||
..well, a little bit :-)</description>
|
||||
<summary>Load scripts and stylesheets on demand. Achieve responsive design with CSS that targets different screen resolutions, paths, states and browsers. Detect various browsers and their features. Target HTML5 and CSS3 safely.</summary>
|
||||
<releaseNotes />
|
||||
<copyright>Tero Piirainen</copyright>
|
||||
<language>en-US</language>
|
||||
<tags>javascript, html, html5, css, css3, loader, responsive design, media queries, feature detection, dependency loading, mobile, tablet</tags>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="head.js" target="Content\Scripts\head.js" />
|
||||
<file src="head.min.js" target="Content\Scripts\head.min.js" />
|
||||
</files>
|
||||
</package>
|
25
lib/js/extra/headjs/dist/1.0.0/README.md
vendored
Normal file
25
lib/js/extra/headjs/dist/1.0.0/README.md
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
##Prepackaged Files
|
||||
|
||||
###Full: Responsive Design + Feature Detections + Asset Loader
|
||||
####head.js / head.min.js
|
||||
|
||||
- Contains: core.js, css3.js, and load.js
|
||||
- For Debug: head.min.js.map ([js source map](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/))
|
||||
|
||||
###Bundle: Responsive Design + Feature Detections
|
||||
####head.css3.js / head.css3.min.js
|
||||
|
||||
- Contains: core.js and css3.js
|
||||
- For Debug: head.css3.min.js.map ([js source map](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/))
|
||||
|
||||
###Bundle: Responsive Design
|
||||
####head.core.js / head.core.min.js
|
||||
|
||||
- Contains: core.js
|
||||
- For Debug: head.core.min.js.map ([js source map](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/))
|
||||
|
||||
###Bundle: Asset Loader
|
||||
####head.load.js / head.load.min.js
|
||||
|
||||
- Contains: load.js
|
||||
- For Debug: head.load.min.js.map ([js source map](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/))
|
96
lib/js/extra/headjs/dist/1.0.0/changelog.txt
vendored
Normal file
96
lib/js/extra/headjs/dist/1.0.0/changelog.txt
vendored
Normal file
|
@ -0,0 +1,96 @@
|
|||
1.0.3 (2013-11-22)
|
||||
- New: Timeout added to resource loading
|
||||
- New: CSS callbacks now executed for all browsers
|
||||
- https://github.com/headjs/headjs/pull/273
|
||||
- New: Changed how file extensions are parsed for detecting css files
|
||||
- in the future, we will need to add a way to supply a filetype when loading resources via scripts like: style.aspx, style.php
|
||||
- Fix: Array loading & trigger not functioning correctly on old browsers
|
||||
- https://github.com/headjs/headjs/issues/274
|
||||
- Fix: ready() sometimes does not trigger if assets are loaded too fast
|
||||
- https://github.com/headjs/headjs/issues/271
|
||||
|
||||
1.0.2 (2013-11-13)
|
||||
- Fix: no-js class not being removed
|
||||
- https://github.com/headjs/headjs/issues/270
|
||||
|
||||
1.0.1 (2013-11-05)
|
||||
- Fix: Old IE's can trigger ready too soon
|
||||
- https://github.com/headjs/headjs/issues/203
|
||||
|
||||
1.0.0 (2013-11-04)
|
||||
- New: Detect Windows 8 Mobile (Surface RT/Pro), IE11, Kindle, and other Android devices
|
||||
- New: Add Browser & Version CSS no matter what browser breakpoints are configured
|
||||
- Example: .ff .ff20
|
||||
- There is no need to cycle through all browser versions in 90% of cases
|
||||
- Makes it possible to work without any breakpoints at all
|
||||
- New: Improved CSS Router
|
||||
- https://github.com/headjs/headjs/issues/227
|
||||
- New: Added "main" HTML5 element to shim
|
||||
- https://github.com/headjs/headjs/pull/230
|
||||
- New: Enable/Disable HTML5 Shim in head_conf
|
||||
- New: Load files from Array of Files or Array of Labels
|
||||
- head.load(["file1", "file2"], callBack);
|
||||
- head.load([{ label1: "file1" }, { label2: "file2" }], callBack);
|
||||
- https://github.com/headjs/headjs/issues/139
|
||||
- New: Possibility to wait for multiple labels or files
|
||||
- head.ready(["label1", "label2"], callBack);
|
||||
- head.ready(["file1.js", "file2.js"], callBack);
|
||||
- https://github.com/headjs/headjs/pull/212
|
||||
- New: Load file via data attribute on HeadJS script tag
|
||||
- data-headjs-load="configuration.js"
|
||||
- https://github.com/headjs/headjs/pull/213
|
||||
- New: Source map files have been added for all minified JS files
|
||||
- Fix: Prevent loading empty strings
|
||||
- https://github.com/headjs/headjs/pull/184
|
||||
- Fix: CSS classes getting bigger on successive resizes under Chrome
|
||||
- https://github.com/headjs/headjs/issues/226
|
||||
- Fix: Invalid regular expression for CSS detection
|
||||
- https://github.com/headjs/headjs/issues/255
|
||||
- Fix: callback failing to trigger under certain cirumstances
|
||||
- https://github.com/headjs/headjs/issues/262
|
||||
- Divers: Changed window.frameElement detection
|
||||
- https://github.com/headjs/headjs/pull/257
|
||||
- Divers: Cleaned up a bunch of syntaxt to conform to JSHint
|
||||
- Now using a very strict .jshintrc
|
||||
- Divers: Added missing .gitattributes
|
||||
|
||||
0.99 (2012-11-15)
|
||||
- Load: Fixed regression in IE6, caused by IE10 fix
|
||||
- Load: CSS loading seems to work in all browsers.
|
||||
- However a few will not trigger the callback. Over 90% do.
|
||||
- Either don't use it, or only load css in situations when you don't need the callback triggered.
|
||||
- Load: Conditional loading with head.test() now in evaluation phase
|
||||
- try it, but don't rely on it yet
|
||||
- head.test(bool, "ok.js", "failed.js", callback)
|
||||
- All: CDN is now availiable thanks to: http://cloudflare.com
|
||||
- Info in download section on main site
|
||||
- Unit Tests
|
||||
- Integrated with main site so that everyone can participate
|
||||
- They have also been hooked up to automatically report stats back to http://browserscope.org
|
||||
|
||||
0.98 (2012-11-09)
|
||||
- Load: Fixed loading bug in IE10
|
||||
- Load: Corrected some issues with loading from inside <head>
|
||||
- Load: Rewrite of large parts of code base
|
||||
- Started to massively document the sourcecode :)
|
||||
- Css3: moved "touch" detection from core to here
|
||||
- Css3: added "retina" detection
|
||||
- Css3: replaced "font-face" detection that was using "Conditional Comments" with simplisitc browser version detection
|
||||
- Core: Added gt, gte, lte, eq classes to width detection (lt existed already)
|
||||
- Core: Added gt, gte, lt, lte, eq classes for browser vendor & version detection
|
||||
- By default only lt/gt classes are activated
|
||||
- You can of course configure to your likings via head_conf
|
||||
|
||||
0.97a (2012-10-20)
|
||||
- Updated QUnit & got unit tests running again
|
||||
- Swictched to "use strict"
|
||||
- Fixed up some variable usage
|
||||
- Added browser detections other than just for ie-lt
|
||||
- updated browser regexes (firefox, safari, opera, ios, android, webkit)
|
||||
- detect if browser is: desktop, mobile, touch enabled
|
||||
- detect portrait/landscape mode
|
||||
- html5 shim now only triggers on ie-lt9
|
||||
- added a throttle to onResize, since some browsers fire tons of events/sec
|
||||
- added corrected height/width measurements, but only exposed via new object: head.screen
|
||||
- contains height/width, innerHeight/innerWidth, outerHeight/outerWidth
|
||||
- force all css router names to lowercase just in case ppl try typing in names with wierd casings
|
312
lib/js/extra/headjs/dist/1.0.0/head.core.js
vendored
Normal file
312
lib/js/extra/headjs/dist/1.0.0/head.core.js
vendored
Normal file
|
@ -0,0 +1,312 @@
|
|||
///#source 1 1 /src/1.0.0/core.js
|
||||
/*! head.core - v1.0.2 */
|
||||
/*
|
||||
* HeadJS The only script in your <HEAD>
|
||||
* Author Tero Piirainen (tipiirai)
|
||||
* Maintainer Robert Hoffmann (itechnology)
|
||||
* License MIT / http://bit.ly/mit-license
|
||||
* WebSite http://headjs.com
|
||||
*/
|
||||
(function(win, undefined) {
|
||||
"use strict";
|
||||
|
||||
// gt, gte, lt, lte, eq breakpoints would have been more simple to write as ['gt','gte','lt','lte','eq']
|
||||
// but then we would have had to loop over the collection on each resize() event,
|
||||
// a simple object with a direct access to true/false is therefore much more efficient
|
||||
var doc = win.document,
|
||||
nav = win.navigator,
|
||||
loc = win.location,
|
||||
html = doc.documentElement,
|
||||
klass = [],
|
||||
conf = {
|
||||
screens : [240, 320, 480, 640, 768, 800, 1024, 1280, 1440, 1680, 1920],
|
||||
screensCss: { "gt": true, "gte": false, "lt": true, "lte": false, "eq": false },
|
||||
browsers : [
|
||||
{ ie: { min: 6, max: 11 } }
|
||||
//,{ chrome : { min: 8, max: 33 } }
|
||||
//,{ ff : { min: 3, max: 26 } }
|
||||
//,{ ios : { min: 3, max: 7 } }
|
||||
//,{ android: { min: 2, max: 4 } }
|
||||
//,{ webkit : { min: 9, max: 12 } }
|
||||
//,{ opera : { min: 9, max: 12 } }
|
||||
],
|
||||
browserCss: { "gt": true, "gte": false, "lt": true, "lte": false, "eq": true },
|
||||
html5 : true,
|
||||
page : "-page",
|
||||
section : "-section",
|
||||
head : "head"
|
||||
};
|
||||
|
||||
if (win.head_conf) {
|
||||
for (var item in win.head_conf) {
|
||||
if (win.head_conf[item] !== undefined) {
|
||||
conf[item] = win.head_conf[item];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function pushClass(name) {
|
||||
klass[klass.length] = name;
|
||||
}
|
||||
|
||||
function removeClass(name) {
|
||||
// need to test for both space and no space
|
||||
// https://github.com/headjs/headjs/issues/270
|
||||
// https://github.com/headjs/headjs/issues/226
|
||||
var re = new RegExp(" ?\\b" + name + "\\b");
|
||||
html.className = html.className.replace(re, "");
|
||||
}
|
||||
|
||||
function each(arr, fn) {
|
||||
for (var i = 0, l = arr.length; i < l; i++) {
|
||||
fn.call(arr, arr[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
// API
|
||||
var api = win[conf.head] = function() {
|
||||
api.ready.apply(null, arguments);
|
||||
};
|
||||
|
||||
api.feature = function(key, enabled, queue) {
|
||||
|
||||
// internal: apply all classes
|
||||
if (!key) {
|
||||
html.className += " " + klass.join(" ");
|
||||
klass = [];
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
if (Object.prototype.toString.call(enabled) === "[object Function]") {
|
||||
enabled = enabled.call();
|
||||
}
|
||||
|
||||
pushClass((enabled ? "" : "no-") + key);
|
||||
api[key] = !!enabled;
|
||||
|
||||
// apply class to HTML element
|
||||
if (!queue) {
|
||||
removeClass("no-" + key);
|
||||
removeClass(key);
|
||||
api.feature();
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
// no queue here, so we can remove any eventual pre-existing no-js class
|
||||
api.feature("js", true);
|
||||
|
||||
// browser type & version
|
||||
var ua = nav.userAgent.toLowerCase(),
|
||||
mobile = /mobile|android|kindle|silk|midp|phone|(windows .+arm|touch)/.test(ua);
|
||||
|
||||
// useful for enabling/disabling feature (we can consider a desktop navigator to have more cpu/gpu power)
|
||||
api.feature("mobile" , mobile , true);
|
||||
api.feature("desktop", !mobile, true);
|
||||
|
||||
// http://www.zytrax.com/tech/web/browser_ids.htm
|
||||
// http://www.zytrax.com/tech/web/mobile_ids.html
|
||||
ua = /(chrome|firefox)[ \/]([\w.]+)/.exec(ua) || // Chrome & Firefox
|
||||
/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile IOS
|
||||
/(android)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile Webkit
|
||||
/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Safari & Opera
|
||||
/(msie) ([\w.]+)/.exec(ua) ||
|
||||
/(trident).+rv:(\w.)+/.exec(ua) || [];
|
||||
|
||||
var browser = ua[1],
|
||||
version = parseFloat(ua[2]);
|
||||
|
||||
switch (browser) {
|
||||
case "msie":
|
||||
case "trident":
|
||||
browser = "ie";
|
||||
version = doc.documentMode || version;
|
||||
break;
|
||||
|
||||
case "firefox":
|
||||
browser = "ff";
|
||||
break;
|
||||
|
||||
case "ipod":
|
||||
case "ipad":
|
||||
case "iphone":
|
||||
browser = "ios";
|
||||
break;
|
||||
|
||||
case "webkit":
|
||||
browser = "safari";
|
||||
break;
|
||||
}
|
||||
|
||||
// Browser vendor and version
|
||||
api.browser = {
|
||||
name: browser,
|
||||
version: version
|
||||
};
|
||||
api.browser[browser] = true;
|
||||
|
||||
for (var i = 0, l = conf.browsers.length; i < l; i++) {
|
||||
for (var key in conf.browsers[i]) {
|
||||
if (browser === key) {
|
||||
pushClass(key);
|
||||
|
||||
var min = conf.browsers[i][key].min;
|
||||
var max = conf.browsers[i][key].max;
|
||||
|
||||
for (var v = min; v <= max; v++) {
|
||||
if (version > v) {
|
||||
if (conf.browserCss.gt) {
|
||||
pushClass("gt-" + key + v);
|
||||
}
|
||||
|
||||
if (conf.browserCss.gte) {
|
||||
pushClass("gte-" + key + v);
|
||||
}
|
||||
} else if (version < v) {
|
||||
if (conf.browserCss.lt) {
|
||||
pushClass("lt-" + key + v);
|
||||
}
|
||||
|
||||
if (conf.browserCss.lte) {
|
||||
pushClass("lte-" + key + v);
|
||||
}
|
||||
} else if (version === v) {
|
||||
if (conf.browserCss.lte) {
|
||||
pushClass("lte-" + key + v);
|
||||
}
|
||||
|
||||
if (conf.browserCss.eq) {
|
||||
pushClass("eq-" + key + v);
|
||||
}
|
||||
|
||||
if (conf.browserCss.gte) {
|
||||
pushClass("gte-" + key + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pushClass("no-" + key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pushClass(browser);
|
||||
pushClass(browser + parseInt(version, 10));
|
||||
|
||||
// IE lt9 specific
|
||||
if (conf.html5 && browser === "ie" && version < 9) {
|
||||
// HTML5 support : you still need to add html5 css initialization styles to your site
|
||||
// See: assets/html5.css
|
||||
each("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|progress|section|summary|time|video".split("|"), function(el) {
|
||||
doc.createElement(el);
|
||||
});
|
||||
}
|
||||
|
||||
// CSS "router"
|
||||
each(loc.pathname.split("/"), function(el, i) {
|
||||
if (this.length > 2 && this[i + 1] !== undefined) {
|
||||
if (i) {
|
||||
pushClass(this.slice(i, i + 1).join("-").toLowerCase() + conf.section);
|
||||
}
|
||||
} else {
|
||||
// pageId
|
||||
var id = el || "index", index = id.indexOf(".");
|
||||
if (index > 0) {
|
||||
id = id.substring(0, index);
|
||||
}
|
||||
|
||||
html.id = id.toLowerCase() + conf.page;
|
||||
|
||||
// on root?
|
||||
if (!i) {
|
||||
pushClass("root" + conf.section);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// basic screen info
|
||||
api.screen = {
|
||||
height: win.screen.height,
|
||||
width : win.screen.width
|
||||
};
|
||||
|
||||
// viewport resolutions: w-100, lt-480, lt-1024 ...
|
||||
function screenSize() {
|
||||
// remove earlier sizes
|
||||
html.className = html.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g, "");
|
||||
|
||||
// Viewport width
|
||||
var iw = win.innerWidth || html.clientWidth,
|
||||
ow = win.outerWidth || win.screen.width;
|
||||
|
||||
api.screen.innerWidth = iw;
|
||||
api.screen.outerWidth = ow;
|
||||
|
||||
// for debugging purposes, not really useful for anything else
|
||||
pushClass("w-" + iw);
|
||||
|
||||
each(conf.screens, function(width) {
|
||||
if (iw > width) {
|
||||
if (conf.screensCss.gt) {
|
||||
pushClass("gt-" + width);
|
||||
}
|
||||
|
||||
if (conf.screensCss.gte) {
|
||||
pushClass("gte-" + width);
|
||||
}
|
||||
} else if (iw < width) {
|
||||
if (conf.screensCss.lt) {
|
||||
pushClass("lt-" + width);
|
||||
}
|
||||
|
||||
if (conf.screensCss.lte) {
|
||||
pushClass("lte-" + width);
|
||||
}
|
||||
} else if (iw === width) {
|
||||
if (conf.screensCss.lte) {
|
||||
pushClass("lte-" + width);
|
||||
}
|
||||
|
||||
if (conf.screensCss.eq) {
|
||||
pushClass("e-q" + width);
|
||||
}
|
||||
|
||||
if (conf.screensCss.gte) {
|
||||
pushClass("gte-" + width);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Viewport height
|
||||
var ih = win.innerHeight || html.clientHeight,
|
||||
oh = win.outerHeight || win.screen.height;
|
||||
|
||||
api.screen.innerHeight = ih;
|
||||
api.screen.outerHeight = oh;
|
||||
|
||||
// no need for onChange event to detect this
|
||||
api.feature("portrait" , (ih > iw));
|
||||
api.feature("landscape", (ih < iw));
|
||||
}
|
||||
|
||||
screenSize();
|
||||
|
||||
// Throttle navigators from triggering too many resize events
|
||||
var resizeId = 0;
|
||||
|
||||
function onResize() {
|
||||
win.clearTimeout(resizeId);
|
||||
resizeId = win.setTimeout(screenSize, 50);
|
||||
}
|
||||
|
||||
// Manually attach, as to not overwrite existing handler
|
||||
if (win.addEventListener) {
|
||||
win.addEventListener("resize", onResize, false);
|
||||
|
||||
} else {
|
||||
// IE8 and less
|
||||
win.attachEvent("onresize", onResize);
|
||||
}
|
||||
}(window));
|
5
lib/js/extra/headjs/dist/1.0.0/head.core.min.js
vendored
Normal file
5
lib/js/extra/headjs/dist/1.0.0/head.core.min.js
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
/*! head.core - v1.0.2 */
|
||||
(function(n,t){"use strict";function r(n){a[a.length]=n}function k(n){var t=new RegExp(" ?\\b"+n+"\\b");c.className=c.className.replace(t,"")}function p(n,t){for(var i=0,r=n.length;i<r;i++)t.call(n,n[i],i)}function tt(){var t,e,f,o;c.className=c.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g,"");t=n.innerWidth||c.clientWidth;e=n.outerWidth||n.screen.width;u.screen.innerWidth=t;u.screen.outerWidth=e;r("w-"+t);p(i.screens,function(n){t>n?(i.screensCss.gt&&r("gt-"+n),i.screensCss.gte&&r("gte-"+n)):t<n?(i.screensCss.lt&&r("lt-"+n),i.screensCss.lte&&r("lte-"+n)):t===n&&(i.screensCss.lte&&r("lte-"+n),i.screensCss.eq&&r("e-q"+n),i.screensCss.gte&&r("gte-"+n))});f=n.innerHeight||c.clientHeight;o=n.outerHeight||n.screen.height;u.screen.innerHeight=f;u.screen.outerHeight=o;u.feature("portrait",f>t);u.feature("landscape",f<t)}function it(){n.clearTimeout(b);b=n.setTimeout(tt,50)}var y=n.document,rt=n.navigator,ut=n.location,c=y.documentElement,a=[],i={screens:[240,320,480,640,768,800,1024,1280,1440,1680,1920],screensCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!1},browsers:[{ie:{min:6,max:11}}],browserCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!0},html5:!0,page:"-page",section:"-section",head:"head"},v,u,s,w,o,h,l,d,f,g,nt,e,b;if(n.head_conf)for(v in n.head_conf)n.head_conf[v]!==t&&(i[v]=n.head_conf[v]);u=n[i.head]=function(){u.ready.apply(null,arguments)};u.feature=function(n,t,i){return n?(Object.prototype.toString.call(t)==="[object Function]"&&(t=t.call()),r((t?"":"no-")+n),u[n]=!!t,i||(k("no-"+n),k(n),u.feature()),u):(c.className+=" "+a.join(" "),a=[],u)};u.feature("js",!0);s=rt.userAgent.toLowerCase();w=/mobile|android|kindle|silk|midp|phone|(windows .+arm|touch)/.test(s);u.feature("mobile",w,!0);u.feature("desktop",!w,!0);s=/(chrome|firefox)[ \/]([\w.]+)/.exec(s)||/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(android)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(msie) ([\w.]+)/.exec(s)||/(trident).+rv:(\w.)+/.exec(s)||[];o=s[1];h=parseFloat(s[2]);switch(o){case"msie":case"trident":o="ie";h=y.documentMode||h;break;case"firefox":o="ff";break;case"ipod":case"ipad":case"iphone":o="ios";break;case"webkit":o="safari"}for(u.browser={name:o,version:h},u.browser[o]=!0,l=0,d=i.browsers.length;l<d;l++)for(f in i.browsers[l])if(o===f)for(r(f),g=i.browsers[l][f].min,nt=i.browsers[l][f].max,e=g;e<=nt;e++)h>e?(i.browserCss.gt&&r("gt-"+f+e),i.browserCss.gte&&r("gte-"+f+e)):h<e?(i.browserCss.lt&&r("lt-"+f+e),i.browserCss.lte&&r("lte-"+f+e)):h===e&&(i.browserCss.lte&&r("lte-"+f+e),i.browserCss.eq&&r("eq-"+f+e),i.browserCss.gte&&r("gte-"+f+e));else r("no-"+f);r(o);r(o+parseInt(h,10));i.html5&&o==="ie"&&h<9&&p("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|progress|section|summary|time|video".split("|"),function(n){y.createElement(n)});p(ut.pathname.split("/"),function(n,u){if(this.length>2&&this[u+1]!==t)u&&r(this.slice(u,u+1).join("-").toLowerCase()+i.section);else{var f=n||"index",e=f.indexOf(".");e>0&&(f=f.substring(0,e));c.id=f.toLowerCase()+i.page;u||r("root"+i.section)}});u.screen={height:n.screen.height,width:n.screen.width};tt();b=0;n.addEventListener?n.addEventListener("resize",it,!1):n.attachEvent("onresize",it)})(window);
|
||||
/*
|
||||
//# sourceMappingURL=head.core.min.js.map
|
||||
*/
|
8
lib/js/extra/headjs/dist/1.0.0/head.core.min.js.map
vendored
Normal file
8
lib/js/extra/headjs/dist/1.0.0/head.core.min.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
477
lib/js/extra/headjs/dist/1.0.0/head.css3.js
vendored
Normal file
477
lib/js/extra/headjs/dist/1.0.0/head.css3.js
vendored
Normal file
|
@ -0,0 +1,477 @@
|
|||
///#source 1 1 /src/1.0.0/core.js
|
||||
/*! head.core - v1.0.2 */
|
||||
/*
|
||||
* HeadJS The only script in your <HEAD>
|
||||
* Author Tero Piirainen (tipiirai)
|
||||
* Maintainer Robert Hoffmann (itechnology)
|
||||
* License MIT / http://bit.ly/mit-license
|
||||
* WebSite http://headjs.com
|
||||
*/
|
||||
(function(win, undefined) {
|
||||
"use strict";
|
||||
|
||||
// gt, gte, lt, lte, eq breakpoints would have been more simple to write as ['gt','gte','lt','lte','eq']
|
||||
// but then we would have had to loop over the collection on each resize() event,
|
||||
// a simple object with a direct access to true/false is therefore much more efficient
|
||||
var doc = win.document,
|
||||
nav = win.navigator,
|
||||
loc = win.location,
|
||||
html = doc.documentElement,
|
||||
klass = [],
|
||||
conf = {
|
||||
screens : [240, 320, 480, 640, 768, 800, 1024, 1280, 1440, 1680, 1920],
|
||||
screensCss: { "gt": true, "gte": false, "lt": true, "lte": false, "eq": false },
|
||||
browsers : [
|
||||
{ ie: { min: 6, max: 11 } }
|
||||
//,{ chrome : { min: 8, max: 33 } }
|
||||
//,{ ff : { min: 3, max: 26 } }
|
||||
//,{ ios : { min: 3, max: 7 } }
|
||||
//,{ android: { min: 2, max: 4 } }
|
||||
//,{ webkit : { min: 9, max: 12 } }
|
||||
//,{ opera : { min: 9, max: 12 } }
|
||||
],
|
||||
browserCss: { "gt": true, "gte": false, "lt": true, "lte": false, "eq": true },
|
||||
html5 : true,
|
||||
page : "-page",
|
||||
section : "-section",
|
||||
head : "head"
|
||||
};
|
||||
|
||||
if (win.head_conf) {
|
||||
for (var item in win.head_conf) {
|
||||
if (win.head_conf[item] !== undefined) {
|
||||
conf[item] = win.head_conf[item];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function pushClass(name) {
|
||||
klass[klass.length] = name;
|
||||
}
|
||||
|
||||
function removeClass(name) {
|
||||
// need to test for both space and no space
|
||||
// https://github.com/headjs/headjs/issues/270
|
||||
// https://github.com/headjs/headjs/issues/226
|
||||
var re = new RegExp(" ?\\b" + name + "\\b");
|
||||
html.className = html.className.replace(re, "");
|
||||
}
|
||||
|
||||
function each(arr, fn) {
|
||||
for (var i = 0, l = arr.length; i < l; i++) {
|
||||
fn.call(arr, arr[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
// API
|
||||
var api = win[conf.head] = function() {
|
||||
api.ready.apply(null, arguments);
|
||||
};
|
||||
|
||||
api.feature = function(key, enabled, queue) {
|
||||
|
||||
// internal: apply all classes
|
||||
if (!key) {
|
||||
html.className += " " + klass.join(" ");
|
||||
klass = [];
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
if (Object.prototype.toString.call(enabled) === "[object Function]") {
|
||||
enabled = enabled.call();
|
||||
}
|
||||
|
||||
pushClass((enabled ? "" : "no-") + key);
|
||||
api[key] = !!enabled;
|
||||
|
||||
// apply class to HTML element
|
||||
if (!queue) {
|
||||
removeClass("no-" + key);
|
||||
removeClass(key);
|
||||
api.feature();
|
||||
}
|
||||
|
||||
return api;
|
||||
};
|
||||
|
||||
// no queue here, so we can remove any eventual pre-existing no-js class
|
||||
api.feature("js", true);
|
||||
|
||||
// browser type & version
|
||||
var ua = nav.userAgent.toLowerCase(),
|
||||
mobile = /mobile|android|kindle|silk|midp|phone|(windows .+arm|touch)/.test(ua);
|
||||
|
||||
// useful for enabling/disabling feature (we can consider a desktop navigator to have more cpu/gpu power)
|
||||
api.feature("mobile" , mobile , true);
|
||||
api.feature("desktop", !mobile, true);
|
||||
|
||||
// http://www.zytrax.com/tech/web/browser_ids.htm
|
||||
// http://www.zytrax.com/tech/web/mobile_ids.html
|
||||
ua = /(chrome|firefox)[ \/]([\w.]+)/.exec(ua) || // Chrome & Firefox
|
||||
/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile IOS
|
||||
/(android)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile Webkit
|
||||
/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Safari & Opera
|
||||
/(msie) ([\w.]+)/.exec(ua) ||
|
||||
/(trident).+rv:(\w.)+/.exec(ua) || [];
|
||||
|
||||
var browser = ua[1],
|
||||
version = parseFloat(ua[2]);
|
||||
|
||||
switch (browser) {
|
||||
case "msie":
|
||||
case "trident":
|
||||
browser = "ie";
|
||||
version = doc.documentMode || version;
|
||||
break;
|
||||
|
||||
case "firefox":
|
||||
browser = "ff";
|
||||
break;
|
||||
|
||||
case "ipod":
|
||||
case "ipad":
|
||||
case "iphone":
|
||||
browser = "ios";
|
||||
break;
|
||||
|
||||
case "webkit":
|
||||
browser = "safari";
|
||||
break;
|
||||
}
|
||||
|
||||
// Browser vendor and version
|
||||
api.browser = {
|
||||
name: browser,
|
||||
version: version
|
||||
};
|
||||
api.browser[browser] = true;
|
||||
|
||||
for (var i = 0, l = conf.browsers.length; i < l; i++) {
|
||||
for (var key in conf.browsers[i]) {
|
||||
if (browser === key) {
|
||||
pushClass(key);
|
||||
|
||||
var min = conf.browsers[i][key].min;
|
||||
var max = conf.browsers[i][key].max;
|
||||
|
||||
for (var v = min; v <= max; v++) {
|
||||
if (version > v) {
|
||||
if (conf.browserCss.gt) {
|
||||
pushClass("gt-" + key + v);
|
||||
}
|
||||
|
||||
if (conf.browserCss.gte) {
|
||||
pushClass("gte-" + key + v);
|
||||
}
|
||||
} else if (version < v) {
|
||||
if (conf.browserCss.lt) {
|
||||
pushClass("lt-" + key + v);
|
||||
}
|
||||
|
||||
if (conf.browserCss.lte) {
|
||||
pushClass("lte-" + key + v);
|
||||
}
|
||||
} else if (version === v) {
|
||||
if (conf.browserCss.lte) {
|
||||
pushClass("lte-" + key + v);
|
||||
}
|
||||
|
||||
if (conf.browserCss.eq) {
|
||||
pushClass("eq-" + key + v);
|
||||
}
|
||||
|
||||
if (conf.browserCss.gte) {
|
||||
pushClass("gte-" + key + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pushClass("no-" + key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pushClass(browser);
|
||||
pushClass(browser + parseInt(version, 10));
|
||||
|
||||
// IE lt9 specific
|
||||
if (conf.html5 && browser === "ie" && version < 9) {
|
||||
// HTML5 support : you still need to add html5 css initialization styles to your site
|
||||
// See: assets/html5.css
|
||||
each("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|progress|section|summary|time|video".split("|"), function(el) {
|
||||
doc.createElement(el);
|
||||
});
|
||||
}
|
||||
|
||||
// CSS "router"
|
||||
each(loc.pathname.split("/"), function(el, i) {
|
||||
if (this.length > 2 && this[i + 1] !== undefined) {
|
||||
if (i) {
|
||||
pushClass(this.slice(i, i + 1).join("-").toLowerCase() + conf.section);
|
||||
}
|
||||
} else {
|
||||
// pageId
|
||||
var id = el || "index", index = id.indexOf(".");
|
||||
if (index > 0) {
|
||||
id = id.substring(0, index);
|
||||
}
|
||||
|
||||
html.id = id.toLowerCase() + conf.page;
|
||||
|
||||
// on root?
|
||||
if (!i) {
|
||||
pushClass("root" + conf.section);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// basic screen info
|
||||
api.screen = {
|
||||
height: win.screen.height,
|
||||
width : win.screen.width
|
||||
};
|
||||
|
||||
// viewport resolutions: w-100, lt-480, lt-1024 ...
|
||||
function screenSize() {
|
||||
// remove earlier sizes
|
||||
html.className = html.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g, "");
|
||||
|
||||
// Viewport width
|
||||
var iw = win.innerWidth || html.clientWidth,
|
||||
ow = win.outerWidth || win.screen.width;
|
||||
|
||||
api.screen.innerWidth = iw;
|
||||
api.screen.outerWidth = ow;
|
||||
|
||||
// for debugging purposes, not really useful for anything else
|
||||
pushClass("w-" + iw);
|
||||
|
||||
each(conf.screens, function(width) {
|
||||
if (iw > width) {
|
||||
if (conf.screensCss.gt) {
|
||||
pushClass("gt-" + width);
|
||||
}
|
||||
|
||||
if (conf.screensCss.gte) {
|
||||
pushClass("gte-" + width);
|
||||
}
|
||||
} else if (iw < width) {
|
||||
if (conf.screensCss.lt) {
|
||||
pushClass("lt-" + width);
|
||||
}
|
||||
|
||||
if (conf.screensCss.lte) {
|
||||
pushClass("lte-" + width);
|
||||
}
|
||||
} else if (iw === width) {
|
||||
if (conf.screensCss.lte) {
|
||||
pushClass("lte-" + width);
|
||||
}
|
||||
|
||||
if (conf.screensCss.eq) {
|
||||
pushClass("e-q" + width);
|
||||
}
|
||||
|
||||
if (conf.screensCss.gte) {
|
||||
pushClass("gte-" + width);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Viewport height
|
||||
var ih = win.innerHeight || html.clientHeight,
|
||||
oh = win.outerHeight || win.screen.height;
|
||||
|
||||
api.screen.innerHeight = ih;
|
||||
api.screen.outerHeight = oh;
|
||||
|
||||
// no need for onChange event to detect this
|
||||
api.feature("portrait" , (ih > iw));
|
||||
api.feature("landscape", (ih < iw));
|
||||
}
|
||||
|
||||
screenSize();
|
||||
|
||||
// Throttle navigators from triggering too many resize events
|
||||
var resizeId = 0;
|
||||
|
||||
function onResize() {
|
||||
win.clearTimeout(resizeId);
|
||||
resizeId = win.setTimeout(screenSize, 50);
|
||||
}
|
||||
|
||||
// Manually attach, as to not overwrite existing handler
|
||||
if (win.addEventListener) {
|
||||
win.addEventListener("resize", onResize, false);
|
||||
|
||||
} else {
|
||||
// IE8 and less
|
||||
win.attachEvent("onresize", onResize);
|
||||
}
|
||||
}(window));
|
||||
///#source 1 1 /src/1.0.0/css3.js
|
||||
/*! head.css3 - v1.0.0 */
|
||||
/*
|
||||
* HeadJS The only script in your <HEAD>
|
||||
* Author Tero Piirainen (tipiirai)
|
||||
* Maintainer Robert Hoffmann (itechnology)
|
||||
* License MIT / http://bit.ly/mit-license
|
||||
* WebSite http://headjs.com
|
||||
*/
|
||||
(function (win, undefined) {
|
||||
"use strict";
|
||||
|
||||
var doc = win.document,
|
||||
/*
|
||||
To add a new test:
|
||||
|
||||
head.feature("video", function() {
|
||||
var tag = document.createElement('video');
|
||||
return !!tag.canPlayType;
|
||||
});
|
||||
|
||||
Good place to grab more tests
|
||||
|
||||
https://github.com/Modernizr/Modernizr/blob/master/modernizr.js
|
||||
*/
|
||||
|
||||
/* CSS modernizer */
|
||||
el = doc.createElement("i"),
|
||||
style = el.style,
|
||||
prefs = " -o- -moz- -ms- -webkit- -khtml- ".split(" "),
|
||||
domPrefs = "Webkit Moz O ms Khtml".split(" "),
|
||||
headVar = win.head_conf && win.head_conf.head || "head",
|
||||
api = win[headVar];
|
||||
|
||||
// Thanks Paul Irish!
|
||||
|
||||
function testProps(props) {
|
||||
for (var i in props) {
|
||||
if (style[props[i]] !== undefined) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function testAll(prop) {
|
||||
var camel = prop.charAt(0).toUpperCase() + prop.substr(1),
|
||||
props = (prop + " " + domPrefs.join(camel + " ") + camel).split(" ");
|
||||
|
||||
return !!testProps(props);
|
||||
}
|
||||
|
||||
var tests = {
|
||||
// should we seperate linear/radial ?
|
||||
// seems like some browsers need a test for prefix http://caniuse.com/#feat=css-gradients
|
||||
gradient: function () {
|
||||
var s1 = "background-image:",
|
||||
s2 = "gradient(linear,left top,right bottom,from(#9f9),to(#fff));",
|
||||
s3 = "linear-gradient(left top,#eee,#fff);";
|
||||
|
||||
style.cssText = (s1 + prefs.join(s2 + s1) + prefs.join(s3 + s1)).slice(0, -s1.length);
|
||||
return !!style.backgroundImage;
|
||||
},
|
||||
|
||||
rgba: function () {
|
||||
style.cssText = "background-color:rgba(0,0,0,0.5)";
|
||||
return !!style.backgroundColor;
|
||||
},
|
||||
|
||||
opacity: function () {
|
||||
return el.style.opacity === "";
|
||||
},
|
||||
|
||||
textshadow: function () {
|
||||
return style.textShadow === "";
|
||||
},
|
||||
|
||||
multiplebgs: function () {
|
||||
style.cssText = "background:url(https://),url(https://),red url(https://)";
|
||||
|
||||
// If the UA supports multiple backgrounds, there should be three occurrences
|
||||
// of the string "url(" in the return value for elemStyle.background
|
||||
var result = (style.background || "").match(/url/g);
|
||||
|
||||
return Object.prototype.toString.call(result) === "[object Array]" && result.length === 3;
|
||||
},
|
||||
|
||||
boxshadow: function () {
|
||||
return testAll("boxShadow");
|
||||
},
|
||||
|
||||
borderimage: function () {
|
||||
return testAll("borderImage");
|
||||
},
|
||||
|
||||
borderradius: function () {
|
||||
return testAll("borderRadius");
|
||||
},
|
||||
|
||||
cssreflections: function () {
|
||||
return testAll("boxReflect");
|
||||
},
|
||||
|
||||
csstransforms: function () {
|
||||
return testAll("transform");
|
||||
},
|
||||
|
||||
csstransitions: function () {
|
||||
return testAll("transition");
|
||||
},
|
||||
touch: function () {
|
||||
return "ontouchstart" in win;
|
||||
},
|
||||
retina: function () {
|
||||
return (win.devicePixelRatio > 1);
|
||||
},
|
||||
|
||||
/*
|
||||
font-face support. Uses browser sniffing but is synchronous.
|
||||
http://paulirish.com/2009/font-face-feature-detection/
|
||||
*/
|
||||
fontface: function () {
|
||||
var browser = api.browser.name, version = api.browser.version;
|
||||
|
||||
switch (browser) {
|
||||
case "ie":
|
||||
return version >= 9;
|
||||
|
||||
case "chrome":
|
||||
return version >= 13;
|
||||
|
||||
case "ff":
|
||||
return version >= 6;
|
||||
|
||||
case "ios":
|
||||
return version >= 5;
|
||||
|
||||
case "android":
|
||||
return false;
|
||||
|
||||
case "webkit":
|
||||
return version >= 5.1;
|
||||
|
||||
case "opera":
|
||||
return version >= 10;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// queue features
|
||||
for (var key in tests) {
|
||||
if (tests[key]) {
|
||||
api.feature(key, tests[key].call(), true);
|
||||
}
|
||||
}
|
||||
|
||||
// enable features at once
|
||||
api.feature();
|
||||
|
||||
}(window));
|
7
lib/js/extra/headjs/dist/1.0.0/head.css3.min.js
vendored
Normal file
7
lib/js/extra/headjs/dist/1.0.0/head.css3.min.js
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
/*! head.core - v1.0.2 */
|
||||
(function(n,t){"use strict";function r(n){a[a.length]=n}function k(n){var t=new RegExp(" ?\\b"+n+"\\b");c.className=c.className.replace(t,"")}function p(n,t){for(var i=0,r=n.length;i<r;i++)t.call(n,n[i],i)}function tt(){var t,e,f,o;c.className=c.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g,"");t=n.innerWidth||c.clientWidth;e=n.outerWidth||n.screen.width;u.screen.innerWidth=t;u.screen.outerWidth=e;r("w-"+t);p(i.screens,function(n){t>n?(i.screensCss.gt&&r("gt-"+n),i.screensCss.gte&&r("gte-"+n)):t<n?(i.screensCss.lt&&r("lt-"+n),i.screensCss.lte&&r("lte-"+n)):t===n&&(i.screensCss.lte&&r("lte-"+n),i.screensCss.eq&&r("e-q"+n),i.screensCss.gte&&r("gte-"+n))});f=n.innerHeight||c.clientHeight;o=n.outerHeight||n.screen.height;u.screen.innerHeight=f;u.screen.outerHeight=o;u.feature("portrait",f>t);u.feature("landscape",f<t)}function it(){n.clearTimeout(b);b=n.setTimeout(tt,50)}var y=n.document,rt=n.navigator,ut=n.location,c=y.documentElement,a=[],i={screens:[240,320,480,640,768,800,1024,1280,1440,1680,1920],screensCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!1},browsers:[{ie:{min:6,max:11}}],browserCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!0},html5:!0,page:"-page",section:"-section",head:"head"},v,u,s,w,o,h,l,d,f,g,nt,e,b;if(n.head_conf)for(v in n.head_conf)n.head_conf[v]!==t&&(i[v]=n.head_conf[v]);u=n[i.head]=function(){u.ready.apply(null,arguments)};u.feature=function(n,t,i){return n?(Object.prototype.toString.call(t)==="[object Function]"&&(t=t.call()),r((t?"":"no-")+n),u[n]=!!t,i||(k("no-"+n),k(n),u.feature()),u):(c.className+=" "+a.join(" "),a=[],u)};u.feature("js",!0);s=rt.userAgent.toLowerCase();w=/mobile|android|kindle|silk|midp|phone|(windows .+arm|touch)/.test(s);u.feature("mobile",w,!0);u.feature("desktop",!w,!0);s=/(chrome|firefox)[ \/]([\w.]+)/.exec(s)||/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(android)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(msie) ([\w.]+)/.exec(s)||/(trident).+rv:(\w.)+/.exec(s)||[];o=s[1];h=parseFloat(s[2]);switch(o){case"msie":case"trident":o="ie";h=y.documentMode||h;break;case"firefox":o="ff";break;case"ipod":case"ipad":case"iphone":o="ios";break;case"webkit":o="safari"}for(u.browser={name:o,version:h},u.browser[o]=!0,l=0,d=i.browsers.length;l<d;l++)for(f in i.browsers[l])if(o===f)for(r(f),g=i.browsers[l][f].min,nt=i.browsers[l][f].max,e=g;e<=nt;e++)h>e?(i.browserCss.gt&&r("gt-"+f+e),i.browserCss.gte&&r("gte-"+f+e)):h<e?(i.browserCss.lt&&r("lt-"+f+e),i.browserCss.lte&&r("lte-"+f+e)):h===e&&(i.browserCss.lte&&r("lte-"+f+e),i.browserCss.eq&&r("eq-"+f+e),i.browserCss.gte&&r("gte-"+f+e));else r("no-"+f);r(o);r(o+parseInt(h,10));i.html5&&o==="ie"&&h<9&&p("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|progress|section|summary|time|video".split("|"),function(n){y.createElement(n)});p(ut.pathname.split("/"),function(n,u){if(this.length>2&&this[u+1]!==t)u&&r(this.slice(u,u+1).join("-").toLowerCase()+i.section);else{var f=n||"index",e=f.indexOf(".");e>0&&(f=f.substring(0,e));c.id=f.toLowerCase()+i.page;u||r("root"+i.section)}});u.screen={height:n.screen.height,width:n.screen.width};tt();b=0;n.addEventListener?n.addEventListener("resize",it,!1):n.attachEvent("onresize",it)})(window);
|
||||
/*! head.css3 - v1.0.0 */
|
||||
(function(n,t){"use strict";function a(n){for(var r in n)if(i[n[r]]!==t)return!0;return!1}function r(n){var t=n.charAt(0).toUpperCase()+n.substr(1),i=(n+" "+c.join(t+" ")+t).split(" ");return!!a(i)}var h=n.document,o=h.createElement("i"),i=o.style,s=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),c="Webkit Moz O ms Khtml".split(" "),l=n.head_conf&&n.head_conf.head||"head",u=n[l],f={gradient:function(){var n="background-image:";return i.cssText=(n+s.join("gradient(linear,left top,right bottom,from(#9f9),to(#fff));"+n)+s.join("linear-gradient(left top,#eee,#fff);"+n)).slice(0,-n.length),!!i.backgroundImage},rgba:function(){return i.cssText="background-color:rgba(0,0,0,0.5)",!!i.backgroundColor},opacity:function(){return o.style.opacity===""},textshadow:function(){return i.textShadow===""},multiplebgs:function(){i.cssText="background:url(https://),url(https://),red url(https://)";var n=(i.background||"").match(/url/g);return Object.prototype.toString.call(n)==="[object Array]"&&n.length===3},boxshadow:function(){return r("boxShadow")},borderimage:function(){return r("borderImage")},borderradius:function(){return r("borderRadius")},cssreflections:function(){return r("boxReflect")},csstransforms:function(){return r("transform")},csstransitions:function(){return r("transition")},touch:function(){return"ontouchstart"in n},retina:function(){return n.devicePixelRatio>1},fontface:function(){var t=u.browser.name,n=u.browser.version;switch(t){case"ie":return n>=9;case"chrome":return n>=13;case"ff":return n>=6;case"ios":return n>=5;case"android":return!1;case"webkit":return n>=5.1;case"opera":return n>=10;default:return!1}}};for(var e in f)f[e]&&u.feature(e,f[e].call(),!0);u.feature()})(window);
|
||||
/*
|
||||
//# sourceMappingURL=head.css3.min.js.map
|
||||
*/
|
8
lib/js/extra/headjs/dist/1.0.0/head.css3.min.js.map
vendored
Normal file
8
lib/js/extra/headjs/dist/1.0.0/head.css3.min.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
1184
lib/js/extra/headjs/dist/1.0.0/head.js
vendored
Normal file
1184
lib/js/extra/headjs/dist/1.0.0/head.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
707
lib/js/extra/headjs/dist/1.0.0/head.load.js
vendored
Normal file
707
lib/js/extra/headjs/dist/1.0.0/head.load.js
vendored
Normal file
|
@ -0,0 +1,707 @@
|
|||
///#source 1 1 /src/1.0.0/load.js
|
||||
/*! head.load - v1.0.3 */
|
||||
/*
|
||||
* HeadJS The only script in your <HEAD>
|
||||
* Author Tero Piirainen (tipiirai)
|
||||
* Maintainer Robert Hoffmann (itechnology)
|
||||
* License MIT / http://bit.ly/mit-license
|
||||
* WebSite http://headjs.com
|
||||
*/
|
||||
(function (win, undefined) {
|
||||
"use strict";
|
||||
|
||||
//#region variables
|
||||
var doc = win.document,
|
||||
domWaiters = [],
|
||||
handlers = {}, // user functions waiting for events
|
||||
assets = {}, // loadable items in various states
|
||||
isAsync = "async" in doc.createElement("script") || "MozAppearance" in doc.documentElement.style || win.opera,
|
||||
isDomReady,
|
||||
|
||||
/*** public API ***/
|
||||
headVar = win.head_conf && win.head_conf.head || "head",
|
||||
api = win[headVar] = (win[headVar] || function () { api.ready.apply(null, arguments); }),
|
||||
|
||||
// states
|
||||
PRELOADING = 1,
|
||||
PRELOADED = 2,
|
||||
LOADING = 3,
|
||||
LOADED = 4;
|
||||
//#endregion
|
||||
|
||||
//#region PRIVATE functions
|
||||
|
||||
//#region Helper functions
|
||||
function noop() {
|
||||
// does nothing
|
||||
}
|
||||
|
||||
function each(arr, callback) {
|
||||
if (!arr) {
|
||||
return;
|
||||
}
|
||||
|
||||
// arguments special type
|
||||
if (typeof arr === "object") {
|
||||
arr = [].slice.call(arr);
|
||||
}
|
||||
|
||||
// do the job
|
||||
for (var i = 0, l = arr.length; i < l; i++) {
|
||||
callback.call(arr, arr[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
/* A must read: http://bonsaiden.github.com/JavaScript-Garden
|
||||
************************************************************/
|
||||
function is(type, obj) {
|
||||
var clas = Object.prototype.toString.call(obj).slice(8, -1);
|
||||
return obj !== undefined && obj !== null && clas === type;
|
||||
}
|
||||
|
||||
function isFunction(item) {
|
||||
return is("Function", item);
|
||||
}
|
||||
|
||||
function isArray(item) {
|
||||
return is("Array", item);
|
||||
}
|
||||
|
||||
function toLabel(url) {
|
||||
///<summary>Converts a url to a file label</summary>
|
||||
var items = url.split("/"),
|
||||
name = items[items.length - 1],
|
||||
i = name.indexOf("?");
|
||||
|
||||
return i !== -1 ? name.substring(0, i) : name;
|
||||
}
|
||||
|
||||
// INFO: this look like a "im triggering callbacks all over the place, but only wanna run it one time function" ..should try to make everything work without it if possible
|
||||
// INFO: Even better. Look into promises/defered's like jQuery is doing
|
||||
function one(callback) {
|
||||
///<summary>Execute a callback only once</summary>
|
||||
callback = callback || noop;
|
||||
|
||||
if (callback._done) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback();
|
||||
callback._done = 1;
|
||||
}
|
||||
//#endregion
|
||||
|
||||
function conditional(test, success, failure, callback) {
|
||||
///<summary>
|
||||
/// INFO: use cases:
|
||||
/// head.test(condition, null , "file.NOk" , callback);
|
||||
/// head.test(condition, "fileOk.js", null , callback);
|
||||
/// head.test(condition, "fileOk.js", "file.NOk" , callback);
|
||||
/// head.test(condition, "fileOk.js", ["file.NOk", "file.NOk"], callback);
|
||||
/// head.test({
|
||||
/// test : condition,
|
||||
/// success : [{ label1: "file1Ok.js" }, { label2: "file2Ok.js" }],
|
||||
/// failure : [{ label1: "file1NOk.js" }, { label2: "file2NOk.js" }],
|
||||
/// callback: callback
|
||||
/// );
|
||||
/// head.test({
|
||||
/// test : condition,
|
||||
/// success : ["file1Ok.js" , "file2Ok.js"],
|
||||
/// failure : ["file1NOk.js", "file2NOk.js"],
|
||||
/// callback: callback
|
||||
/// );
|
||||
///</summary>
|
||||
var obj = (typeof test === "object") ? test : {
|
||||
test: test,
|
||||
success: !!success ? isArray(success) ? success : [success] : false,
|
||||
failure: !!failure ? isArray(failure) ? failure : [failure] : false,
|
||||
callback: callback || noop
|
||||
};
|
||||
|
||||
// Test Passed ?
|
||||
var passed = !!obj.test;
|
||||
|
||||
// Do we have a success case
|
||||
if (passed && !!obj.success) {
|
||||
obj.success.push(obj.callback);
|
||||
api.load.apply(null, obj.success);
|
||||
}
|
||||
// Do we have a fail case
|
||||
else if (!passed && !!obj.failure) {
|
||||
obj.failure.push(obj.callback);
|
||||
api.load.apply(null, obj.failure);
|
||||
}
|
||||
else {
|
||||
callback();
|
||||
}
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
function getAsset(item) {
|
||||
///<summary>
|
||||
/// Assets are in the form of
|
||||
/// {
|
||||
/// name : label,
|
||||
/// url : url,
|
||||
/// state: state
|
||||
/// }
|
||||
///</summary>
|
||||
var asset = {};
|
||||
|
||||
if (typeof item === "object") {
|
||||
for (var label in item) {
|
||||
if (!!item[label]) {
|
||||
asset = {
|
||||
name: label,
|
||||
url : item[label]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
asset = {
|
||||
name: toLabel(item),
|
||||
url : item
|
||||
};
|
||||
}
|
||||
|
||||
// is the item already existant
|
||||
var existing = assets[asset.name];
|
||||
if (existing && existing.url === asset.url) {
|
||||
return existing;
|
||||
}
|
||||
|
||||
assets[asset.name] = asset;
|
||||
return asset;
|
||||
}
|
||||
|
||||
function allLoaded(items) {
|
||||
items = items || assets;
|
||||
|
||||
for (var name in items) {
|
||||
if (items.hasOwnProperty(name) && items[name].state !== LOADED) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function onPreload(asset) {
|
||||
asset.state = PRELOADED;
|
||||
|
||||
each(asset.onpreload, function (afterPreload) {
|
||||
afterPreload.call();
|
||||
});
|
||||
}
|
||||
|
||||
function preLoad(asset, callback) {
|
||||
if (asset.state === undefined) {
|
||||
|
||||
asset.state = PRELOADING;
|
||||
asset.onpreload = [];
|
||||
|
||||
loadAsset({ url: asset.url, type: "cache" }, function () {
|
||||
onPreload(asset);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function apiLoadHack() {
|
||||
/// <summary>preload with text/cache hack
|
||||
///
|
||||
/// head.load("http://domain.com/file.js","http://domain.com/file.js", callBack)
|
||||
/// head.load(["http://domain.com/file.js","http://domain.com/file.js"], callBack)
|
||||
/// head.load({ label1: "http://domain.com/file.js" }, { label2: "http://domain.com/file.js" }, callBack)
|
||||
/// head.load([{ label1: "http://domain.com/file.js" }, { label2: "http://domain.com/file.js" }], callBack)
|
||||
/// </summary>
|
||||
var args = arguments,
|
||||
callback = args[args.length - 1],
|
||||
rest = [].slice.call(args, 1),
|
||||
next = rest[0];
|
||||
|
||||
if (!isFunction(callback)) {
|
||||
callback = null;
|
||||
}
|
||||
|
||||
// if array, repush as args
|
||||
if (isArray(args[0])) {
|
||||
args[0].push(callback);
|
||||
api.load.apply(null, args[0]);
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
// multiple arguments
|
||||
if (!!next) {
|
||||
/* Preload with text/cache hack (not good!)
|
||||
* http://blog.getify.com/on-script-loaders/
|
||||
* http://www.nczonline.net/blog/2010/12/21/thoughts-on-script-loaders/
|
||||
* If caching is not configured correctly on the server, then items could load twice !
|
||||
*************************************************************************************/
|
||||
each(rest, function (item) {
|
||||
// item is not a callback or empty string
|
||||
if (!isFunction(item) && !!item) {
|
||||
preLoad(getAsset(item));
|
||||
}
|
||||
});
|
||||
|
||||
// execute
|
||||
load(getAsset(args[0]), isFunction(next) ? next : function () {
|
||||
api.load.apply(null, rest);
|
||||
});
|
||||
}
|
||||
else {
|
||||
// single item
|
||||
load(getAsset(args[0]));
|
||||
}
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
function apiLoadAsync() {
|
||||
///<summary>
|
||||
/// simply load and let browser take care of ordering
|
||||
///
|
||||
/// head.load("http://domain.com/file.js","http://domain.com/file.js", callBack)
|
||||
/// head.load(["http://domain.com/file.js","http://domain.com/file.js"], callBack)
|
||||
/// head.load({ label1: "http://domain.com/file.js" }, { label2: "http://domain.com/file.js" }, callBack)
|
||||
/// head.load([{ label1: "http://domain.com/file.js" }, { label2: "http://domain.com/file.js" }], callBack)
|
||||
///</summary>
|
||||
var args = arguments,
|
||||
callback = args[args.length - 1],
|
||||
items = {};
|
||||
|
||||
if (!isFunction(callback)) {
|
||||
callback = null;
|
||||
}
|
||||
|
||||
// if array, repush as args
|
||||
if (isArray(args[0])) {
|
||||
args[0].push(callback);
|
||||
api.load.apply(null, args[0]);
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
// JRH 262#issuecomment-26288601
|
||||
// First populate the items array.
|
||||
// When allLoaded is called, all items will be populated.
|
||||
// Issue when lazy loaded, the callback can execute early.
|
||||
each(args, function (item, i) {
|
||||
if (item !== callback) {
|
||||
item = getAsset(item);
|
||||
items[item.name] = item;
|
||||
}
|
||||
});
|
||||
|
||||
each(args, function (item, i) {
|
||||
if (item !== callback) {
|
||||
item = getAsset(item);
|
||||
|
||||
load(item, function () {
|
||||
if (allLoaded(items)) {
|
||||
one(callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
function load(asset, callback) {
|
||||
///<summary>Used with normal loading logic</summary>
|
||||
callback = callback || noop;
|
||||
|
||||
if (asset.state === LOADED) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
// INFO: why would we trigger a ready event when its not really loaded yet ?
|
||||
if (asset.state === LOADING) {
|
||||
api.ready(asset.name, callback);
|
||||
return;
|
||||
}
|
||||
|
||||
if (asset.state === PRELOADING) {
|
||||
asset.onpreload.push(function () {
|
||||
load(asset, callback);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
asset.state = LOADING;
|
||||
|
||||
loadAsset(asset, function () {
|
||||
asset.state = LOADED;
|
||||
|
||||
callback();
|
||||
|
||||
// handlers for this asset
|
||||
each(handlers[asset.name], function (fn) {
|
||||
one(fn);
|
||||
});
|
||||
|
||||
// dom is ready & no assets are queued for loading
|
||||
// INFO: shouldn't we be doing the same test above ?
|
||||
if (isDomReady && allLoaded()) {
|
||||
each(handlers.ALL, function (fn) {
|
||||
one(fn);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getExtension(url) {
|
||||
url = url || "";
|
||||
|
||||
var items = url.split("?")[0].split(".");
|
||||
return items[items.length-1].toLowerCase();
|
||||
}
|
||||
|
||||
/* Parts inspired from: https://github.com/cujojs/curl
|
||||
******************************************************/
|
||||
function loadAsset(asset, callback) {
|
||||
callback = callback || noop;
|
||||
|
||||
function error(event) {
|
||||
event = event || win.event;
|
||||
|
||||
// release event listeners
|
||||
ele.onload = ele.onreadystatechange = ele.onerror = null;
|
||||
|
||||
// do callback
|
||||
callback();
|
||||
|
||||
// need some more detailed error handling here
|
||||
}
|
||||
|
||||
function process(event) {
|
||||
event = event || win.event;
|
||||
|
||||
// IE 7/8 (2 events on 1st load)
|
||||
// 1) event.type = readystatechange, s.readyState = loading
|
||||
// 2) event.type = readystatechange, s.readyState = loaded
|
||||
|
||||
// IE 7/8 (1 event on reload)
|
||||
// 1) event.type = readystatechange, s.readyState = complete
|
||||
|
||||
// event.type === 'readystatechange' && /loaded|complete/.test(s.readyState)
|
||||
|
||||
// IE 9 (3 events on 1st load)
|
||||
// 1) event.type = readystatechange, s.readyState = loading
|
||||
// 2) event.type = readystatechange, s.readyState = loaded
|
||||
// 3) event.type = load , s.readyState = loaded
|
||||
|
||||
// IE 9 (2 events on reload)
|
||||
// 1) event.type = readystatechange, s.readyState = complete
|
||||
// 2) event.type = load , s.readyState = complete
|
||||
|
||||
// event.type === 'load' && /loaded|complete/.test(s.readyState)
|
||||
// event.type === 'readystatechange' && /loaded|complete/.test(s.readyState)
|
||||
|
||||
// IE 10 (3 events on 1st load)
|
||||
// 1) event.type = readystatechange, s.readyState = loading
|
||||
// 2) event.type = load , s.readyState = complete
|
||||
// 3) event.type = readystatechange, s.readyState = loaded
|
||||
|
||||
// IE 10 (3 events on reload)
|
||||
// 1) event.type = readystatechange, s.readyState = loaded
|
||||
// 2) event.type = load , s.readyState = complete
|
||||
// 3) event.type = readystatechange, s.readyState = complete
|
||||
|
||||
// event.type === 'load' && /loaded|complete/.test(s.readyState)
|
||||
// event.type === 'readystatechange' && /complete/.test(s.readyState)
|
||||
|
||||
// Other Browsers (1 event on 1st load)
|
||||
// 1) event.type = load, s.readyState = undefined
|
||||
|
||||
// Other Browsers (1 event on reload)
|
||||
// 1) event.type = load, s.readyState = undefined
|
||||
|
||||
// event.type == 'load' && s.readyState = undefined
|
||||
|
||||
// !doc.documentMode is for IE6/7, IE8+ have documentMode
|
||||
if (event.type === "load" || (/loaded|complete/.test(ele.readyState) && (!doc.documentMode || doc.documentMode < 9))) {
|
||||
// remove timeouts
|
||||
win.clearTimeout(asset.errorTimeout);
|
||||
win.clearTimeout(asset.cssTimeout);
|
||||
|
||||
// release event listeners
|
||||
ele.onload = ele.onreadystatechange = ele.onerror = null;
|
||||
|
||||
// do callback
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
function isCssLoaded() {
|
||||
// should we test again ? 20 retries = 5secs ..after that, the callback will be triggered by the error handler at 7secs
|
||||
if (asset.state !== LOADED && asset.cssRetries <= 20) {
|
||||
|
||||
// loop through stylesheets
|
||||
for (var i = 0, l = doc.styleSheets.length; i < l; i++) {
|
||||
// do we have a match ?
|
||||
// we need to tests agains ele.href and not asset.url, because a local file will be assigned the full http path on a link element
|
||||
if (doc.styleSheets[i].href === ele.href) {
|
||||
process({ "type": "load" });
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// increment & try again
|
||||
asset.cssRetries++;
|
||||
asset.cssTimeout = win.setTimeout(isCssLoaded, 250);
|
||||
}
|
||||
}
|
||||
|
||||
var ele;
|
||||
var ext = getExtension(asset.url);
|
||||
|
||||
if (ext === "css") {
|
||||
ele = doc.createElement("link");
|
||||
ele.type = "text/" + (asset.type || "css");
|
||||
ele.rel = "stylesheet";
|
||||
ele.href = asset.url;
|
||||
|
||||
/* onload supported for CSS on unsupported browsers
|
||||
* Safari windows 5.1.7, FF < 10
|
||||
*/
|
||||
|
||||
// Set counter to zero
|
||||
asset.cssRetries = 0;
|
||||
asset.cssTimeout = win.setTimeout(isCssLoaded, 500);
|
||||
}
|
||||
else {
|
||||
ele = doc.createElement("script");
|
||||
ele.type = "text/" + (asset.type || "javascript");
|
||||
ele.src = asset.url;
|
||||
}
|
||||
|
||||
ele.onload = ele.onreadystatechange = process;
|
||||
ele.onerror = error;
|
||||
|
||||
/* Good read, but doesn't give much hope !
|
||||
* http://blog.getify.com/on-script-loaders/
|
||||
* http://www.nczonline.net/blog/2010/12/21/thoughts-on-script-loaders/
|
||||
* https://hacks.mozilla.org/2009/06/defer/
|
||||
*/
|
||||
|
||||
// ASYNC: load in parallel and execute as soon as possible
|
||||
ele.async = false;
|
||||
// DEFER: load in parallel but maintain execution order
|
||||
ele.defer = false;
|
||||
|
||||
// timout for asset loading
|
||||
asset.errorTimeout = win.setTimeout(function () {
|
||||
error({ type: "timeout" });
|
||||
}, 7e3);
|
||||
|
||||
// use insertBefore to keep IE from throwing Operation Aborted (thx Bryan Forbes!)
|
||||
var head = doc.head || doc.getElementsByTagName("head")[0];
|
||||
|
||||
// but insert at end of head, because otherwise if it is a stylesheet, it will not override values
|
||||
head.insertBefore(ele, head.lastChild);
|
||||
}
|
||||
|
||||
/* Parts inspired from: https://github.com/jrburke/requirejs
|
||||
************************************************************/
|
||||
function init() {
|
||||
var items = doc.getElementsByTagName("script");
|
||||
|
||||
// look for a script with a data-head-init attribute
|
||||
for (var i = 0, l = items.length; i < l; i++) {
|
||||
var dataMain = items[i].getAttribute("data-headjs-load");
|
||||
if (!!dataMain) {
|
||||
api.load(dataMain);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ready(key, callback) {
|
||||
///<summary>
|
||||
/// INFO: use cases:
|
||||
/// head.ready(callBack);
|
||||
/// head.ready(document , callBack);
|
||||
/// head.ready("file.js", callBack);
|
||||
/// head.ready("label" , callBack);
|
||||
/// head.ready(["label1", "label2"], callback);
|
||||
///</summary>
|
||||
|
||||
// DOM ready check: head.ready(document, function() { });
|
||||
if (key === doc) {
|
||||
if (isDomReady) {
|
||||
one(callback);
|
||||
}
|
||||
else {
|
||||
domWaiters.push(callback);
|
||||
}
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
// shift arguments
|
||||
if (isFunction(key)) {
|
||||
callback = key;
|
||||
key = "ALL"; // holds all callbacks that where added without labels: ready(callBack)
|
||||
}
|
||||
|
||||
// queue all items from key and return. The callback will be executed if all items from key are already loaded.
|
||||
if (isArray(key)) {
|
||||
var items = {};
|
||||
|
||||
each(key, function (item) {
|
||||
items[item] = assets[item];
|
||||
|
||||
api.ready(item, function() {
|
||||
if (allLoaded(items)) {
|
||||
one(callback);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
// make sure arguments are sane
|
||||
if (typeof key !== "string" || !isFunction(callback)) {
|
||||
return api;
|
||||
}
|
||||
|
||||
// this can also be called when we trigger events based on filenames & labels
|
||||
var asset = assets[key];
|
||||
|
||||
// item already loaded --> execute and return
|
||||
if (asset && asset.state === LOADED || key === "ALL" && allLoaded() && isDomReady) {
|
||||
one(callback);
|
||||
return api;
|
||||
}
|
||||
|
||||
var arr = handlers[key];
|
||||
if (!arr) {
|
||||
arr = handlers[key] = [callback];
|
||||
}
|
||||
else {
|
||||
arr.push(callback);
|
||||
}
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
/* Mix of stuff from jQuery & IEContentLoaded
|
||||
* http://dev.w3.org/html5/spec/the-end.html#the-end
|
||||
***************************************************/
|
||||
function domReady() {
|
||||
// Make sure body exists, at least, in case IE gets a little overzealous (jQuery ticket #5443).
|
||||
if (!doc.body) {
|
||||
// let's not get nasty by setting a timeout too small.. (loop mania guaranteed if assets are queued)
|
||||
win.clearTimeout(api.readyTimeout);
|
||||
api.readyTimeout = win.setTimeout(domReady, 50);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isDomReady) {
|
||||
isDomReady = true;
|
||||
|
||||
init();
|
||||
each(domWaiters, function (fn) {
|
||||
one(fn);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function domContentLoaded() {
|
||||
// W3C
|
||||
if (doc.addEventListener) {
|
||||
doc.removeEventListener("DOMContentLoaded", domContentLoaded, false);
|
||||
domReady();
|
||||
}
|
||||
|
||||
// IE
|
||||
else if (doc.readyState === "complete") {
|
||||
// we're here because readyState === "complete" in oldIE
|
||||
// which is good enough for us to call the dom ready!
|
||||
doc.detachEvent("onreadystatechange", domContentLoaded);
|
||||
domReady();
|
||||
}
|
||||
}
|
||||
|
||||
// Catch cases where ready() is called after the browser event has already occurred.
|
||||
// we once tried to use readyState "interactive" here, but it caused issues like the one
|
||||
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
|
||||
if (doc.readyState === "complete") {
|
||||
domReady();
|
||||
}
|
||||
|
||||
// W3C
|
||||
else if (doc.addEventListener) {
|
||||
doc.addEventListener("DOMContentLoaded", domContentLoaded, false);
|
||||
|
||||
// A fallback to window.onload, that will always work
|
||||
win.addEventListener("load", domReady, false);
|
||||
}
|
||||
|
||||
// IE
|
||||
else {
|
||||
// Ensure firing before onload, maybe late but safe also for iframes
|
||||
doc.attachEvent("onreadystatechange", domContentLoaded);
|
||||
|
||||
// A fallback to window.onload, that will always work
|
||||
win.attachEvent("onload", domReady);
|
||||
|
||||
// If IE and not a frame
|
||||
// continually check to see if the document is ready
|
||||
var top = false;
|
||||
|
||||
try {
|
||||
top = !win.frameElement && doc.documentElement;
|
||||
} catch (e) { }
|
||||
|
||||
if (top && top.doScroll) {
|
||||
(function doScrollCheck() {
|
||||
if (!isDomReady) {
|
||||
try {
|
||||
// Use the trick by Diego Perini
|
||||
// http://javascript.nwbox.com/IEContentLoaded/
|
||||
top.doScroll("left");
|
||||
} catch (error) {
|
||||
// let's not get nasty by setting a timeout too small.. (loop mania guaranteed if assets are queued)
|
||||
win.clearTimeout(api.readyTimeout);
|
||||
api.readyTimeout = win.setTimeout(doScrollCheck, 50);
|
||||
return;
|
||||
}
|
||||
|
||||
// and execute any waiting functions
|
||||
domReady();
|
||||
}
|
||||
}());
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region Public Exports
|
||||
// INFO: determine which method to use for loading
|
||||
api.load = api.js = isAsync ? apiLoadAsync : apiLoadHack;
|
||||
api.test = conditional;
|
||||
api.ready = ready;
|
||||
//#endregion
|
||||
|
||||
//#region INIT
|
||||
// perform this when DOM is ready
|
||||
api.ready(doc, function () {
|
||||
if (allLoaded()) {
|
||||
each(handlers.ALL, function (callback) {
|
||||
one(callback);
|
||||
});
|
||||
}
|
||||
|
||||
if (api.feature) {
|
||||
api.feature("domloaded", true);
|
||||
}
|
||||
});
|
||||
//#endregion
|
||||
}(window));
|
5
lib/js/extra/headjs/dist/1.0.0/head.load.min.js
vendored
Normal file
5
lib/js/extra/headjs/dist/1.0.0/head.load.min.js
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
/*! head.load - v1.0.3 */
|
||||
(function(n,t){"use strict";function w(){}function u(n,t){if(n){typeof n=="object"&&(n=[].slice.call(n));for(var i=0,r=n.length;i<r;i++)t.call(n,n[i],i)}}function it(n,i){var r=Object.prototype.toString.call(i).slice(8,-1);return i!==t&&i!==null&&r===n}function s(n){return it("Function",n)}function a(n){return it("Array",n)}function et(n){var i=n.split("/"),t=i[i.length-1],r=t.indexOf("?");return r!==-1?t.substring(0,r):t}function f(n){(n=n||w,n._done)||(n(),n._done=1)}function ot(n,t,r,u){var f=typeof n=="object"?n:{test:n,success:!t?!1:a(t)?t:[t],failure:!r?!1:a(r)?r:[r],callback:u||w},e=!!f.test;return e&&!!f.success?(f.success.push(f.callback),i.load.apply(null,f.success)):e||!f.failure?u():(f.failure.push(f.callback),i.load.apply(null,f.failure)),i}function v(n){var t={},i,r;if(typeof n=="object")for(i in n)!n[i]||(t={name:i,url:n[i]});else t={name:et(n),url:n};return(r=c[t.name],r&&r.url===t.url)?r:(c[t.name]=t,t)}function y(n){n=n||c;for(var t in n)if(n.hasOwnProperty(t)&&n[t].state!==l)return!1;return!0}function st(n){n.state=ft;u(n.onpreload,function(n){n.call()})}function ht(n){n.state===t&&(n.state=nt,n.onpreload=[],rt({url:n.url,type:"cache"},function(){st(n)}))}function ct(){var n=arguments,t=n[n.length-1],r=[].slice.call(n,1),f=r[0];return(s(t)||(t=null),a(n[0]))?(n[0].push(t),i.load.apply(null,n[0]),i):(f?(u(r,function(n){s(n)||!n||ht(v(n))}),b(v(n[0]),s(f)?f:function(){i.load.apply(null,r)})):b(v(n[0])),i)}function lt(){var n=arguments,t=n[n.length-1],r={};return(s(t)||(t=null),a(n[0]))?(n[0].push(t),i.load.apply(null,n[0]),i):(u(n,function(n){n!==t&&(n=v(n),r[n.name]=n)}),u(n,function(n){n!==t&&(n=v(n),b(n,function(){y(r)&&f(t)}))}),i)}function b(n,t){if(t=t||w,n.state===l){t();return}if(n.state===tt){i.ready(n.name,t);return}if(n.state===nt){n.onpreload.push(function(){b(n,t)});return}n.state=tt;rt(n,function(){n.state=l;t();u(h[n.name],function(n){f(n)});o&&y()&&u(h.ALL,function(n){f(n)})})}function at(n){n=n||"";var t=n.split("?")[0].split(".");return t[t.length-1].toLowerCase()}function rt(t,i){function e(t){t=t||n.event;u.onload=u.onreadystatechange=u.onerror=null;i()}function o(f){f=f||n.event;(f.type==="load"||/loaded|complete/.test(u.readyState)&&(!r.documentMode||r.documentMode<9))&&(n.clearTimeout(t.errorTimeout),n.clearTimeout(t.cssTimeout),u.onload=u.onreadystatechange=u.onerror=null,i())}function s(){if(t.state!==l&&t.cssRetries<=20){for(var i=0,f=r.styleSheets.length;i<f;i++)if(r.styleSheets[i].href===u.href){o({type:"load"});return}t.cssRetries++;t.cssTimeout=n.setTimeout(s,250)}}var u,h,f;i=i||w;h=at(t.url);h==="css"?(u=r.createElement("link"),u.type="text/"+(t.type||"css"),u.rel="stylesheet",u.href=t.url,t.cssRetries=0,t.cssTimeout=n.setTimeout(s,500)):(u=r.createElement("script"),u.type="text/"+(t.type||"javascript"),u.src=t.url);u.onload=u.onreadystatechange=o;u.onerror=e;u.async=!1;u.defer=!1;t.errorTimeout=n.setTimeout(function(){e({type:"timeout"})},7e3);f=r.head||r.getElementsByTagName("head")[0];f.insertBefore(u,f.lastChild)}function vt(){for(var t,u=r.getElementsByTagName("script"),n=0,f=u.length;n<f;n++)if(t=u[n].getAttribute("data-headjs-load"),!!t){i.load(t);return}}function yt(n,t){var v,p,e;return n===r?(o?f(t):d.push(t),i):(s(n)&&(t=n,n="ALL"),a(n))?(v={},u(n,function(n){v[n]=c[n];i.ready(n,function(){y(v)&&f(t)})}),i):typeof n!="string"||!s(t)?i:(p=c[n],p&&p.state===l||n==="ALL"&&y()&&o)?(f(t),i):(e=h[n],e?e.push(t):e=h[n]=[t],i)}function e(){if(!r.body){n.clearTimeout(i.readyTimeout);i.readyTimeout=n.setTimeout(e,50);return}o||(o=!0,vt(),u(d,function(n){f(n)}))}function k(){r.addEventListener?(r.removeEventListener("DOMContentLoaded",k,!1),e()):r.readyState==="complete"&&(r.detachEvent("onreadystatechange",k),e())}var r=n.document,d=[],h={},c={},ut="async"in r.createElement("script")||"MozAppearance"in r.documentElement.style||n.opera,o,g=n.head_conf&&n.head_conf.head||"head",i=n[g]=n[g]||function(){i.ready.apply(null,arguments)},nt=1,ft=2,tt=3,l=4,p;if(r.readyState==="complete")e();else if(r.addEventListener)r.addEventListener("DOMContentLoaded",k,!1),n.addEventListener("load",e,!1);else{r.attachEvent("onreadystatechange",k);n.attachEvent("onload",e);p=!1;try{p=!n.frameElement&&r.documentElement}catch(wt){}p&&p.doScroll&&function pt(){if(!o){try{p.doScroll("left")}catch(t){n.clearTimeout(i.readyTimeout);i.readyTimeout=n.setTimeout(pt,50);return}e()}}()}i.load=i.js=ut?lt:ct;i.test=ot;i.ready=yt;i.ready(r,function(){y()&&u(h.ALL,function(n){f(n)});i.feature&&i.feature("domloaded",!0)})})(window);
|
||||
/*
|
||||
//# sourceMappingURL=head.load.min.js.map
|
||||
*/
|
8
lib/js/extra/headjs/dist/1.0.0/head.load.min.js.map
vendored
Normal file
8
lib/js/extra/headjs/dist/1.0.0/head.load.min.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
9
lib/js/extra/headjs/dist/1.0.0/head.min.js
vendored
Normal file
9
lib/js/extra/headjs/dist/1.0.0/head.min.js
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
/*! head.core - v1.0.2 */
|
||||
(function(n,t){"use strict";function r(n){a[a.length]=n}function k(n){var t=new RegExp(" ?\\b"+n+"\\b");c.className=c.className.replace(t,"")}function p(n,t){for(var i=0,r=n.length;i<r;i++)t.call(n,n[i],i)}function tt(){var t,e,f,o;c.className=c.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g,"");t=n.innerWidth||c.clientWidth;e=n.outerWidth||n.screen.width;u.screen.innerWidth=t;u.screen.outerWidth=e;r("w-"+t);p(i.screens,function(n){t>n?(i.screensCss.gt&&r("gt-"+n),i.screensCss.gte&&r("gte-"+n)):t<n?(i.screensCss.lt&&r("lt-"+n),i.screensCss.lte&&r("lte-"+n)):t===n&&(i.screensCss.lte&&r("lte-"+n),i.screensCss.eq&&r("e-q"+n),i.screensCss.gte&&r("gte-"+n))});f=n.innerHeight||c.clientHeight;o=n.outerHeight||n.screen.height;u.screen.innerHeight=f;u.screen.outerHeight=o;u.feature("portrait",f>t);u.feature("landscape",f<t)}function it(){n.clearTimeout(b);b=n.setTimeout(tt,50)}var y=n.document,rt=n.navigator,ut=n.location,c=y.documentElement,a=[],i={screens:[240,320,480,640,768,800,1024,1280,1440,1680,1920],screensCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!1},browsers:[{ie:{min:6,max:11}}],browserCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!0},html5:!0,page:"-page",section:"-section",head:"head"},v,u,s,w,o,h,l,d,f,g,nt,e,b;if(n.head_conf)for(v in n.head_conf)n.head_conf[v]!==t&&(i[v]=n.head_conf[v]);u=n[i.head]=function(){u.ready.apply(null,arguments)};u.feature=function(n,t,i){return n?(Object.prototype.toString.call(t)==="[object Function]"&&(t=t.call()),r((t?"":"no-")+n),u[n]=!!t,i||(k("no-"+n),k(n),u.feature()),u):(c.className+=" "+a.join(" "),a=[],u)};u.feature("js",!0);s=rt.userAgent.toLowerCase();w=/mobile|android|kindle|silk|midp|phone|(windows .+arm|touch)/.test(s);u.feature("mobile",w,!0);u.feature("desktop",!w,!0);s=/(chrome|firefox)[ \/]([\w.]+)/.exec(s)||/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(android)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(msie) ([\w.]+)/.exec(s)||/(trident).+rv:(\w.)+/.exec(s)||[];o=s[1];h=parseFloat(s[2]);switch(o){case"msie":case"trident":o="ie";h=y.documentMode||h;break;case"firefox":o="ff";break;case"ipod":case"ipad":case"iphone":o="ios";break;case"webkit":o="safari"}for(u.browser={name:o,version:h},u.browser[o]=!0,l=0,d=i.browsers.length;l<d;l++)for(f in i.browsers[l])if(o===f)for(r(f),g=i.browsers[l][f].min,nt=i.browsers[l][f].max,e=g;e<=nt;e++)h>e?(i.browserCss.gt&&r("gt-"+f+e),i.browserCss.gte&&r("gte-"+f+e)):h<e?(i.browserCss.lt&&r("lt-"+f+e),i.browserCss.lte&&r("lte-"+f+e)):h===e&&(i.browserCss.lte&&r("lte-"+f+e),i.browserCss.eq&&r("eq-"+f+e),i.browserCss.gte&&r("gte-"+f+e));else r("no-"+f);r(o);r(o+parseInt(h,10));i.html5&&o==="ie"&&h<9&&p("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|progress|section|summary|time|video".split("|"),function(n){y.createElement(n)});p(ut.pathname.split("/"),function(n,u){if(this.length>2&&this[u+1]!==t)u&&r(this.slice(u,u+1).join("-").toLowerCase()+i.section);else{var f=n||"index",e=f.indexOf(".");e>0&&(f=f.substring(0,e));c.id=f.toLowerCase()+i.page;u||r("root"+i.section)}});u.screen={height:n.screen.height,width:n.screen.width};tt();b=0;n.addEventListener?n.addEventListener("resize",it,!1):n.attachEvent("onresize",it)})(window);
|
||||
/*! head.css3 - v1.0.0 */
|
||||
(function(n,t){"use strict";function a(n){for(var r in n)if(i[n[r]]!==t)return!0;return!1}function r(n){var t=n.charAt(0).toUpperCase()+n.substr(1),i=(n+" "+c.join(t+" ")+t).split(" ");return!!a(i)}var h=n.document,o=h.createElement("i"),i=o.style,s=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),c="Webkit Moz O ms Khtml".split(" "),l=n.head_conf&&n.head_conf.head||"head",u=n[l],f={gradient:function(){var n="background-image:";return i.cssText=(n+s.join("gradient(linear,left top,right bottom,from(#9f9),to(#fff));"+n)+s.join("linear-gradient(left top,#eee,#fff);"+n)).slice(0,-n.length),!!i.backgroundImage},rgba:function(){return i.cssText="background-color:rgba(0,0,0,0.5)",!!i.backgroundColor},opacity:function(){return o.style.opacity===""},textshadow:function(){return i.textShadow===""},multiplebgs:function(){i.cssText="background:url(https://),url(https://),red url(https://)";var n=(i.background||"").match(/url/g);return Object.prototype.toString.call(n)==="[object Array]"&&n.length===3},boxshadow:function(){return r("boxShadow")},borderimage:function(){return r("borderImage")},borderradius:function(){return r("borderRadius")},cssreflections:function(){return r("boxReflect")},csstransforms:function(){return r("transform")},csstransitions:function(){return r("transition")},touch:function(){return"ontouchstart"in n},retina:function(){return n.devicePixelRatio>1},fontface:function(){var t=u.browser.name,n=u.browser.version;switch(t){case"ie":return n>=9;case"chrome":return n>=13;case"ff":return n>=6;case"ios":return n>=5;case"android":return!1;case"webkit":return n>=5.1;case"opera":return n>=10;default:return!1}}};for(var e in f)f[e]&&u.feature(e,f[e].call(),!0);u.feature()})(window);
|
||||
/*! head.load - v1.0.3 */
|
||||
(function(n,t){"use strict";function w(){}function u(n,t){if(n){typeof n=="object"&&(n=[].slice.call(n));for(var i=0,r=n.length;i<r;i++)t.call(n,n[i],i)}}function it(n,i){var r=Object.prototype.toString.call(i).slice(8,-1);return i!==t&&i!==null&&r===n}function s(n){return it("Function",n)}function a(n){return it("Array",n)}function et(n){var i=n.split("/"),t=i[i.length-1],r=t.indexOf("?");return r!==-1?t.substring(0,r):t}function f(n){(n=n||w,n._done)||(n(),n._done=1)}function ot(n,t,r,u){var f=typeof n=="object"?n:{test:n,success:!t?!1:a(t)?t:[t],failure:!r?!1:a(r)?r:[r],callback:u||w},e=!!f.test;return e&&!!f.success?(f.success.push(f.callback),i.load.apply(null,f.success)):e||!f.failure?u():(f.failure.push(f.callback),i.load.apply(null,f.failure)),i}function v(n){var t={},i,r;if(typeof n=="object")for(i in n)!n[i]||(t={name:i,url:n[i]});else t={name:et(n),url:n};return(r=c[t.name],r&&r.url===t.url)?r:(c[t.name]=t,t)}function y(n){n=n||c;for(var t in n)if(n.hasOwnProperty(t)&&n[t].state!==l)return!1;return!0}function st(n){n.state=ft;u(n.onpreload,function(n){n.call()})}function ht(n){n.state===t&&(n.state=nt,n.onpreload=[],rt({url:n.url,type:"cache"},function(){st(n)}))}function ct(){var n=arguments,t=n[n.length-1],r=[].slice.call(n,1),f=r[0];return(s(t)||(t=null),a(n[0]))?(n[0].push(t),i.load.apply(null,n[0]),i):(f?(u(r,function(n){s(n)||!n||ht(v(n))}),b(v(n[0]),s(f)?f:function(){i.load.apply(null,r)})):b(v(n[0])),i)}function lt(){var n=arguments,t=n[n.length-1],r={};return(s(t)||(t=null),a(n[0]))?(n[0].push(t),i.load.apply(null,n[0]),i):(u(n,function(n){n!==t&&(n=v(n),r[n.name]=n)}),u(n,function(n){n!==t&&(n=v(n),b(n,function(){y(r)&&f(t)}))}),i)}function b(n,t){if(t=t||w,n.state===l){t();return}if(n.state===tt){i.ready(n.name,t);return}if(n.state===nt){n.onpreload.push(function(){b(n,t)});return}n.state=tt;rt(n,function(){n.state=l;t();u(h[n.name],function(n){f(n)});o&&y()&&u(h.ALL,function(n){f(n)})})}function at(n){n=n||"";var t=n.split("?")[0].split(".");return t[t.length-1].toLowerCase()}function rt(t,i){function e(t){t=t||n.event;u.onload=u.onreadystatechange=u.onerror=null;i()}function o(f){f=f||n.event;(f.type==="load"||/loaded|complete/.test(u.readyState)&&(!r.documentMode||r.documentMode<9))&&(n.clearTimeout(t.errorTimeout),n.clearTimeout(t.cssTimeout),u.onload=u.onreadystatechange=u.onerror=null,i())}function s(){if(t.state!==l&&t.cssRetries<=20){for(var i=0,f=r.styleSheets.length;i<f;i++)if(r.styleSheets[i].href===u.href){o({type:"load"});return}t.cssRetries++;t.cssTimeout=n.setTimeout(s,250)}}var u,h,f;i=i||w;h=at(t.url);h==="css"?(u=r.createElement("link"),u.type="text/"+(t.type||"css"),u.rel="stylesheet",u.href=t.url,t.cssRetries=0,t.cssTimeout=n.setTimeout(s,500)):(u=r.createElement("script"),u.type="text/"+(t.type||"javascript"),u.src=t.url);u.onload=u.onreadystatechange=o;u.onerror=e;u.async=!1;u.defer=!1;t.errorTimeout=n.setTimeout(function(){e({type:"timeout"})},7e3);f=r.head||r.getElementsByTagName("head")[0];f.insertBefore(u,f.lastChild)}function vt(){for(var t,u=r.getElementsByTagName("script"),n=0,f=u.length;n<f;n++)if(t=u[n].getAttribute("data-headjs-load"),!!t){i.load(t);return}}function yt(n,t){var v,p,e;return n===r?(o?f(t):d.push(t),i):(s(n)&&(t=n,n="ALL"),a(n))?(v={},u(n,function(n){v[n]=c[n];i.ready(n,function(){y(v)&&f(t)})}),i):typeof n!="string"||!s(t)?i:(p=c[n],p&&p.state===l||n==="ALL"&&y()&&o)?(f(t),i):(e=h[n],e?e.push(t):e=h[n]=[t],i)}function e(){if(!r.body){n.clearTimeout(i.readyTimeout);i.readyTimeout=n.setTimeout(e,50);return}o||(o=!0,vt(),u(d,function(n){f(n)}))}function k(){r.addEventListener?(r.removeEventListener("DOMContentLoaded",k,!1),e()):r.readyState==="complete"&&(r.detachEvent("onreadystatechange",k),e())}var r=n.document,d=[],h={},c={},ut="async"in r.createElement("script")||"MozAppearance"in r.documentElement.style||n.opera,o,g=n.head_conf&&n.head_conf.head||"head",i=n[g]=n[g]||function(){i.ready.apply(null,arguments)},nt=1,ft=2,tt=3,l=4,p;if(r.readyState==="complete")e();else if(r.addEventListener)r.addEventListener("DOMContentLoaded",k,!1),n.addEventListener("load",e,!1);else{r.attachEvent("onreadystatechange",k);n.attachEvent("onload",e);p=!1;try{p=!n.frameElement&&r.documentElement}catch(wt){}p&&p.doScroll&&function pt(){if(!o){try{p.doScroll("left")}catch(t){n.clearTimeout(i.readyTimeout);i.readyTimeout=n.setTimeout(pt,50);return}e()}}()}i.load=i.js=ut?lt:ct;i.test=ot;i.ready=yt;i.ready(r,function(){y()&&u(h.ALL,function(n){f(n)});i.feature&&i.feature("domloaded",!0)})})(window);
|
||||
/*
|
||||
//# sourceMappingURL=head.min.js.map
|
||||
*/
|
8
lib/js/extra/headjs/dist/1.0.0/head.min.js.map
vendored
Normal file
8
lib/js/extra/headjs/dist/1.0.0/head.min.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
51
lib/js/extra/headjs/dist/1.0.0/head.nuspec
vendored
Normal file
51
lib/js/extra/headjs/dist/1.0.0/head.nuspec
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>HeadJS</id>
|
||||
<version>1.0.3</version>
|
||||
<title>HeadJS</title>
|
||||
<authors>Robert Hoffmann,Tero Piirainen</authors>
|
||||
<owners>itechnology</owners>
|
||||
<licenseUrl>http://bit.ly/mit-license</licenseUrl>
|
||||
<projectUrl>http://headjs.com</projectUrl>
|
||||
<iconUrl>http://headjs.com/favicon.png</iconUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>
|
||||
At under 5K minified & gzipped HeadJS provides you with:
|
||||
|
||||
* Asset Loader: Load scripts and stylesheets when you need them.
|
||||
head.load("file1.js" , "file2.js" , function() { done(); })
|
||||
head.load("file1.css", "file2.css", function() { done(); })
|
||||
|
||||
* JavaScript Organizer: Defer execution to the bottom of page.
|
||||
head.ready(function() { imReady(); })
|
||||
|
||||
* Responsive Design: Detect and react to resolutions with simple css classes or js tests that work without media query support.
|
||||
.landscape, .lt-800, .gt-1680, if (head.mobile) { }
|
||||
|
||||
* Browser Detection: Detect browsers & their version, and apply css or js logic to them.
|
||||
.gt-ie6, .lt-ie10, if (head.browser.ios) { }
|
||||
|
||||
* Feature Detection: Detect browser features like cssreflections, touch-enabled
|
||||
.no-touch if (!head.touch) { }
|
||||
|
||||
* CSS Moderniser: Detect css support like box-shadow, border-radius
|
||||
.no-borderradius, if (!head.borderradius) { }
|
||||
|
||||
* CSS Router: Detect which page and section someone is on and target it with specific css.
|
||||
.index-page, .register-page, .root-section, .user-section,
|
||||
|
||||
* HTML5 Shim: Need to support the new HTML5 tags in older browsers ? No problem !
|
||||
</description>
|
||||
<summary>Load scripts and stylesheets on demand. Achieve responsive design with CSS that targets different screen resolutions, paths, states and browsers. Detect various browsers and their features. Target HTML5 and CSS3 safely.</summary>
|
||||
<releaseNotes />
|
||||
<copyright>Tero Piirainen</copyright>
|
||||
<language>en-US</language>
|
||||
<tags>javascript, html, html5, css, css3, loader, responsive design, media queries, feature detection, dependency loading, mobile, tablet</tags>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="head.js" target="Content\Scripts\head-1.0.3.js" />
|
||||
<file src="head.min.js" target="Content\Scripts\head-1.0.3.min.js" />
|
||||
<file src="changelog.txt" target="Content\Scripts\head-changelog.txt" />
|
||||
</files>
|
||||
</package>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue