Created
January 24, 2011 05:46
-
-
Save nathanbrauer/792886 to your computer and use it in GitHub Desktop.
This is all the HTML needed for the basic CSShromium 'window'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul class="window"> | |
<li class="title"><span class="activeTitle">Loading...</span> – CSShromium</li> | |
<li class="page active" data-www="http://www.linkedin.com/in/nathanbrauer" data-hostname="linkedin.com"></li> | |
<li class="page" data-www="http://github.com/HelloLogic" data-hostname="github.com"></li> | |
<li class="page" data-www="http://aext.net/author/nathanbrauer/" data-hostname="aext.net"></li> | |
<li class="menu"><input type="text" value="" disabled="true"/></li> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.reverse = [].reverse; | |
$(function(){ //this is the same as $('body').ready(function(){ ... }); | |
var $pages = $('li.page').reverse(), $title = $('li.title>span.activeTitle'), $www = $('li.menu>input'); | |
// Load the web page's title | |
$pages.each(function(){ | |
var $this = $(this); | |
var $tab = $('<div class="tab"><div class="left"></div><div class="favicon"></div><div class="text">Loading...</div><div class="right"></div></div>').appendTo($this); | |
var webaddress = $this.attr('data-www'); | |
$.get( | |
'/getpagetitle.php', | |
{www:webaddress}, | |
function(data) { | |
$tab.find('div.text').html((data[0] == 'ok') ? data[1] : '[Error]'); | |
if ($this.hasClass('active')) { | |
$title.html(data[1]); | |
$www.val(webaddress); | |
} | |
// Get the favicon | |
$tab.find('div.favicon').css('background-image','url(/gethostfavicon.php?hostname='+$this.attr('data-hostname')+')'); | |
$('<iframe class="content" src="'+webaddress+'"><p>Whoops! You need iFrame support to use this!</p></iframe>').appendTo($this); | |
}, | |
'json' | |
); | |
}); | |
$pages.click(function(){ | |
var $this = $(this); | |
$title.html($this.find('div.tab>div.text').html()); | |
$www.val($this.attr('data-www')); | |
$pages.removeClass('active'); | |
$this.addClass('active'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment