define("PublicationID", 12); define("PublicationAbbreviation", "bi"); define("PublicationWebsite", "www.bowlsinternational.com");

Issues

Issues

'; // put the toolbar into there (needs language support)... var toolbarHTML = '

More...

' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '1 of '+page+'
'; $(this).prepend(issueListHTML+toolbarHTML); // alert($(this).data('pubData').pubID); // navigation links $(this).find('.toolbar button, .toolbar input').click(function() { var action = $(this).attr('id'); var $thisDiv = $(this).closest('div'); if(action=="optionBack" || action=="optionFuture") { $thisDiv.find('#Page').text(1); } else { var Page = $thisDiv.find('#Page').text(); Page = +(Page); switch(action) { case 'optionFirst': $thisDiv.find('#Page').text(1); break; case 'optionLast': $thisDiv.find('#Page').text($thisDiv.find('#Pages').text()); break; case 'optionNext': $thisDiv.find('#Page').text(Page+1); break; case 'optionPrevious': $thisDiv.find('#Page').text(Page-1); break; } } $(this).blur(); $thisDiv.getIssueList(); $('html, body').animate({ scrollTop: $('#issuesList').offset().top - 50 }, 'slow'); // $('#issuesList').issueList(pubID, Page, direction) }); $(this).getIssueList(); }); }; $.fn.getIssueList = function() { // showWaitingDiv(); // central maggie function. Need to make central across all sites return $(this).each(function() { var pubID = $(this).data("pubData").pubID; var itemsPerPage = $(this).data("pubData").itemsPerPage; var isMaggie = $(this).data("pubData").isMaggie; var catID = $(this).data("pubData").catID; var page = $(this).find('#Page').text(); var direction = $(this).find('input[name=radio]:checked').val(); var $thisDiv = $(this); $.getJSON("https://content.keypublishing.com/central/scripts/json/issue_list.asp?callBack=?", { PubID: pubID, direction: direction, itemsPerPage: itemsPerPage, Page: page, catID: catID, coverSize: 'medium' }, function(data) { var Page = data.Page; var Pages = data.Pages; var isPublic = data.isPublic; var isOnShop = data.isOnShop; var isOnline = data.isOnline; var titleHTML = (direction=="back")? "Back Issues" : "Future Issues"; titleHTML = '

'+titleHTML+'

'; var thisHTML = titleHTML; if(!isPublic) { return; } // cycle through all entries in the returned issues array $.each(data.Issues, function(index, value) { var thisEntry = ""; var ID = value.ID; var viewURL = '/index.php/view-issue/?issueID='+ID; if(isMaggie) { viewURL = '/view_issue.asp?ID='+ID; } var viewLink = ''; // title var Title = value.Title; if(value.SubTitle) { Title+=" - "+value.SubTitle; } if(index==0 && Page==1 && direction=="back") { Title+= " - "+data.phraseCurrentIssue; } Title='

'+viewLink+Title+'

'; // cover var coverFilename = value.CoverFilename; if(coverFilename) { // coverFilename=viewLink+''; coverFilename='
'+viewLink+'
'; } // short description var shortDescription = value.ShortDescription; if(shortDescription) { shortDescription = shortDescription.replace(/</gi,""); shortDescription = '

'+viewLink+shortDescription+'

'; } // shop link /* var shopText = "" if(isOnShop) { if(direction=="back") { if(value.ShopURL) { var linkText="Buy Online"; if(value.soldOut) { linkText="Sold Out"; } shopText = ''+linkText+''; } } else { if(value.DateOnSale) { shopText = 'Available from '+value.DateOnSale+''; } } if(shopText) { shopText='

'+shopText+'

'; } } */ shopText = ''+data.phraseViewMore+''; // online issue var onlineText = "" if(isOnline && value.onlineUploaded && direction!="future") { onlineText='

'+data.phraseReadOnline+'

'; } // concatenate all content & add to overall html thisHTML+=coverFilename+Title+shortDescription+shopText+onlineText+'
'; }); // sort out the toolbar. Needs updating to cope with multiple toolbars, and streamlining the jquery var $toolbar = $thisDiv.find(".toolbar"); $toolbar.find('#Page').text(Page); $toolbar.find('#Pages').text(Pages); var backDisabled=false; var forwardDisabled=false; if(Page=Pages) { forwardDisabled=true; } $toolbar.find('#optionFirst').prop('disabled', backDisabled); $toolbar.find('#optionPrevious').prop('disabled', backDisabled); $toolbar.find('#optionLast').prop('disabled', forwardDisabled); $toolbar.find('#optionNext').prop('disabled', forwardDisabled); // put the html on the page $thisDiv.children('.issueListDiv').html(thisHTML); // hideWaitingDiv(); }); }); }; })( jQuery ); jQuery(document).ready(function($) { var pubID = 12; var page = getQuerystring("Page", 1); var direction = getQuerystring("direction", "back"); var itemsPerPage = getQuerystring("itemsPerPage", 5); $('#issuesList') .issueList(pubID, page, direction, itemsPerPage); }); // this should be put in a central functions area function getQuerystring(key, default_) { if (default_==null) default_=""; key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regex = new RegExp("[\\?&]"+key+"=([^]*)"); var qs = regex.exec(window.location.href); if(qs == null) return default_; else return qs[1]; } //});