-function qlink(loc) {
- if (loc) {
- location.hash = loc;
- } else if (event && event.target) {
- location.href = event.target.href;
- } else {
- // Bogus qlink
- return;
- }
- hashSwitch();
- return false;
-}
-
-function hashSwitch() {
- var m;
- stopTicker();
- if (m = location.search.match(/^\?post\/([^/]+)\/(.+)/)) {
- $('post').show();
- $('post.content').value = '[' + decodeURIComponent(m[1]).replace(']','').replace('[','') + '](' + decodeURIComponent(m[2]) + ')';
- } else if (m = location.hash.match(/^#\/(ref|tag)\/([A-Za-z0-9_-]+)(?:\/p(\d+))?$/)) {
- if (!currentPager || !(currentPager instanceof Tag) || currentPager.type != m[1] || currentPager.tag != m[2])
- currentPager = new Tag(m[1], m[2]);
- currentPager.show();
-
- if (m[3]) {
- var r = parseInt(m[3]);
- currentPager.showPageAt(r);
- } else {
- currentPager.showPageAt(currentPager.itemCount - 1);
- }
- } else if (m = location.hash.match(/^#\/feed(?:\/p(\d+))?$/)) {
- if (loginStatus.loggedIn) {
- if (!currentPager || !(currentPager instanceof Feed) || currentPager.username != loginStatus.username)
- currentPager = new Feed();
- currentPager.show();
- if (m[3]) {
- var r = parseInt(m[3]);
- currentPager.showPageAt(r);
- } else {
- currentPager.showPageAt(currentPager.itemCount - 1);
- }
- } else {
- location.href = baseURL;
- }
- } else if (m = location.hash.match(/^#([A-Za-z0-9_-]+)(?:\/(p)?(\d+))?$/)) {
- if (!currentPager || !(currentPager instanceof User) || currentPager.username != m[1])
- currentPager = new User(m[1]);
- currentPager.show();
- loginStatus.update();
-
- if (m[3]) {
- var r = parseInt(m[3]);
- if (m[2] == 'p') {
- currentPager.showPageAt(r);
- } else {
- currentPager.showRecord(r);
- }
- } else {
- currentPager.reload();
- }
- } else {
- $$('[name=section]').each(function(v) { v.update('Welcome') });
- $('signup').hide();
- items.update();
- items.hide();
- $('newer_link').hide();
- $('older_link').hide();
- $('welcome').show();
- $('rss').hide();
- $('usercontrols').hide();
- loadLatest();
- }
-}
-
-var lastHash;
-function hashCheck() {
- if (location.hash != lastHash) {
- lastHash = location.hash;
- hashSwitch();
- }