/* webfan (C) Till Wehowski, Webfan.de - All rights reserved. */
(function(){
'use strict';
/**
* webfan.lazy
webfan.hallo('welt');
webfan.plug('hallo', function(){alert(JSON.stringify(arguments));});
*/
var _fN = {};
var _delay = 100;
var _run=function(name,args){
try{
if('function'===typeof _fN[name])return _fN[name](Array.prototype.slice.call(args));
return _fN[name];
}catch(err){
throw err;
}
};
webfan.plug = function(name, fN){
if(!!Proxy.isPolyfile)webfan[name]=fN;
_fN[name]=fN;
};
webfan.unplug = function(name){
_fN[name]=undefined;
};
webfan.Plugin = function(name, fN){
if('undefined'!==typeof fN)return webfan.plug(name, fN);
return _fN[name];
};
webfan.__call = function(name,args){
if(!!_fN[name]){
return _run(name,args);
}
return frdl.when(function(_fN){return ('undefined' !== typeof _fN[name]) ? true : false;},
function(){
return _run(name,args);
},
_fN,
function(){console.log('Failed to resolve webfan.'+name+'('+JSON.stringify(args)+')');},
_delay);
/*
console.warn('ToDo: resolve webfan.__call('+name+', '+JSON.stringify(args)+')');
return undefined;
*/
};
(function(){
webfan.plug('$Async', function(){
var _Arguments =Array.prototype.slice.call(arguments)[0];
var T = _Arguments[_Arguments.length-1];
if(isNaN(T))T=1;
if('undefined'!== typeof process && 'function'=== typeof process.nextTick){
process.nextTick(function(){
setTimeout(function(){
var fn = ('function' !== typeof _Arguments) ? _Arguments.shift() : _Arguments;
fn(_Arguments);
}, T);
});
}else{
setTimeout(function(){
var fn = ('function' !== typeof _Arguments) ? _Arguments.shift() : _Arguments;
fn(_Arguments);
}, T);
}
});
webfan.plug('$browser-scheme', function(){
return 'webfan://';
});
webfan.plug('$root-app', function(){
return 'http://app.domainundhomepagespeicher.webfan.de';
});
}());
(function(){
/*
if(( true===navigator.isApp && 'undefined'!==typeof navigator.webfan && 'undefined'!==typeof global && 'undefined'!==typeof global.__nw_require && 'function'===typeof global.__nw_require && true === navigator.isWebfanBrowser)){
process.nextTick(function(){
var s = window.require('webfan/navigator/shim');
var shim = new s(navigator);
shim.plugBrowserShim(webfan);
});
}else{
var shim = require('webfan/navigator/shim', function(module) {
shim = new module.exports(navigator);
shim.plugBrowserShim(webfan);
});
}
*/
/**
* http://cdn.webfan.de/cdn/application/webfan/node_modules/webfan/navigator/shim.js
*/
if(true === navigator['-webkit-webfan']){
try{
var s = require('webfan/navigator/shim');
var shim = new s(navigator);
shim.plugBrowserShim(webfan);
}catch(err){
console.error(err);
}
}else{
require('webfan/navigator/shim', function(mod) {
var shim = new mod.module(navigator);
shim.plugBrowserShim(webfan);
});
}
}());
/* deprecated: */
webfan.render = {
blueAllInputs : function(){
console.deprecated('webfan.render.blueAllInputs is deprecated!');
var iClass = "newBlogInput";
createCSSClass("." + iClass, "-moz-border-radius: 6px; -webkit-border-radius: 6px; color: #6495ED; border: 0.1em #6495ED dotted; border-radius: 6px;");
frdl.ready(function(){
frdl.watchFor('input:not([data-flow-prepared*="blueAllInputs"])').every(function(el){
/* $(el).addClass('webfan-blue'); */
frdl.$j(el).attrAdd('data-flow-prepared', 'blueAllInputs');
var disabled, eType;
/* if(inputs[j].hasAttribute("class"))continue;
if("true" === inputs[j].getAttribute("data-clear-btn") )continue;
*/
eType = el.getAttribute("type");
if( eType != "text" && eType != "password")return;
if(el.getAttribute("class") === "color")return;
if(el.getAttribute("class") === "color {pickerClosable:true}")return;
el.setAttribute("class", iClass);
el.style.fontColor = "#6495ED";
el.style.color = "#6495ED";
disabled = el.getAttribute("disabled");
if(disabled !== null && disabled !== false && disabled !== undefined){
el.style.color = "lightgrey";
el.style.fontColor = "grey";
}
var readonly = el.getAttribute("readonly");
if(readonly !== null && readonly !== false && readonly !== undefined){
el.style.color = "lightgrey";
el.style.fontColor = "grey";
}
});
frdl.watchFor('select:not([data-flow-prepared*="blueAllInputs"])').every(function(el){
frdl.$j(el).attrAdd('data-flow-prepared', 'blueAllInputs');
/* if(el.hasAttribute("class"))continue;
if("true" === el.getAttribute("data-clear-btn") )continue;
*/
var disabled, eType;
el.setAttribute("class", iClass);
el.style.fontColor = "#6495ED";
el.style.color = "#6495ED";
disabled = el.getAttribute("disabled");
if(disabled !== null && disabled !== false && disabled !== undefined){
el.style.color = "lightgrey";
el.style.fontColor = "grey";
}
var readonly = el.getAttribute("readonly");
if(readonly !== null && readonly !== false && readonly !== undefined){
el.style.color = "lightgrey";
el.style.fontColor = "grey";
}
});
try{
jscolor.bind();
}catch(err){
console.warn(err);
}
});
}
};
/* end deprecated */
frdl.noConflict = function() {
return frdl;
};
webfan.noConflict = function() {
return webfan;
};
}());
|