/** * The map plugin for auto responder */ define('seajs/plugin-debug', [], function() { var util = seajs.pluginSDK.util var loc = this.location var search = loc.search var config = getConfig() // Forces debug to true when url contains `?seajs-debug` if (search.indexOf('seajs-debug') > -1) { config.debug = 1 config.console = 1 saveConfig(config) } // Loads the map file if (config.mapfile) { document.title = '[seajs debug mode] - ' + document.title // Adds the `mapfile` to preload config seajs.config({ preload: config.mapfile }) } // Restores the use function seajs.use = seajs._use delete seajs._use // Calls pre-called `seajs.use` var args = seajs._useArgs if (args) { for (var i = 0; i < args.length; i++) { seajs.use(args[i][0], args[i][1]) } delete seajs._useArgs } // Shows console if (config.console) { showConsole(config.mapfile) } // Loads firebug-lite if (search.indexOf('firebug-lite') > -1) { util.fetch('https://getfirebug.com/firebug-lite.js') } // Helpers // ------- function showConsole(mapfile) { var style = '#seajs-debug-console { ' + ' position: fixed; bottom: 10px; ' + ' *position: absolute; *top: 10px; *width: 465px; ' + ' right: 10px; z-index: 999999999;' + ' background: #fff; color: #000; font: 12px arial;' + ' border: 2px solid #000; padding: 0 10px 10px;' + '}' + '#seajs-debug-console h3 {' + ' margin: 3px 0 6px -6px; padding: 0;' + ' font-weight: bold; font-size: 14px;' + '}' + '#seajs-debug-console input {' + ' width: 400px; margin-left: 10px;' + '}' + '#seajs-debug-console button {' + ' float: right; margin: 6px 0 0 10px;' + ' box-shadow: #ddd 0 1px 2px;' + ' font-size: 14px; padding: 4px 10px;' + ' color: #211922; background: #f9f9f9;' + ' text-shadow: 0 1px #eaeaea;' + ' border: 1px solid #bbb; border-radius: 3px;' + ' cursor: pointer; opacity: .8' + '}' + '#seajs-debug-console button:hover {' + ' background: #e8e8e8; text-shadow: none; opacity: 1' + '}' + '#seajs-debug-console a {' + ' position: relative; top: 10px; text-decoration: none;' + '}' var html = '