/*
@copyright (c) Till Wehowski - All rights reserved
@license (Basic/EULA) http://look-up.webfan.de/webdof-license
@license (Source Code Re-Usage) http://look-up.webfan.de/bsd-license
Copyright (c) 2015, Till Wehowski All rights reserved.
@component http://webfan.de/cdn/frdl/flow/components/webfan/cli
*/
(function(){
'use strict';
(function(){if('undefined'===typeof frdl && 0===document.querySelectorAll('script[src*="api.webfan.de\/api-d\/4\/js-api\/library.js"]').length && 0===document.querySelectorAll('script[src*="flow.js"]').length){var h=document.getElementsByTagName("head",document)[0];var s=document.createElement('script');s.setAttribute('src','http://api.webfan.de/api-d/4/js-api/library.js');h.insertBefore(s,h.firstChild);}}());
frdl_webfan_flow_advertising_external_linking(new frdl.Url(frdl.__FILE__()).getHost());
var __PACKAGENAME__ = 'webfan/cli';
frdl.whenEver(function(){return 'undefined'!==typeof jQuery && !!frdl.UI.getWidget(__PACKAGENAME__);},
function(){
var AppData = frdl.UI.widgetAppData(frdl.__FILE__(frdl.UI.getWidget(__PACKAGENAME__).config.directory) , __PACKAGENAME__);
AppData.__PACKAGENAME__=__PACKAGENAME__;
frdl.each(document.querySelectorAll('*[data-frdl-component$="webfan\/cli"]:not([data-flow-prepared="true"])'), function(i,el){
// if('true'===el.getAttribute('data-frdl-component-loaded-script'))return true;
el.setAttribute('data-frdl-component-initiated', 'true');
el.setAttribute('data-frdl-component-loaded-script', 'true');
el.setAttribute('data-flow-prepared', 'true');
el.setAttribute('resizable', 'true');
el.style.display='inline';
el.style.position="relative";
el.style.minHeight="95%";
el.style.padding="15px;";
el.style.margin="15px;";
el.setAttribute('data-role', 'none');
el.setAttribute('data-theme', 'none');
//frdl.wd().goTo(\'frdl/webfan\', \'/package/start//'+THIS.vendor+'/'+THIS.pack+'\');
if(!el.hasAttribute('data-frdl-opt-menu') || 'false'!==el.getAttribute('data-frdl-opt-menu')){
$(el).append('<br />'
+'<a href="javascript:;" data-frdl-components-mod="startlink" onclick="console.log(\'Terminal restart...\');try{$( $(this.parentNode).find(\'section[data-frdl-component-console-terminal]\')).PttyLoad();}catch(err){console.error(err);}">Start</a>'
+' <a href="javascript:;" onclick="$.cliExec(\'#!js\');" title="Execute javascript in console...">#!js</a>'
+' <a href="javascript:;" onclick="var nu = prompt(\'API-URL:\', $(this.parentNode).find(\'section[data-frdl-component-console-terminal]\').data(\'url1\') );if(null!==nu){$(this.parentNode).find(\'section[data-frdl-component-console-terminal]\').data(\'url1\', nu);frdl.route(\'API_JSONP\', nu); }">API-URL</a>'
+' <a href="javascript:;" onclick="var nu = prompt(\'CLIENT-API-URL:\', $(this.parentNode).find(\'section[data-frdl-component-console-terminal]\').data(\'url2\') );if(null!==nu){$(this.parentNode).find(\'section[data-frdl-component-console-terminal]\').data(\'url2\', nu);frdl.route(\'API_CLIENT_URL\', nu); }">CLIENT-API-URL</a>'
+' <a href="javascript:;" onclick="frdl.wd(true);setTimeout(function(){frdl.wd().goTo(\'frdl/webfan\', \'/console/start/\');},2000);">Advanced Settings</a>'
+'<select onchange="frdl.debug.mode(this.options[this.selectedIndex].value);"><option value="'+frdl.debug.mode()+'" selected>Debugmode: '+frdl.debug.mode()+'</option><option value="0">Debugmode: 0</option><option value="1">Debugmode: 1</option><option value="2">Debugmode: 2</option></select>'
+' <a href="javascript:;" onclick="\$(\'*[data-flow-mod=\\\'jsConsoleLoggerScreen\\\']\').show();$(\'<div></div>\').appendTo(\'.cmd_terminal_content\').html(frdl.debug.Logger().getLog()); ">log</a>'
+' <a href="javascript:;" onclick="try{$( $(this.parentNode).find(\'section[data-frdl-component-console-terminal]\')).PttyLoad();}catch(err){console.error(err);}setTimeout(function(){$.cliExec(\'help\');$.cliExec(\'help frdl\');setTimeout(function(){$.cliExec(\'frdl help -b\');},1500);},1000);">Help</a>'
+''
);
}
var sec = frdl.Dom.create('section');
sec.setAttribute('class', 'console-screen');
sec.style.minHeight="95%";
sec.style.position="relative";
sec.setAttribute('data-frdl-component-console-terminal', 'standard');
frdl.Dom.add(sec,el);
$(el).append('<div class="console-screen" data-flow-mod="jsConsoleLoggerScreen" '
+' style="display:none;margin:5px;padding:5px;position:relative;overflow:auto;" ></div>');
frdl.debug.Logger().html('*[data-flow-mod="jsConsoleLoggerScreen"]');
$(document).ready(function(){
/*exclude from jQuery mobile*/
el.setAttribute('data-role', 'none');
sec.setAttribute('data-role', 'none');
el.setAttribute('data-theme', 'none');
sec.setAttribute('data-theme', 'none');
$(sec).css('background' ,'black');
$(sec).css('color', 'white');
// $(el).css('background' ,'black');
// $(el).css('color', 'white');
frdl.ready(function(){
$(el).find('a[data-frdl-components-mod="startlink"]').trigger('click');
/* $( $(el).find('section[data-frdl-component-console-terminal]')).PttyLoad();*/
});
});
});
}
, null, 1);
}());
|