GreasemonkeyScriptForSmallTitles: djangoproject-titles.user.js

File djangoproject-titles.user.js, 1014 bytes (added by wam-djangowiki@…, 18 years ago)

Greasemonkey script for title munging of Django website

Line 
1// ==UserScript==
2// @name shorten djangoproject titles 0.1.0
3// @namespace http://wamber.net/
4// @description Shorten the page titles for Django documentation to be more tab friendly
5// @include http://www.djangoproject.com/*
6// @include http://code.djangoproject.com/*
7// @include http://djangoproject.com/*
8// ==/UserScript==
9//
10// William McVey
11// 31 October, 2006
12
13var doc_prefix = "/documentation/"
14var generic_django_prefix = "Django | "
15var path = location.pathname
16if (location.pathname == doc_prefix) {
17 document.title = "doc index"
18} else if (path.substr(0, doc_prefix.length) == doc_prefix) {
19 // URL basename is good enough for the docs
20 if (path.charAt(path.length - 1) == "/") {
21 path = path.substr(0, path.length-1)
22 }
23 document.title = path.substr(doc_prefix.length) + " doc"
24} else if (document.title.substr(0, generic_django_prefix.length)) {
25 // Strip "Django | " from the default title
26 document.title = document.title.substr(generic_django_prefix.length)
27}
Back to Top