Permalink
Browse files

分离出 monster.js,没有实质内容

  • Loading branch information...
1 parent b6f7241 commit f2b4da3e83c4fa8c82f1933d863debeaa0be8b56 @sunnylost committed Nov 8, 2013
Showing with 99 additions and 0 deletions.
  1. +99 −0 console/console.js
View
@@ -0,0 +1,99 @@
+(function(win, doc) {
+ var globalStyle;
+
+ var stack = {
+ };
+
+ /* Console API */
+ var apis = {
+ assert: function() { },
+ info: function() { },
+ log: function() {},
+ debug: function() { },
+ warn: function() { },
+ error: function() { },
+
+ clear: function() { },
+ count: function() { },
+
+ dir: function() { },
+ dirxml: function() { },
+
+ markTimeline: function() { },
+ profile: function() { },
+ profileEnd: function() { },
+ table: function() { },
+
+ group: function() { },
+ groupCollapsed: function() { },
+ groupEnd: function() { },
+
+
+ time: function() { },
+ timeEnd: function() { },
+ timeStamp: function() { },
+ timeline: function() { },
+ timelineEnd: function() { },
+ trace: function() { }
+ };
+
+ var Console = {
+ ATTRS: {
+ input: '.console-input'
+ },
+
+ EVENTS: {
+ '.console-inputwrap': {
+ click: function() {
+ this.get('input')[0].focus();
+ }
+ },
+
+ '.console-input': {
+ keypress: {
+ 13: function(e) {
+ var el = this.get('input')[0],
+ content = el.innerHTML;
+ var m = this.model;
+ el.innerHTML = '';
+ }
+ }
+ }
+ },
+
+ el: '.console-wrap', //root element
+
+ init: function() {
+ this.originConsole = win.console;
+ //win.console = Console;
+ var _ = this._;
+ _('head')[0].appendChild(globalStyle = _.el('style'));
+ }
+ };
+
+ Console.model = {
+ filter: function(type) {
+ globalStyle.innerHTML = '.console-' + type + ' {display: none;}';
+ }
+ };
+
+ Console.route = {
+ '*': function(e) {
+ this.model.filter(e.newHash);
+ },
+
+ 'clear': function() {
+ this.view.clear();
+ }
+ };
+
+ Console.view = {
+ templates: {
+ item: '<li class="console-{{type}}"><i class="console-gutter"></i><div class="console-content">{{content}}</div></li>'
+ },
+
+ el: '.console-result'
+ };
+
+ Monster.bootstrap(Console);
+}(window, document))

0 comments on commit f2b4da3

Please sign in to comment.