From: Darren Date: Fri, 26 Aug 2011 15:59:55 +0000 (+0100) Subject: Initial Utilityview (iframe) window X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1bb74900c110404c3b3860f4ccd3598bc4c9a90d;p=KiwiIRC.git Initial Utilityview (iframe) window --- diff --git a/js/front.js b/js/front.js index 7a632a1..a90dc78 100644 --- a/js/front.js +++ b/js/front.js @@ -1042,6 +1042,96 @@ var front = { +/* + * MISC VIEW + */ + +var Utilityview = function (name, src) { + + var tmp_divname = 'kiwi_window_' + name; + var tmp_userlistname = 'kiwi_userlist_' + name; + var tmp_tabname = 'kiwi_tab_' + name; + + this.name = name; + + if (!front.tabviewExists(name)) { + $('#kiwi .windows .scroller').append('
'); + $('#kiwi .windowlist ul').append('
  • ' + name + '
  • '); + } + + this.div = $('#' + tmp_divname); + this.div.css('overflow', 'hidden'); + + this.tab = $('#' + tmp_tabname); + + this.iframe = $(''); + if(src) this.iframe.attr('src', src); + this.div.append(this.iframe); + + front.tabviews[name.toLowerCase()] = this; +}; + +Utilityview.prototype.name = null; +Utilityview.prototype.div = null; +Utilityview.prototype.tab = null; +Utilityview.prototype.iframe = null; +Utilityview.prototype.show = function () { + $('#kiwi .messages').removeClass("active"); + $('#kiwi .userlist ul').removeClass("active"); + $('#kiwi .windowlist ul li').removeClass("active"); + + $('#windows').css('overflow-y', 'hidden'); + + // Activate this tab! + this.div.addClass('active'); + this.tab.addClass('active'); + + this.addPartImage(); + + front.setTopicText(' '); + front.cur_channel = this; + + // If we're using fancy scrolling, refresh it + if (touch_scroll) { + touch_scroll.refresh(); + } +} + +Utilityview.prototype.close = function () { + this.div.remove(); + this.tab.remove(); + + if (front.cur_channel === this) { + front.tabviews.server.show(); + } + delete front.tabviews[this.name.toLowerCase()]; +}; + +Utilityview.prototype.addPartImage = function () { + this.clearPartImage(); + + // We can't close this tab, so don't have the close image + if (this.name === 'server') { + return; + } + + var del_html = ''; + this.tab.append(del_html); + + $('.tab_part', this.tab).click(function () { + if (front.cur_channel.name !== 'server') { + front.cur_channel.close(); + } + }); +}; + +Utilityview.prototype.clearPartImage = function () { + $('#kiwi .windowlist .tab_part').remove(); +}; + + + + /* * @@ -1063,12 +1153,13 @@ Tabview.prototype.show = function () { $('#kiwi .userlist ul').removeClass("active"); $('#kiwi .windowlist ul li').removeClass("active"); + $('#windows').css('overflow-y', 'scroll'); + // Activate this tab! this.div.addClass('active'); this.userlist.addClass('active'); this.tab.addClass('active'); - document.tmp = this.div; // Add the part image to the tab this.addPartImage();