User:Cygnis insignis/works.js

var specialFormats = (function {	var chapterof = function(page) {		// the actual page numbers (not DjVu page numbers) on which each chapter starts - set offset in work		var chapterpages = [161,183,197,221];		var chapter=0;		for (var num in chapterpages) {			if (chapterpages[num]>page)				return chapter;			else				chapter++;		}		return chapter;	};	var pagenum = (function { var m = /\.djvu\/([0-9]+)&action=edit/g.exec(location.href); if (m===null) return null; return parseInt(m[1], 10); });	// convenience function for converting to roman numerals	var roman = function(number) {		var values = {m:1000, cm:900, d:500, cd:400, c:100, xc:90, l:50, xl:40, x:10, ix:9, v:5, iv:4, i:1};		var romanexpr = '';		var value;		for (value in values) {			while (number >= values[value] ) {				romanexpr = romanexpr + value;				number = number - values[value];			}		}		return romanexpr;	};	return [		// add as many as you like...		// format is ["url to match", "even numbered /pages", "odd numbered /pages", "footer if no ref", "footer if ref"]		[			"Eminent_",			"",			"",			"",			""		],		[			"_Folk-Lore_Journal_",			"",			"",			"",			""		],		[			"_A_Quarterly_Review",			"",			"",			"",			""		],		[			"Perrault,_Robinson",			"Old-Time Stories",			"The Friendly Frog",			""+(pagenum-32)+"",			""		],		[			"Magyars",			"",			"",			"",			""		],		[			"The_fairy_tales_of_Hans_Christian_Andersen",			"", "",			"",			""		],		[			"_Tegner", "\n", "\n", "",			""		],		[			"_Craigie", "",			"",			"",			""		],		[			"Walker", "",			"",			"",			""		]	];	// format is ["url to match", "even numbered /pages", "odd numbered /pages", "footer if no ref", "footer if ref"] });