mad_chatter 0.2.9 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/.rvmrc +1 -0
- data/Gemfile.lock +1 -3
- data/README.md +25 -20
- data/lib/mad_chatter/actions/dsl.rb +4 -10
- data/lib/mad_chatter/actions.rb +29 -0
- data/lib/mad_chatter/channel.rb +56 -0
- data/lib/mad_chatter/config.rb +22 -5
- data/lib/mad_chatter/connection.rb +29 -0
- data/lib/mad_chatter/extensions.rb +12 -0
- data/lib/mad_chatter/markdown_renderer.rb +6 -0
- data/lib/mad_chatter/message.rb +39 -12
- data/lib/mad_chatter/message_history.rb +8 -5
- data/lib/mad_chatter/message_listener.rb +17 -0
- data/lib/mad_chatter/message_listeners/code.rb +30 -0
- data/lib/mad_chatter/message_listeners/image.rb +27 -0
- data/lib/mad_chatter/message_listeners/join.rb +30 -0
- data/lib/mad_chatter/message_listeners/markdown.rb +45 -0
- data/lib/mad_chatter/message_listeners/nick.rb +26 -0
- data/lib/mad_chatter/server.rb +0 -55
- data/lib/mad_chatter/servers/em_websocket.rb +5 -14
- data/lib/mad_chatter/user.rb +78 -0
- data/lib/mad_chatter/users.rb +32 -24
- data/lib/mad_chatter/version.rb +1 -1
- data/lib/mad_chatter.rb +98 -34
- data/mad_chatter.gemspec +1 -1
- data/screenshot.png +0 -0
- data/spec/actions_spec.rb +7 -0
- data/spec/message_history_spec.rb +12 -10
- data/spec/message_listeners/code_spec.rb +37 -0
- data/spec/message_listeners/join_spec.rb +34 -0
- data/spec/message_listeners/markdown_spec.rb +47 -0
- data/spec/message_spec.rb +28 -16
- data/spec/server_spec.rb +43 -0
- data/spec/users_spec.rb +23 -0
- data/templates/extensions/example.rb +1 -1
- data/templates/extensions.rb +16 -14
- data/templates/web/css/bootstrap.css +3363 -0
- data/templates/web/css/bootstrap.min.css +610 -0
- data/templates/web/css/bootstrap.min.responsive.css +3 -0
- data/templates/web/css/bootstrap.responsive.css +567 -0
- data/templates/web/css/mad_chatter.css +59 -0
- data/templates/web/{styles.css → css/styles.css} +26 -20
- data/templates/web/img/glyphicons-halflings-white.png +0 -0
- data/templates/web/img/glyphicons-halflings.png +0 -0
- data/templates/web/index.html +173 -40
- data/templates/web/js/bootstrap.js +1722 -0
- data/templates/web/js/bootstrap.min.js +1 -0
- data/templates/web/js/mad_chatter.js +292 -0
- data/templates/web/{mad_chatter_actions.js → js/mad_chatter_actions.js} +0 -0
- data/templates/web/js/mad_chatter_config.js +3 -0
- data/templates/web/js/swfobject.js +4 -0
- data/templates/web/js/web_socket.js +389 -0
- data/templates/web/swf/WebSocketMain.swf +0 -0
- metadata +65 -62
- data/TODO.txt +0 -10
- data/templates/web/mad_chatter.js +0 -161
- data/templates/web/mad_chatter_config.js +0 -1
- data/templates/web/markitup/jquery.markitup.js +0 -593
- data/templates/web/markitup/sets/markdown/images/bold.png +0 -0
- data/templates/web/markitup/sets/markdown/images/code.png +0 -0
- data/templates/web/markitup/sets/markdown/images/h1.png +0 -0
- data/templates/web/markitup/sets/markdown/images/h2.png +0 -0
- data/templates/web/markitup/sets/markdown/images/h3.png +0 -0
- data/templates/web/markitup/sets/markdown/images/h4.png +0 -0
- data/templates/web/markitup/sets/markdown/images/h5.png +0 -0
- data/templates/web/markitup/sets/markdown/images/h6.png +0 -0
- data/templates/web/markitup/sets/markdown/images/italic.png +0 -0
- data/templates/web/markitup/sets/markdown/images/link.png +0 -0
- data/templates/web/markitup/sets/markdown/images/list-bullet.png +0 -0
- data/templates/web/markitup/sets/markdown/images/list-numeric.png +0 -0
- data/templates/web/markitup/sets/markdown/images/picture.png +0 -0
- data/templates/web/markitup/sets/markdown/images/preview.png +0 -0
- data/templates/web/markitup/sets/markdown/images/quotes.png +0 -0
- data/templates/web/markitup/sets/markdown/readme.txt +0 -11
- data/templates/web/markitup/sets/markdown/style.css +0 -6
- data/templates/web/markitup/skins/mad_chatter/images/handle.png +0 -0
- data/templates/web/markitup/skins/mad_chatter/images/menu.png +0 -0
- data/templates/web/markitup/skins/mad_chatter/images/submenu.png +0 -0
- data/templates/web/markitup/skins/mad_chatter/style.css +0 -121
@@ -0,0 +1 @@
|
|
1
|
+
!function(a){a(function(){"use strict",a.support.transition=function(){var b=document.body||document.documentElement,c=b.style,d=c.transition!==undefined||c.WebkitTransition!==undefined||c.MozTransition!==undefined||c.MsTransition!==undefined||c.OTransition!==undefined;return d&&{end:function(){var b="TransitionEnd";return a.browser.webkit?b="webkitTransitionEnd":a.browser.mozilla?b="transitionend":a.browser.opera&&(b="oTransitionEnd"),b}()}}()})}(window.jQuery),!function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype={constructor:c,close:function(b){function f(){e.remove(),e.trigger("closed")}var c=a(this),d=c.attr("data-target"),e;d||(d=c.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),e=a(d),e.trigger("close"),b&&b.preventDefault(),e.length||(e=c.hasClass("alert")?c:c.parent()),e.removeClass("in"),a.support.transition&&e.hasClass("fade")?e.on(a.support.transition.end,f):f()}},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype={constructor:b,setState:function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},toggle:function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")}},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){a(b.target).button("toggle")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.carousel.defaults,c),this.options.slide&&this.slide(this.options.slide)};b.prototype={cycle:function(){return this.interval=setInterval(a.proxy(this.next,this),this.options.interval),this},to:function(b){var c=this.$element.find(".active"),d=c.parent().children(),e=d.index(c),f=this;if(b>d.length-1||b<0)return;return this.sliding?this.$element.one("slid",function(){f.to(b)}):e==b?this.pause().cycle():this.slide(b>e?"next":"prev",a(d[b]))},pause:function(){return clearInterval(this.interval),this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(b,c){var d=this.$element.find(".active"),e=c||d[b](),f=this.interval,g=b=="next"?"left":"right",h=b=="next"?"first":"last",i=this;return this.sliding=!0,f&&this.pause(),e=e.length?e:this.$element.find(".item")[h](),!a.support.transition&&this.$element.hasClass("slide")?(this.$element.trigger("slide"),d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")):(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),this.$element.trigger("slide"),this.$element.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)})),f&&this.cycle(),this}},a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("carousel"),f=typeof c=="object"&&c;e||d.data("carousel",e=new b(this,f)),typeof c=="number"?e.to(c):typeof c=="string"||(c=f.slide)?e[c]():e.cycle()})},a.fn.carousel.defaults={interval:5e3},a.fn.carousel.Constructor=b,a(function(){a("body").on("click.carousel.data-api","[data-slide]",function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=!e.data("modal")&&a.extend({},e.data(),c.data());e.carousel(f),b.preventDefault()})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find(".in"),e;d&&d.length&&(e=d.data("collapse"),d.collapse("hide"),e||d.data("collapse",null)),this.$element[b](0),this.transition("addClass","show","shown"),this.$element[b](this.$element[0][c])},hide:function(){var a=this.dimension();this.reset(this.$element[a]()),this.transition("removeClass","hide","hidden"),this.$element[a](0)},reset:function(a){var b=this.dimension();this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element.addClass("collapse")},transition:function(b,c,d){var e=this,f=function(){c=="show"&&e.reset(),e.$element.trigger(d)};this.$element.trigger(c)[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){function d(){a(b).parent().removeClass("open")}"use strict";var b='[data-toggle="dropdown"]',c=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};c.prototype={constructor:c,toggle:function(b){var c=a(this),e=c.attr("data-target"),f,g;return e||(e=c.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,"")),f=a(e),f.length||(f=c.parent()),g=f.hasClass("open"),d(),!g&&f.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var d=a(this),e=d.data("dropdown");e||d.data("dropdown",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.dropdown.Constructor=c,a(function(){a("html").on("click.dropdown.data-api",d),a("body").on("click.dropdown.data-api",b,c.prototype.toggle)})}(window.jQuery),!function(a){function c(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),d.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),d.call(b)})}function d(a){this.$element.hide().trigger("hidden"),e.call(this)}function e(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),e?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(f,this)):f.call(this)):b&&b()}function f(){this.$backdrop.remove(),this.$backdrop=null}function g(){var b=this;this.isShown&&this.options.keyboard?a(document).on("keyup.dismiss.modal",function(a){a.which==27&&b.hide()}):this.isShown||a(document).off("keyup.dismiss.modal")}"use strict";var b=function(b,c){this.options=a.extend({},a.fn.modal.defaults,c),this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this))};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this;if(this.isShown)return;a("body").addClass("modal-open"),this.isShown=!0,this.$element.trigger("show"),g.call(this),e.call(this,function(){var c=a.support.transition&&b.$element.hasClass("fade");!b.$element.parent().length&&b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in"),c?b.$element.one(a.support.transition.end,function(){b.$element.trigger("shown")}):b.$element.trigger("shown")})},hide:function(b){b&&b.preventDefault();if(!this.isShown)return;var e=this;this.isShown=!1,a("body").removeClass("modal-open"),g.call(this),this.$element.trigger("hide").removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?c.call(this):d.call(this)}},a.fn.modal=function(c){return this.each(function(){var d=a(this),e=d.data("modal"),f=typeof c=="object"&&c;e||d.data("modal",e=new b(this,f)),typeof c=="string"?e[c]():e.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0},a.fn.modal.Constructor=b,a(function(){a("body").on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({},e.data(),c.data());b.preventDefault(),e.modal(f)})})}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);!c.options.delay||!c.options.delay.show?c.show():(c.hoverState="in",setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show))},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);!c.options.delay||!c.options.delay.hide?c.hide():(c.hoverState="out",setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide))},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},setContent:function(){var a=this.tip();a.find(".tooltip-inner").html(this.getTitle()),a.removeClass("fade in top bottom left right")},hide:function(){function d(){var b=setTimeout(function(){c.off(a.support.transition.end).remove()},500);c.one(a.support.transition.end,function(){clearTimeout(b),c.remove()})}var b=this,c=this.tip();c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d():c.remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a=a.toString().replace(/(^\s*|\s*$)/,""),a},tip:function(){return this.$tip=this.$tip||a(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}},a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.defaults={animation:!0,delay:0,selector:!1,placement:"top",trigger:"hover",title:"",template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'}}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:b,setContent:function(){var b=this.tip(),c=this.getTitle(),d=this.getContent();b.find(".popover-title")[a.type(c)=="object"?"append":"html"](c),b.find(".popover-content > *")[a.type(d)=="object"?"append":"html"](d),b.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-content")||(typeof c.content=="function"?c.content.call(b[0]):c.content),a=a.toString().replace(/(^\s*|\s*$)/,""),a},tip:function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip}}),a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("popover"),f=typeof c=="object"&&c;e||d.data("popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.defaults=a.extend({},a.fn.tooltip.defaults,{placement:"right",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery),!function(a){function b(b,c){var d=a.proxy(this.process,this),e=a(b).is("body")?a(window):a(b),f;this.options=a.extend({},a.fn.scrollspy.defaults,c),this.$scrollElement=e.on("scroll.scroll.data-api",d),this.selector=(this.options.target||(f=a(b).attr("href"))&&f.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=a("body").on("click.scroll.data-api",this.selector,d),this.refresh(),this.process()}"use strict",b.prototype={constructor:b,refresh:function(){this.targets=this.$body.find(this.selector).map(function(){var b=a(this).attr("href");return/^#\w/.test(b)&&a(b).length?b:null}),this.offsets=a.map(this.targets,function(b){return a(b).position().top})},process:function(){var a=this.$scrollElement.scrollTop()+this.options.offset,b=this.offsets,c=this.targets,d=this.activeTarget,e;for(e=b.length;e--;)d!=c[e]&&a>=b[e]&&(!b[e+1]||a<=b[e+1])&&this.activate(c[e])},activate:function(a){var b;this.activeTarget=a,this.$body.find(this.selector).parent(".active").removeClass("active"),b=this.$body.find(this.selector+'[href="'+a+'"]').parent("li").addClass("active"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active")}},a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("scrollspy"),f=typeof c=="object"&&c;e||d.data("scrollspy",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.defaults={offset:10},a(function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),!function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype={constructor:b,show:function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.attr("data-target"),e,f;d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,""));if(b.parent("li").hasClass("active"))return;e=c.find(".active a").last()[0],b.trigger({type:"show",relatedTarget:e}),f=a(d),this.activate(b.parent("li"),c),this.activate(f,f.parent(),function(){b.trigger({type:"shown",relatedTarget:e})})},activate:function(b,c,d){function g(){e.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),f?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var e=c.find("> .active"),f=d&&a.support.transition&&e.hasClass("fade");f?e.one(a.support.transition.end,g):g(),e.removeClass("in")}},a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("tab");e||d.data("tab",e=new b(this)),typeof c=="string"&&e[c]()})},a.fn.tab.Constructor=b,a(function(){a("body").on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.typeahead.defaults,c),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.$menu=a(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};b.prototype={constructor:b,select:function(){var a=this.$menu.find(".active").attr("data-value");return this.$element.val(a),this.hide()},show:function(){var b=a.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:b.top+b.height,left:b.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(b){var c=this,d,e;return this.query=this.$element.val(),this.query?(d=a.grep(this.source,function(a){if(c.matcher(a))return a}),d=this.sorter(d),d.length?this.render(d.slice(0,this.options.items)).show():this.shown?this.hide():this):this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){var b=[],c=[],d=[],e;while(e=a.shift())e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?c.push(e):d.push(e):b.push(e);return b.concat(c,d)},highlighter:function(a){return a.replace(new RegExp("("+this.query+")","ig"),function(a,b){return"<strong>"+b+"</strong>"})},render:function(b){var c=this;return b=a(b).map(function(b,d){return b=a(c.options.item).attr("data-value",d),b.find("a").html(c.highlighter(d)),b[0]}),b.first().addClass("active"),this.$menu.html(b),this},next:function(b){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(a){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),(a.browser.webkit||a.browser.msie)&&this.$element.on("keydown",a.proxy(this.keypress,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},keyup:function(a){a.stopPropagation(),a.preventDefault();switch(a.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:this.hide();break;default:this.lookup()}},keypress:function(a){a.stopPropagation();if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:a.preventDefault(),this.prev();break;case 40:a.preventDefault(),this.next()}},blur:function(a){var b=this;a.stopPropagation(),a.preventDefault(),setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(c){return this.each(function(){var d=a(this),e=d.data("typeahead"),f=typeof c=="object"&&c;e||d.data("typeahead",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>'},a.fn.typeahead.Constructor=b,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);if(c.data("typeahead"))return;b.preventDefault(),c.typeahead(c.data())})})}(window.jQuery);
|
@@ -0,0 +1,292 @@
|
|
1
|
+
var MadChatter = {
|
2
|
+
|
3
|
+
init: function(ws_host){
|
4
|
+
$('#chat_wrapper').hide();
|
5
|
+
MadChatter.init_websocket(ws_host);
|
6
|
+
MadChatter.wait_for_join();
|
7
|
+
},
|
8
|
+
|
9
|
+
init_websocket: function(ws_host){
|
10
|
+
if (typeof WebSocket === 'undefined') {
|
11
|
+
alert("Your browser does not support websockets.")
|
12
|
+
return false;
|
13
|
+
}
|
14
|
+
var ws = new WebSocket(ws_host);
|
15
|
+
ws.onopen = function(){
|
16
|
+
MadChatter.resume_chat();
|
17
|
+
};
|
18
|
+
ws.onclose = function(){
|
19
|
+
MadChatter.token = null;
|
20
|
+
MadChatter.reconnect(ws_host);
|
21
|
+
};
|
22
|
+
ws.onmessage = function(e){
|
23
|
+
var data = JSON.parse(e.data);
|
24
|
+
// console.log(data);
|
25
|
+
MadChatter.message_received(data);
|
26
|
+
};
|
27
|
+
MadChatter.ws = ws;
|
28
|
+
},
|
29
|
+
|
30
|
+
reconnect: function(ws_host){
|
31
|
+
$('#disconnected').modal('show');
|
32
|
+
setTimeout('MadChatter.init_websocket("'+ws_host+'")', 10000);
|
33
|
+
},
|
34
|
+
|
35
|
+
resume_chat: function(){
|
36
|
+
setTimeout(function(){
|
37
|
+
$('#disconnected').modal('hide');
|
38
|
+
if (MadChatter.token && MadChatter.username) {
|
39
|
+
MadChatter.set_username(MadChatter.username);
|
40
|
+
$('#channel_tabs li').each(function(){
|
41
|
+
var channel = $(this).find('a').attr('data-channel');
|
42
|
+
if (channel != 'lobby') {
|
43
|
+
MadChatter.send_message('/join', channel);
|
44
|
+
}
|
45
|
+
});
|
46
|
+
}
|
47
|
+
}, 2000); //wait two seconds. we should have a token by then
|
48
|
+
},
|
49
|
+
|
50
|
+
wait_for_join: function(){
|
51
|
+
$('#pick_a_username').submit(function(e){
|
52
|
+
e.preventDefault();
|
53
|
+
MadChatter.join_chat();
|
54
|
+
});
|
55
|
+
},
|
56
|
+
|
57
|
+
join_chat: function(){
|
58
|
+
var username = $.trim($('#username').val());
|
59
|
+
if (username.length == 0) {
|
60
|
+
alert('Please enter your name.');
|
61
|
+
return false;
|
62
|
+
}
|
63
|
+
|
64
|
+
MadChatter.set_username(username);
|
65
|
+
$('#login_screen').hide();
|
66
|
+
$('#chat_wrapper').show();
|
67
|
+
|
68
|
+
MadChatter.add_channel_tab('lobby', 'Lobby').trigger('click');
|
69
|
+
|
70
|
+
$('.navbar .brand').on('click', function(e){
|
71
|
+
e.preventDefault();
|
72
|
+
MadChatter.join_channel('lobby');
|
73
|
+
});
|
74
|
+
|
75
|
+
$('#users-nav').popover({
|
76
|
+
placement: 'bottom',
|
77
|
+
content: function(){
|
78
|
+
return $('.channel:visible .users-list').html();
|
79
|
+
},
|
80
|
+
delay: { show: 0, hide: 1000 }
|
81
|
+
});
|
82
|
+
|
83
|
+
$('.join_channel').on('click', function(e){
|
84
|
+
e.preventDefault();
|
85
|
+
var channel_id = $(this).attr('data-channel'),
|
86
|
+
channel_name = $(this).text();
|
87
|
+
MadChatter.add_channel_tab(channel_id, channel_name).trigger('click');
|
88
|
+
});
|
89
|
+
|
90
|
+
$('#share_photo .btn-primary').on('click', function(e){
|
91
|
+
e.preventDefault();
|
92
|
+
var channel = $('.channel:visible').attr('data-channel'),
|
93
|
+
$input = $(this).closest('.modal').find('input[name="url"]'),
|
94
|
+
img_url = $input.val();
|
95
|
+
if ($.trim(img_url).length > 0) {
|
96
|
+
MadChatter.send_message('/img ' + img_url, channel);
|
97
|
+
$('#share_photo').modal('hide');
|
98
|
+
$input.val('');
|
99
|
+
}
|
100
|
+
});
|
101
|
+
|
102
|
+
$('#share_code .btn-primary').on('click', function(e){
|
103
|
+
e.preventDefault();
|
104
|
+
var channel = $('.channel:visible').attr('data-channel'),
|
105
|
+
$input = $(this).closest('.modal').find('textarea'),
|
106
|
+
code = $input.val();
|
107
|
+
if ($.trim(code).length > 0) {
|
108
|
+
MadChatter.send_message('/code ' + code, channel);
|
109
|
+
$('#share_code').modal('hide');
|
110
|
+
$input.val('');
|
111
|
+
}
|
112
|
+
});
|
113
|
+
},
|
114
|
+
|
115
|
+
set_username: function(username){
|
116
|
+
MadChatter.username = username;
|
117
|
+
MadChatter.send_message('/nick ' + username);
|
118
|
+
},
|
119
|
+
|
120
|
+
add_channel_tab: function(channel_id, channel_name){
|
121
|
+
var $existing_channel_tab = $('#channel_tabs a[data-channel="' + channel_id + '"]');
|
122
|
+
if ($existing_channel_tab.length > 0) {
|
123
|
+
return $existing_channel_tab;
|
124
|
+
}
|
125
|
+
|
126
|
+
var $channel_tab = $('<li><a href="#" data-channel="' + channel_id + '">' + channel_name + '</a></li>')
|
127
|
+
|
128
|
+
$channel_tab.on('click', function(e){
|
129
|
+
e.preventDefault();
|
130
|
+
MadChatter.join_channel(channel_id);
|
131
|
+
});
|
132
|
+
|
133
|
+
$('#channel_tabs').append($channel_tab);
|
134
|
+
return $channel_tab;
|
135
|
+
},
|
136
|
+
|
137
|
+
join_channel: function(channel_id){
|
138
|
+
$('#channel_tabs li')
|
139
|
+
.removeClass('active')
|
140
|
+
.find('a[data-channel="' + channel_id + '"]').parent().addClass('active');
|
141
|
+
$('.channel').hide();
|
142
|
+
var $channel = $('.channel[data-channel="' + channel_id + '"]');
|
143
|
+
if ($channel.length == 0) {
|
144
|
+
MadChatter.send_message('/join', channel_id);
|
145
|
+
//need to figure out how to wait for response to see if we're allowed to join
|
146
|
+
//solution: create .channel, but when server responds, it wont send messages, it will send not-authorized message
|
147
|
+
var $channel = $('#channel_template').clone();
|
148
|
+
$channel
|
149
|
+
.removeAttr('id')
|
150
|
+
.attr('data-channel', channel_id)
|
151
|
+
.appendTo('#chat_wrapper');
|
152
|
+
MadChatter.add_channel_actions($channel);
|
153
|
+
}
|
154
|
+
if (channel_id == 'lobby') {
|
155
|
+
$('#users-nav').hide();
|
156
|
+
} else {
|
157
|
+
$('#users-nav').show();
|
158
|
+
}
|
159
|
+
$channel.show();
|
160
|
+
},
|
161
|
+
|
162
|
+
add_channel_actions: function($channel){
|
163
|
+
|
164
|
+
function send_message($input){
|
165
|
+
var message = $input.val(),
|
166
|
+
channel = $input.closest('.channel').attr('data-channel');
|
167
|
+
if ($.trim(message) != '') {
|
168
|
+
MadChatter.send_message(message, channel);
|
169
|
+
$input.val('');
|
170
|
+
}
|
171
|
+
}
|
172
|
+
|
173
|
+
$('.new_message input', $channel).keyup(function(e){
|
174
|
+
if (e.keyCode == 13) { // The enter key.
|
175
|
+
send_message($(this));
|
176
|
+
}
|
177
|
+
});
|
178
|
+
|
179
|
+
$('.new_message .send_message', $channel).on('click', function(e){
|
180
|
+
e.preventDefault();
|
181
|
+
var $input = $(this).closest('.new_message').find('input');
|
182
|
+
send_message($input);
|
183
|
+
});
|
184
|
+
},
|
185
|
+
|
186
|
+
scroll_to_bottom_of_chat: function(channel_id){
|
187
|
+
$('body')[0].scrollTop = $(document).height();
|
188
|
+
},
|
189
|
+
|
190
|
+
send_message: function(message, channel){
|
191
|
+
if (message == '/clear') {
|
192
|
+
MadChatter.clear_messages();
|
193
|
+
} else {
|
194
|
+
var json = {
|
195
|
+
token: MadChatter.token,
|
196
|
+
message: message,
|
197
|
+
channel: channel
|
198
|
+
};
|
199
|
+
MadChatter.ws.send(JSON.stringify(json));
|
200
|
+
}
|
201
|
+
},
|
202
|
+
|
203
|
+
clear_messages: function(channel){
|
204
|
+
$('.channel[data-channel="' + channel + '"] .messages').empty();
|
205
|
+
},
|
206
|
+
|
207
|
+
message_received: function(data){
|
208
|
+
data.type, data.channel, data.username, data.text, data.html, data.growl
|
209
|
+
if (data.type == 'error') {
|
210
|
+
console.log('Client error: ' + data.text)
|
211
|
+
return;
|
212
|
+
}
|
213
|
+
if (data.type == 'token') {
|
214
|
+
MadChatter.token = data.text;
|
215
|
+
return;
|
216
|
+
}
|
217
|
+
if (data.type == 'channels') {
|
218
|
+
MadChatter.update_channels_list(data.json);
|
219
|
+
return;
|
220
|
+
}
|
221
|
+
if (data.type == 'users') {
|
222
|
+
MadChatter.update_users_list(data.channel, data.json);
|
223
|
+
return;
|
224
|
+
}
|
225
|
+
if (data.type == 'status') {
|
226
|
+
MadChatter.display_status(data.channel, data.text);
|
227
|
+
}
|
228
|
+
if (data.type == 'action') {
|
229
|
+
MadChatter.exec_action(data.channel, data.json);
|
230
|
+
}
|
231
|
+
if (data.type == 'message') {
|
232
|
+
MadChatter.display_message(data.channel, data.username, data.html);
|
233
|
+
if (typeof(MadChatterGrowl) != 'undefined') {
|
234
|
+
MadChatterGrowl.send_(data.username, data.growl);
|
235
|
+
}
|
236
|
+
}
|
237
|
+
MadChatter.scroll_to_bottom_of_chat();
|
238
|
+
},
|
239
|
+
|
240
|
+
update_channels_list: function(channels){
|
241
|
+
var $list = $('#channels');
|
242
|
+
$list.html('');
|
243
|
+
$.each(channels, function(index, channel) {
|
244
|
+
$list.append('<li><a class="join_channel" href="#" data-channel="' + channel.id + '">' + channel.name + '</a></li>');
|
245
|
+
});
|
246
|
+
},
|
247
|
+
|
248
|
+
update_users_list: function(channel, users){
|
249
|
+
var $list = $('.channel[data-channel="' + channel + '"] ul.users');
|
250
|
+
$list.find('li:not(.nav-header)').remove();
|
251
|
+
$.each(users, function(index, username) {
|
252
|
+
$list.append('<li><span class="username">' + username + '</span></li>');
|
253
|
+
});
|
254
|
+
},
|
255
|
+
|
256
|
+
exec_action: function(channel, action){
|
257
|
+
window[action.function].apply(window, action.args);
|
258
|
+
},
|
259
|
+
|
260
|
+
display_status: function(channel, message){
|
261
|
+
MadChatter.display_time(channel);
|
262
|
+
var $html = $('<p class="status">' + message + '</p>');
|
263
|
+
$('.channel[data-channel="' + channel + '"] .messages').append($html);
|
264
|
+
},
|
265
|
+
|
266
|
+
display_message: function(channel, username, message){
|
267
|
+
MadChatter.display_time(channel);
|
268
|
+
var $html = $('<p class="message"><span class="username">' + username + ':</span> ' + message + '</p>');
|
269
|
+
$('.channel[data-channel="' + channel + '"] .messages').append($html);
|
270
|
+
},
|
271
|
+
|
272
|
+
display_time: function(channel){
|
273
|
+
var last_message_time = MadChatter.last_message_time,
|
274
|
+
current_time = MadChatter.get_current_time();
|
275
|
+
if (last_message_time != current_time) {
|
276
|
+
MadChatter.last_message_time = current_time;
|
277
|
+
$('.channel[data-channel="' + channel + '"] .messages').append('<time>' + current_time + '</time>');
|
278
|
+
}
|
279
|
+
},
|
280
|
+
|
281
|
+
get_current_time: function(){
|
282
|
+
var time = new Date();
|
283
|
+
var hours = time.getHours();
|
284
|
+
var minutes = time.getMinutes();
|
285
|
+
var ampm = 'am';
|
286
|
+
if (hours > 11) { ampm = 'pm'; }
|
287
|
+
if (minutes < 10) { minutes = "0" + minutes; }
|
288
|
+
if (hours == 0) { hours = 12; }
|
289
|
+
if (hours > 12) { hours = hours - 12; }
|
290
|
+
return hours + ':' + minutes + ampm;
|
291
|
+
}
|
292
|
+
};
|
File without changes
|
@@ -0,0 +1,4 @@
|
|
1
|
+
/* SWFObject v2.2 <http://code.google.com/p/swfobject/>
|
2
|
+
is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
|
3
|
+
*/
|
4
|
+
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
|