Skip to content

Commit

Permalink
Remove http:// prefix from title, list items.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomimick committed Oct 10, 2013
1 parent 5c40a3c commit 46276a1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
4 changes: 0 additions & 4 deletions bg.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
- starts the viewer tab
*/

String.prototype.startsWith = function(s) {
return this.indexOf(s) === 0;
};

chrome.browserAction.onClicked.addListener(function(tab) {

// start viewer tab
Expand Down
4 changes: 4 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,7 @@ function update_badge(data) {
/* insert JSON encoded reply here for debugging */
var debugdata = null;

String.prototype.startsWith = function(s) {
return this.indexOf(s) === 0;
};

17 changes: 15 additions & 2 deletions maintab.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ function data_received(resp) {
// set badge for this source tab too
update_badge(data);

$("title").text("SRC "+resp.url);
// set title
var url = remove_url_prefix(resp.url);
$("title").text("SRC "+url);

var jscount = resp.js.length;
var csscount = resp.css.length;
Expand Down Expand Up @@ -335,7 +337,7 @@ function add_item(ol, item) {
if (item.src)
s = "<li><a href='"+item.src+"'>"+emphasize_name(item.src);
else if (item.count)
s = "<li><a href='#'>"+data.url;
s = "<li><a href='#'>"+remove_url_prefix(data.url);
else if (item.onclick)
s = "<li><a href='#'>ONCLICK: <span></span>";
else
Expand All @@ -359,6 +361,8 @@ function add_item(ol, item) {

// emphasizes the file name part of the url
function emphasize_name(url) {
url = remove_url_prefix(url);

var len = url.length;
var i = url.lastIndexOf("/");
var s;
Expand Down Expand Up @@ -408,3 +412,12 @@ function calculate_line_count() {
return h/line_height - 1;
}

// removes "http://"
function remove_url_prefix(url) {
if (url.startsWith("http://"))
url = url.substr(7);
else if (url.startsWith("https://"))
url = url.substr(8);
return url;
}

0 comments on commit 46276a1

Please sign in to comment.