PDA

View Full Version : Page title is always "Weasyl" and I can't tell my tabs apart



eriscontrol
11-03-2012, 09:15 PM
As the title says, every page's title is just "Weasyl". It's pretty, but I can't tell tabs apart when I have more than a couple open. At the very least, I'd like to see submission pages to include the submission's title in the page title and user pages to include the username. If the title includes more information like whether you're viewing their submissions gallery, favorites or what, that's even better.

I wrote a user script to work around the problem for now. It's not ideal, but it's better than nothing.


// ==UserScript==
// @name Weasyl Page Titler
// @description Having a hard time telling Weasyl tabs apart? This will help.
// @version 1.0
// @author Eris
// @namespace http://erisdiscord.github.com/
// @match https://www.weasyl.com/*
// ==/UserScript==
var DONE, element, path, transformTitle, tt,
__slice = [].slice;

DONE = {};

transformTitle = function() {
var args, fn, newTitle;
fn = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
newTitle = fn.apply(null, args);
document.title = "" + newTitle + " - " + document.title;
throw DONE;
};

path = function(pattern, fn) {
if (RegExp(pattern).test(location.pathname)) {
return transformTitle(fn);
}
};

element = function(sel, fn) {
var el;
el = document.querySelector(sel);
if (el != null) {
if (fn == null) {
fn = function() {
return tt(el);
};
}
return transformTitle(fn, el);
}
};

tt = function(el) {
if (typeof el === 'string') {
el = document.getElementById(el);
}
return el.innerText.trim();
};

try {
path('^/submissions(/|$)', function() {
return "Submissions gallery for " + (tt('user-id'));
});
path('^/journals(/|$)', function() {
return "Journal entries for " + (tt('user-id'));
});
path('^/collections(/|$)', function() {
return "Collections gallery for " + (tt('user-id'));
});
path('^/shouts(/|$)', function() {
return "Shouts for " + (tt('user-id'));
});
path("^/favorites(/|$)", function() {
return "Favorites gallery for " + (tt('user-id'));
});
path("^/groups(/|$)", function() {
return "Group memberships for " + (tt('user-id'));
});
element('#detail-title', function(el) {
return tt(el);
});
element('#user-id', function(el) {
return tt(el);
});
element('.page-title', function(el) {
return tt(el);
});
} catch (e) {
if (e !== DONE) {
throw e;
}
}

skylerbunny
11-04-2012, 10:20 AM
Started a thread on this in the 'bug' forum last week, since pages already exist and I presumed it's kind of a 'bugfix' issue.

Thread: http://forums.weasyl.com/vbulletin/showthread.php?p=12642