From 604c51743ada77f7cf8d92e314bcf892e8835118 Mon Sep 17 00:00:00 2001 From: Darren Date: Sun, 4 Sep 2011 00:47:57 +0100 Subject: [PATCH] In-browser extracted to it's own plugin. Link colours --- css/default.css | 19 +++++----- js/front.js | 71 ++++++++++--------------------------- js/util.js | 43 ++++++++++++++++++++++ node/app.js | 1 + node/client/index.html.jade | 4 +-- 5 files changed, 76 insertions(+), 62 deletions(-) diff --git a/css/default.css b/css/default.css index bda917a..c700bfc 100644 --- a/css/default.css +++ b/css/default.css @@ -14,6 +14,10 @@ body, html { } #kiwi ul { list-style:none; } +#kiwi a { + color: #36C; text-decoration:none; + cursor: pointer; +} #kiwi #login a { color: #8D9713; text-decoration:none; @@ -45,18 +49,17 @@ body, html { /*height: 35px;*/ } #kiwi .windowlist ul li, #kiwi .utilityviewlist ul li { - float: left; - list-style: inline; - padding:5px; - margin:3px; + float: left; list-style: inline; + display:inline; position:relative; + padding:5px; margin:3px; border: 1px solid #333; background-color: #eee; - display: inline; + + cursor: pointer; + line-height: 1.4em; vertical-align: middle; - position:relative; - border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px; @@ -93,7 +96,7 @@ body, html { #kiwi .userlist ul.active { display:block; } #kiwi .userlist ul li { padding:1px 2px; cursor:pointer; } #kiwi .userlist ul li:hover { background-color:#FAF7D3; } -#kiwi .userlist ul li a.nick { display:block; } +#kiwi .userlist ul li a.nick { display:block; color:black; } #kiwi .userlist ul li .userbox { margin:0px 5px 5px 5px; font-size:.9em; } #kiwi .userlist ul li .userbox a { display:block; text-decoration:none; border-bottom: 1px dashed #aaa; } diff --git a/js/front.js b/js/front.js index 7f46057..c51e5c6 100644 --- a/js/front.js +++ b/js/front.js @@ -6,6 +6,7 @@ var front = { cur_channel: '', windows: {}, tabviews: {}, + utilityviews: {}, boxes: {}, buffer: [], @@ -166,38 +167,6 @@ var front = { front.joinChannel($(this).text()); return false; }); - - $('#windows a.link_ext').live('mouseover', function () { - var a = $(this); - var tt = $('.tt', a); - - if (tt.text() === '') { - var tooltip = $('Open in Kiwi..'); - tt.append(tooltip); - } - - tt.css('top', -tt.outerHeight()+'px'); - tt.css('left', (a.outerWidth() / 2) - (tt.outerWidth() / 2)); - }); - $('#windows a.link_ext').live('mouseout', function () { - var a = $(this); - var tt = $('.tt', a); - }); - $('#windows a.link_ext').live('click', function (e) { - var a = $(this); - - switch (e.target.className) { - case 'link_ext': - case 'link_img_a': - return true; - break; - case 'link_ext_browser': - var t = new Utilityview('Browser', a.attr('href')); - t.show(); - break; - } - return false; - }); }, @@ -1147,36 +1116,34 @@ 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; +var Utilityview = function (name) { + var rand_name = randomString(15); + var tmp_divname = 'kiwi_window_' + rand_name; + var tmp_userlistname = 'kiwi_userlist_' + rand_name; + var tmp_tabname = 'kiwi_tab_' + rand_name; - this.name = name; - this.topic = src; + this.name = rand_name; + this.title = name; + this.topic = ' '; - if (!front.tabviewExists(name)) { - $('#kiwi .windows .scroller').append('
'); - $('#kiwi .utilityviewlist ul').append('
  • ' + name + '
  • '); - } + $('#kiwi .windows .scroller').append('
    '); + + this.tab = $('
  • ' + this.title + '
  • '); + this.tab.click(function(){ + front.utilityviews[rand_name.toLowerCase()].show(); + }); + $('#kiwi .utilityviewlist ul').append(this.tab); 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; + front.utilityviews[rand_name.toLowerCase()] = this; }; Utilityview.prototype.name = null; +Utilityview.prototype.title = null; Utilityview.prototype.div = null; Utilityview.prototype.tab = null; -Utilityview.prototype.iframe = null; Utilityview.prototype.topic = ' '; Utilityview.prototype.show = function () { $('#kiwi .messages').removeClass("active"); @@ -1207,7 +1174,7 @@ Utilityview.prototype.close = function () { if (front.cur_channel === this) { front.tabviews.server.show(); } - delete front.tabviews[this.name.toLowerCase()]; + delete front.utilityviews[this.name.toLowerCase()]; }; Utilityview.prototype.addPartImage = function () { diff --git a/js/util.js b/js/util.js index af68cc4..f186ed9 100644 --- a/js/util.js +++ b/js/util.js @@ -144,6 +144,49 @@ var plugins = [ return event; } + }, + + + { + name: "inBrowser", + oninit: function(event, opts){ + $('#windows a.link_ext').live('mouseover', function () { + var a = $(this); + var tt = $('.tt', a); + + if (tt.text() === '') { + var tooltip = $('Open in Kiwi..'); + tt.append(tooltip); + } + + tt.css('top', -tt.outerHeight()+'px'); + tt.css('left', (a.outerWidth() / 2) - (tt.outerWidth() / 2)); + }); + $('#windows a.link_ext').live('mouseout', function () { + var a = $(this); + var tt = $('.tt', a); + }); + $('#windows a.link_ext').live('click', function (e) { + var a = $(this); + + switch (e.target.className) { + case 'link_ext': + case 'link_img_a': + return true; + break; + case 'link_ext_browser': + var t = new Utilityview('Browser'); + t.topic = a.attr('href'); + + t.iframe = $(''); + t.iframe.attr('src', a.attr('href')); + t.div.append(t.iframe); + t.show(); + break; + } + return false; + }); + } } ]; diff --git a/node/app.js b/node/app.js index 4cf9307..bb581a3 100644 --- a/node/app.js +++ b/node/app.js @@ -828,6 +828,7 @@ this.manageControll = function (data) { case 'cache': if (parts[1] === 'clear') { kiwi.cache.html = {}; + kiwi.cache.alljs = ''; console.log('HTML cache cleared'); } break; diff --git a/node/client/index.html.jade b/node/client/index.html.jade index 12ec9d5..28e1c98 100644 --- a/node/client/index.html.jade +++ b/node/client/index.html.jade @@ -22,7 +22,7 @@ html(xmlns="http://www.w3.org/1999/xhtml", lang="en-gb") //script(type="text/javascript", src="js/front.js") //script(type="text/javascript", src="js/iscroll.js") script(type="text/javascript", src="js/all.js") - script(type="text/javascript", src="js/plugins.js") + //script(type="text/javascript", src="js/plugins.js") - if (touchscreen) script(type="text/javascript", src="js/touchscreen_tweaks.js") @@ -171,7 +171,7 @@ html(xmlns="http://www.w3.org/1999/xhtml", lang="en-gb") div.control div.msginput div.nick - a(href="#") + a | : input(type="text", name="kiwi_msginput", id="kiwi_msginput") div.plugins -- 2.25.1