Tweak Java script to habdle new JSON path

This commit is contained in:
Wesley Moore 2010-03-10 19:55:36 +11:00
parent d238dfe415
commit a53a83844e

View file

@ -12,6 +12,8 @@ var WezM = {
if(navigator.userAgent.toLowerCase().indexOf('webkit') >= 0) { if(navigator.userAgent.toLowerCase().indexOf('webkit') >= 0) {
$('#search input').css('paddingTop', 0); $('#search input').css('paddingTop', 0);
} }
// The following should be triggered onchange for the input as well
// (to handle things like Cut with the mouse)
$('#search input').keyup(function(e) { $('#search input').keyup(function(e) {
var input = $(this); var input = $(this);
var clear_search = $('#search .clear'); var clear_search = $('#search .clear');
@ -52,9 +54,9 @@ var WezM = {
}, },
loadArticles: function(callback) { loadArticles: function(callback) {
if(!this.articles) { if(!this.articles) {
var path = 'json/articles.json'; var path = 'articles.json';
if(document.location.pathname.match(/page\/$/)) { if(document.location.pathname.match(/page\/$/)) {
path = '../json/articles.json'; path = '../articles.json';
} }
jQuery.getJSON(path, {}, function(data) { jQuery.getJSON(path, {}, function(data) {
WezM.articles = data; WezM.articles = data;