feature(config) add online

This commit is contained in:
coderaiser 2013-10-02 13:05:16 +00:00
parent 75c7b2849b
commit 9412071926
3 changed files with 30 additions and 19 deletions

View file

@ -155,6 +155,7 @@ All main configuration could be done via [config.json](json/config.json "Config"
"html" : true,
"img" : false
},
"online" : true, /* load js files from cdn or local path */
"cache" : true,
"logs" : false, /* logs or console ouput */
"show_keys_panel" : true, /* show classic panel with buttons of keys */

View file

@ -1053,26 +1053,33 @@ var CloudCmd, Util, DOM, CloudFunc;
* @param pCallBack
*/
this.jqueryLoad = function(pCallBack) {
Loader.jquery({
onload: pCallBack,
CloudCmd.getConfig(function(config) {
var online = config.online;
onerror: function() {
Loader.jsload('/lib/client/jquery.js', {
onload: pCallBack
Util.ifExec(!online,
function() {
Loader.jsload('/lib/client/jquery.js', {
onload: pCallBack
});
/* if could not load jquery from google server
* maybe we offline, load font from local
* directory */
Loader.cssSet({
id :'local-droids-font',
element : document.head,
inner : '@font-face {font-family: "Droid Sans Mono";' +
'font-style: normal;font-weight: normal;' +
'src: local("Droid Sans Mono"), local("DroidSansMono"),'+
' url("/font/DroidSansMono.woff") format("woff");}'
});
},
function(callback) {
Loader.jquery({
onload: pCallBack,
onerror: callback
});
});
/* if could not load jquery from google server
* maybe we offline, load font from local
* directory */
Loader.cssSet({
id :'local-droids-font',
element : document.head,
inner : '@font-face {font-family: "Droid Sans Mono";' +
'font-style: normal;font-weight: normal;' +
'src: local("Droid Sans Mono"), local("DroidSansMono"),'+
' url("/font/DroidSansMono.woff") format("woff");}'
});
}
});
};

View file

@ -12,7 +12,10 @@ var Util, DOM, CloudCmd;
this.analytics = function() {
getConfig(function(config) {
if (config.analytics) {
var analytics = config.analytics,
online = config.online;
if (analytics && online) {
Events.addOneTime('mousemove', function(){
var FIVE_SECONDS = 5000,
lUrl = CloudCmd.LIBDIRCLIENT + 'analytics.js';