From: Jason Skomorowski Date: Wed, 19 Jan 2011 00:59:14 +0000 (+0100) Subject: Attempt at detail bookmarking. Also theme cleanup. X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=af0fd36a81cdfb1dd5fbe480765440a54db8891b;p=mkdru-moved-to-drupal.org.git Attempt at detail bookmarking. Also theme cleanup. --- diff --git a/mkdru.client.js b/mkdru.client.js index a672f21..abca5b8 100644 --- a/mkdru.client.js +++ b/mkdru.client.js @@ -18,7 +18,8 @@ var mkdru = { perpage: 20, sort: 'relevance', filter: null, - query:null + query:null, + recid:null, }, state: {} }; @@ -34,7 +35,11 @@ if (!$.isArray) $.isArray = function(obj) { // pz2.js event handlers: mkdru.pz2Init = function () { - if (mkdru.state.query) mkdru.triggerSearch(); + if (mkdru.state.recid) { + mkdru.pz2.record(mkdru.state.recid); + } else if (mkdru.state.query) { + mkdru.triggerSearch(); + } //mkdru.pz2.stat(); //mkdru.pz2.bytarget(); }; @@ -164,14 +169,13 @@ mkdru.uiFromState = function () { }; mkdru.hashChange = function () { - var hash = $.deparam.fragment(); + mkdru.stateFromHash(); // Request for details - if (typeof(hash.recid) !== "undefined") { - mkdru.pz2.record(hash.recid); + if (mkdru.state.recid) { + mkdru.pz2.record(mkdru.state.recid); } // Other internal link else { - mkdru.stateFromObject($.deparam.fragment()); mkdru.pz2.showPage(mkdru.state.page-1); $('.mkdru-detail').hide(); $('.mkdru-results').show(); @@ -264,11 +268,6 @@ mkdru.resetPage = function () { mkdru.totalRec = 0; }; -mkdru.showPage = function (pageNum) { - mkdru.state.page = pageNum; - mkdru.pz2.showPage(pageNum-1); -}; - // wait until the DOM is ready, bind events @@ -305,7 +304,9 @@ $(document).ready(function () { if (mkdru.usesessions) { mkdru.pz2.init(); + } else if (mkdru.state.recid) { + mkdru.pz2.record(mkdru.state.recid); } else if (mkdru.state.query) { - mkdru.triggerSearch(); + mkdru.triggerSearch(); } }); diff --git a/mkdru.css b/mkdru.css index 75321b4..ea64f66 100644 --- a/mkdru.css +++ b/mkdru.css @@ -39,4 +39,8 @@ .mkdru-detail { display: none; +} + +.mkdru-detail tr.even, tr.odd, tbody th { + border-style: none !important; } \ No newline at end of file diff --git a/mkdru.theme.js b/mkdru.theme.js index 7e660f6..6f77dda 100644 --- a/mkdru.theme.js +++ b/mkdru.theme.js @@ -18,27 +18,35 @@ Drupal.theme.prototype.mkdruResult = function(hit, num, detailLink) { }; Drupal.theme.prototype.mkdruDetail = function(data) { - var html = ''; + var html = '
'; if (data["md-title"] != undefined) { - html += ''; + html += ''; } if (data["md-date"] != undefined) - html += ''; + html += ''; if (data["md-author"] != undefined) - html += ''; + html += ''; if (data["md-electronic-url"] != undefined) - html += ''; + html += ''; if (data["location"][0]["md-subject"] != undefined) - html += ''; + html += ''; if (data["location"][0]["@name"] != undefined) - html += ''; + html += ''; html += '
Title: '+data["md-title"]; - if (data["md-title-remainder"] !== undefined) { - html += ' : ' + data["md-title-remainder"] + ' '; - } - if (data["md-title-responsibility"] !== undefined) { - html += ' '+ data["md-title-responsibility"] +''; - } - html += '
' + Drupal.t("Title") + ': ' + + data["md-title"]; + if (data["md-title-remainder"] !== undefined) { + html += ' : ' + data["md-title-remainder"] + ' '; + } + if (data["md-title-responsibility"] !== undefined) { + html += ' '+ data["md-title-responsibility"] +''; + } + html += '
Date: ' + data["md-date"] + '
' + Drupal.t("Date") + ': ' + + data["md-date"] + '
Author: ' + data["md-author"] + '
' + Drupal.t("Author") + ': ' + + data["md-author"] + '
URL: ' + data["md-electronic-url"] + '' + '
URL: ' + + data["md-electronic-url"] + '' + '
Subject: ' + data["location"][0]["md-subject"] + '
' + Drupal.t("Subject") + ': ' + + data["location"][0]["md-subject"] + '
Location: ' + data["location"][0]["@name"] + " (" +data["location"][0]["@id"] + ")" + '
' + Drupal.t("Location") + ': ' + + data["location"][0]["@name"] + " (" + data["location"][0]["@id"] + ")" + + '
'; html += 'Return to result list...'; return html;