'+recentlyViewed[i].editedBy+'';
}
if(recentlyViewed[i].contenttype == "monograph") {
recent_html += subtitle_html;
}
if(recentlyViewed[i].contenttype != "professional") {
if (recentlyViewed[i].author && recentlyViewed[i].contenttype != "catalogue") {
recent_html += '' + recentlyViewed[i].author + '';
}
}
if(recentlyViewed[i].contenttype != "monograph" && recentlyViewed[i].contenttype != "building" && recentlyViewed[i].contenttype != "playtext") {
recent_html += subtitle_html;
}
if (recentlyViewed[i].directedby && recentlyViewed[i].contenttype != "catalogue") {
recent_html += directedby_html;
}
if (recentlyViewed[i].writtenby && recentlyViewed[i].contenttype != "catalogue") {
recent_html += writtenby_html;
}
if (recentlyViewed[i].adaptedBy && recentlyViewed[i].contenttype != "catalogue") {
recent_html += adaptedBy_html;
}
if (recentlyViewed[i].originalAuthor && recentlyViewed[i].contenttype != "catalogue") {
recent_html += originalAuthor_html;
}
if (recentlyViewed[i].translatedBy && recentlyViewed[i].contenttype != "catalogue") {
recent_html += translatedBy_html;
}
if (recentlyViewed[i].editedBy && recentlyViewed[i].contenttype != "catalogue") {
recent_html += editedBy_html;
}
if(recentlyViewed[i].contenttype != "catalogue") {
recent_html += towncity_html;
}
if(recentlyViewed[i].contenttype != "professional") {
if (recentlyViewed[i].publishyeardata && recentlyViewed[i].contenttype != "catalogue") {
recent_html += '
'+recentlyViewed[i].publishyeardata+'';
}
}
if(recentlyViewed[i].contenttype != "professional") {
if (recentlyViewed[i].contentdisplay && recentlyViewed[i].contenttype != "catalogue") {
recent_html += '
'+recentlyViewed[i].contentdisplay + '';
}
}
if(recentlyViewed[i].contenttype === "professional") {
if (recentlyViewed[i].author && recentlyViewed[i].contenttype != "catalogue") {
recent_html += '
' + recentlyViewed[i].author + '';
}
if (recentlyViewed[i].publishyeardata && recentlyViewed[i].contenttype != "catalogue") {
recent_html += '
'+recentlyViewed[i].publishyeardata+'';
}
if (recentlyViewed[i].contentdisplay && recentlyViewed[i].contenttype != "catalogue") {
recent_html += '
'+recentlyViewed[i].contentdisplay + '';
}
}
recent_html += '';
count++;
}
}
}
} else {
recentlyViewed = [];
}
} else {
recentlyViewed = [];
}
if (recent_html != "") {
recent_html = '
Recently Viewed' + recent_html;
}
return recent_html;
} catch (err) {
console.log("Error in getRecentlyViewed function::", err);
}
},
removeExistsRecentlyItem: function(currentUrl) {
try {
var newlist = [];
var recentlyViewed = [];
if(localStorage.getItem('recentlyViewed')){
recentlyViewed=localStorage.getItem('recentlyViewed');
}
if(recentlyViewed.length>0) {
recentlyViewed = $.parseJSON(recentlyViewed);
if ($.isArray(recentlyViewed)) {
for (var i = 0; i < recentlyViewed.length; i++) {
if (recentlyViewed[i].url != currentUrl) {
newlist.push(recentlyViewed[i]);
}
}
}
}
return newlist;
} catch (err) {
console.log("Error in removeExistsRecentlyItem function::", err);
}
},
initPdfViewer: function() {
try {
var hostName = window.location.protocol + '//' + window.location.host;
var screenWidth = $(window).width();
var currentChannel = true;
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || screenWidth <= 1024) {
currentChannel = false;
} else {
currentChannel = true;
}
var iframeHeight = "100%";
if (!currentChannel) {
iframeHeight = "450px";
}
var documentId="%26documentId~b-9781501319723"
var type = "%26type~" + this.type;
var docIdS="%26docIdS~b-9781501319723";
var tocId = "%26tocId~" + ("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId);
if ($('#pdf-name').length > 0) {
var pageNum = window.location.hash;
var destinationPage = "";
var hashPage = "";
var VRmode = "";
if (pageNum && ~pageNum.indexOf("#page-")) {
pageNum = pageNum.split("#page-")[1].trim();
}
var pageRange = $("#pageRange").text();
if (~pageRange.indexOf(":")) {
pageRange = pageRange.split(":")[1].trim();
}
pageRange = pageRange.split("–")[0].trim();
if (pageRange) {
if(pageRange%2 == 1) {
VRmode = "&vrmode=recto";
} else {
VRmode = "&vrmode=verso";
}
if (pageNum) {
destinationPage = parseInt(pageNum) - parseInt(pageRange) + 1;
if(isNaN(destinationPage) || destinationPage <= 0) {
hashPage = "";
} else {
hashPage = "#page="+destinationPage;
}
}
}
var openAcc = $(".open-access").length;
var openAccess = "";
if(openAcc > 0){
openAccess="%26openAccess~true";
} else {
openAccess="%26openAccess~false";
}
var chapterPdfId = "";
if ("b-9781501319723-chapter4" != "" && $('#chapter-pdfId').val() != null) {
if ($('#chapter-pdfId').val().length > 0) {
chapterPdfId = "%26chapterPdfId~" +$('#chapter-pdfId').val().split("pdfs/")[1];
}
}
$('#pdf-content').append('');
this.bindPdfViewerResize();
}
if ($(".pdf-content").length > 0) {
$(".pdf-content").each(function(){
var pdfFileName = $(this).find(".pdf-file-name").val();
var pdfName = ~pdfFileName.indexOf("/")?pdfFileName.split("/")[1]:pdfFileName;
var chapterPdfId = "%26chapterPdfId~" + pdfName;
if (pdfFileName) {
$(this).append('');
}
});
}
} catch (err) {
console.log("Error in initPdfViewer function::", err);
}
},
initWordViewer: function() {
try {
var hostName = window.location.protocol + '//' + window.location.host;
var screenWidth = $(window).width();
var currentChannel = true;
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || screenWidth <= 1024) {
currentChannel = false;
} else {
currentChannel = true;
}
var iframeHeight = "600px";
if (!currentChannel) {
iframeHeight = "450px";
}
if ($(".word-content").length > 0) {
$(".word-content").each(function(){
var docName = $(this).find(".word-file-name").val();
var id = ~docName.indexOf("/")?docName.split("/")[1]:docName;
//var documentUrl = "https://res.cloudinary.com/bloomsbury-publishing-public/raw/upload/fbl/9781501359484/9781501359484_document_15.doc";
var documentUrl = hostName + "/app/getdoc?id=" + id + "%26documentId=b-9781501319723";
$(this).append('');
});
}
} catch (err) {
console.log("Error in initWordViewer function::", err);
}
},
setTitle: function() {
try {
if (document.title.trim() == (this.dispName + " - ") || document.title.trim() == "" ||
document.title.trim() ==this.dispName) {
document.title = this.dispName + " - " + this.title.text();
}
} catch (err) {
console.log("Error in setTitle function::", err);
}
},
setLoginLink: function() {
try {
var redirectUrl = "login?recentUrl=/monograph-detail?docid=b-9781501319723&tocid=b-9781501319723-chapter4";
this.login.attr('href', redirectUrl);
} catch (err) {
console.log("Error in setLoginLink function::", err);
}
},
saveClipMethod: function(url, name) {
try {
if(url.length>0) {
var title = $("#title").text() || $("#title").val();
var params = {titleclip:name,url:url,contentType:"monograph",actionType:"save",titlepage: title,productname:"collections",accountid:"$accountId"};
showProgress();
var isFullScreen = document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement;
if (isFullScreen) {
$('#fullscreen-clip-save-modal').modal('hide');
}else{
$('#clip-save-modal').modal('hide');
}
$.ajax({
url: "/app/saveDBClip",
type: "GET",
data: params,
success: function(response) {
setTimeout(function(){
if (isFullScreen) {
$(".vua-generate-url-container").append($("#fullscreen-clip-save-success").clone());
$("#fullscreen-clip-save-success").modal('show');
hideProgress();
}else{
$('.vua-close-button').click();
$('.vua-clip-button').click();
$('#clip-save-success').modal('show');
hideProgress();
}
}, 300);
},
error: function(xhr) {
hideProgress();
}
});
}
} catch (err) {
console.log("Error in saveClipMethod function::", err);
}
},
sendCounterData: function(dynamic, opts) {
try {
var platform = ('Bloomsbury Collections').split("~!").join("'");
var database = ('Film & Media Studies 2018').split("~!").join("'");
var cdt = 'chapter';
var yop = "";
var pname = "";
var ctdoi = "";
var ctisbn = "";
var title = "";
var accesstype = 'controlled';
if ($("#freeContent_Id").length > 0) {
accesstype = 'Free_To_View';
}
if ($("#openAccess_Id").length > 0) {
accesstype = 'Open';
}
var platformData = {datatype: 'PLATFORM', title: platform, itemtype: 'RECORD_VIEW', articleversion: 'vor', accesstype: accesstype, accessmethod: 'regular', sectiontype: cdt};
var databaseData = {datatype: 'DATABASE', title: database, itemtype: 'RECORD_VIEW', articleversion: 'vor', accesstype: accesstype, accessmethod: 'regular', sectiontype: cdt};
var titleData = {accesstype: accesstype, accessmethod: 'regular'};
titleData.datatype = "BOOK_ARTICLE";
if (titleData.datatype == "OTHER") {
titleData.datatype = "BOOK";
titleData.fsdatatype = "OTHER";
}
titleData.itemtype = "FT_HTML";
titleData.sectiontype = "chapter";
if ($("#counter-contenttype").length > 0) {
if($("#counter-contenttype").val() == "article") {
titleData.sectiontype = "article";
} else if($("#counter-contenttype").val() == "reference" || $("#counter-contenttype").val() == "monograph" || $("#counter-contenttype").val() == "monographAsReference") {
titleData.sectiontype = "chapter";
} else {
titleData.sectiontype = "chapter";
}
}
if ($("#isbn-squid").length > 0) {
ctisbn = $("#isbn-squid").val();
}
if ($("#doi-squid").length > 0) {
ctdoi = $("#doi-squid").val();
}
if ($("#pubname-squid").length > 0) {
pname = $("#pubname-squid").val();
}
if ($("#pubdate-squid").length > 0) {
yop = $("#pubdate-squid").val();
yop = yop.split("-")[0];
yop = yop.match(/\d+/g)?yop.match(/\d+/g)[0]:"";
}
if ($(".counter-author").length > 0) {
var counterAuthor = "";
$(".counter-author").each(function(){
author+= "Author|"+$.trim($(this).val())+"|";
});
}
if ($("#book-title-squid").length > 0) {
title = $.trim($("#book-title-squid").val());
}
title = $.trim($("#chapter-title-squid").val());
if (yop) {
platformData.yop = yop;
databaseData.yop = yop;
titleData.yop = yop;
}
if (pname) {
platformData.publisherid = pname;
databaseData.publisherid = pname;
titleData.publisher = pname;
}
if (counterAuthor) {
platformData.contributor = counterAuthor;
databaseData.contributor = counterAuthor;
}
if (title) {
titleData.title = title;
}
if (ctdoi) {
titleData.doi = ctdoi;
titleData.fsdoi = ctdoi;
}
if (ctisbn) {
titleData.isbn = ctisbn;
}
var counterData = [];
if (!dynamic) {
if ($.cookie('searchitemflag') == "true") {
_$tarQ.push(['track', {datatype: 'PLATFORM', title: platform, itemtype: 'RESULT_CLICK'}]);
counterData.push({datatype: 'PLATFORM', title: platform, itemtype: 'RESULT_CLICK'});
_$tarQ.push(['track', {datatype: 'DATABASE', title: database, itemtype: 'RESULT_CLICK'}]);
counterData.push({datatype: 'DATABASE', title: database, itemtype: 'RESULT_CLICK'});
$.cookie('searchitemflag', 'false');
}
}
if (dynamic && opts) {
for (member in opts) {
titleData[member] = opts[member];
}
}
if ($('.conent_locked:visible').length > 0) {
titleData.itemtype = "NO_LICENSE";
databaseData.itemtype = "NO_LICENSE";
databaseData.contentdatatype = titleData.datatype;
_$tarQ.push(['track', databaseData]);
if (titleData.hasOwnProperty("title")){
_$tarQ.push(['track', titleData]);
counterData.push(titleData);
}
} else {
titleData.dbtitle = database;
if(!dynamic) {
_$tarQ.push(['track', platformData]);
counterData.push(platformData);
_$tarQ.push(['track', databaseData]);
counterData.push(databaseData);
}
if (titleData.hasOwnProperty("title")){
_$tarQ.push(['track', titleData]);
counterData.push(titleData);
}
}
if (counterData.length > 0) {
sendCounterBackendLog(counterData);
}
} catch (err) {
console.log("Error in sendCounterData function::", err);
}
},
sendSquidData: function() {
try {
var siteId = 'bb01';
sqtrkq.push(['wid', siteId]);
var u = new URI(document.location.href);
sqtrkq.push(['dom', '.' + u.domain()]);
var squidObj = {};
var cid = '';
var citid = '';
var mpid = '';
var mpna = '';
var mpa = 'Content';
var mut = 'Page';
var citna = '';
var ctdoi = '';
var ctisbn = '';
var cstid = '';
var ctid = 'monograph';
var cpna = '';
var ciyop = '';
var cau = '';
mpid = 'collections';
mpna = 'Bloomsbury Collections';
cid = 'b-9781501319723';
citid = 'b-9781501319723-chapter4';
var cdid = 'filmMediastudies2018';
var cdna = ('Film & Media Studies 2018').split("~!").join("'");
var ccid;
var ccna;
var cdt = 'Full-Text HTML';
var cna = "";
var ctna = "";
var citna = "";
if ($("#book-title-squid").length > 0) {
cna = $("#book-title-squid").val().trim();
ctna = $("#book-title-squid").val().trim();
}
if ($("#chapter-title-squid").length > 0) {
citna = $("#chapter-title-squid").val().trim();
}
if ($("#isbn-squid").length > 0) {
ctisbn = $("#isbn-squid").val();
}
if ($("#doi-squid").length > 0) {
ctdoi = $("#doi-squid").val();
}
if ($("#section-squid").length > 0) {
cstid = $("#section-squid").val();
if (cstid == "Image Work") {
ctid = "Image Collection";
}
}
if ($("#pubname-squid").length > 0) {
cpna = $("#pubname-squid").val();
}
if ($("#pubdate-squid").length > 0) {
ciyop = $("#pubdate-squid").val();
}
if ($("#squid-author").length > 0 && $("#squid-author").val()) {
cau = $("#squid-author").val().trim();
}
if ($("#parentid-squid").length > 0 && $("#parentid-squid").val()) {
cid = $("#parentid-squid").val().trim();
}
if ($("#childid-squid").length > 0 && $("#childid-squid").val()) {
citid = $("#childid-squid").val().trim();
}
if (cid) {
squidObj.cid = cid;
}
if (citid) {
squidObj.citid = citid;
}
if (ctid) {
squidObj.ctid = ctid;
}
if(cdid) {
squidObj.cdid = cdid;
}
if(ccid) {
squidObj.ccid = ccid;
}
if(cdna) {
squidObj.cdna = cdna;
}
if(ccna) {
squidObj.ccna = ccna;
}
if(cdt) {
squidObj.cdt = cdt;
}
if(cna) {
squidObj.cna = cna;
}
if(ctna) {
squidObj.ctna = ctna;
}
if(citna) {
squidObj.citna = citna;
}
if (mpid) {
squidObj.mpid = mpid;
}
if (mpna) {
squidObj.mpna = mpna;
}
if (mpa) {
squidObj.mpa = mpa;
}
if (mut) {
squidObj.mut = mut;
}
if(ctdoi) {
squidObj.ctdoi = ctdoi;
}
if(citna) {
squidObj.citna = citna;
}
if(cstid) {
squidObj.cstid = cstid;
}
if(ctisbn) {
squidObj.ctisbn = ctisbn;
}
if(cpna) {
squidObj.cpna = cpna;
}
if(ciyop) {
squidObj.ciyop = ciyop;
}
if(cau) {
squidObj.cau = cau;
}
if (citid) {
squidObj.ctu = "no_licence";
}
var squidTrack = $.cookie("squidtrack");
if (squidTrack == "false") {
$.cookie("squidtrack", "true");
} else {
sqtrkq.push(['ext', encodeURIComponent(JSON.stringify(squidObj))]);
sqtrkq.push(['post', true]);
sqtrkq.push(['track']);
}
window.squidObj = squidObj;
} catch (err) {
console.log("Error in sendSquidData function::", err);
}
},
goToPageClick: function() {
try {
if(!$(this).hasClass('disabled-btn')){
if(!$(this).hasClass('goto_pageguest')) {
gotoPageNo();
} else {
$('#subscription-modal').modal('show');
}
}
} catch (err) {
console.log("Error in goToPageClick function::", err);
}
},
goToPageKeyUp: function(e) {
try {
if ($(this).val().trim().length > 0) {
$("#goto_pagenobtn").removeClass("disabled-btn");
}
$(this).css('border', 'solid #ccc 1px');
$("#go-to-error-msg").remove();
if(!$("#goto_pagenobtn").hasClass('disabled-btn')) {
if (e.keyCode == 13) {
if(!$('#goto_pagenobtn').hasClass('goto_pageguest')) {
gotoPageNo();
} else {
$('#subscription-modal').modal('show');
}
}
}
} catch (err) {
console.log("Error in goToPageKeyUp function::", err);
}
},
loadStarJS: function () {
try {
var stars = document.createElement('script');
stars.type = 'text/javascript';
stars.async = true;
stars.src = 'https://receiver.star.saas.semcs.net/star.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(stars, s);
} catch (err) {
console.log("Error in loadStarJS function::", err);
}
},
initAuthorBioPopup: function() {
try {
$('.popper').popover({
placement: 'top',
container: 'body',
trigger: 'manual',
html: true,
content: function () {
return $(this).next('.popper-content').length>0?$(this).next('.popper-content').html():$(this).parent().next('.popper-content').html();
}
}).off('keyup click').on('keyup click', function(e){
if (e.keyCode == 13) {
$('this').trigger('click');
} else if (e.type == "click") {
e.stopPropagation();
$('.popper').popover('hide');
$(this).popover('toggle');
}
});
} catch (err) {
console.log("Error in initAuthorBioPopup function::", err);
}
},
initThumbPopup: function() {
try {
$('.thumb-popper').popover({
placement: 'top',
container: 'body',
trigger: 'manual',
html: true,
content: function () {
return '
'+$(this).attr("img")+'
'+$(this).attr("title")+'';
}
}).on('mouseover mouseout', function(e){
$(this).popover('toggle');
});
} catch (err) {
console.log("Error in initThumbPopup function::", err);
}
},
initGlossaryPopup: function() {
try {
$('.article-popper').popover({
placement: 'top',
container: 'body',
trigger: 'manual',
html: true,
content: function () {
return $('.popper-content[id="'+$(this).attr('popover-id')+'"]').html().replaceAll("dd>", "div>").replaceAll(" -1 || currDownloadTime[i].indexOf('UTC') > -1) {
GMTIndex = i;
}
if (currDownloadTime[i].indexOf('(') > -1) {
currDownloadTime[i] = currDownloadTime[i].split('(')[1];
}
if (currDownloadTime[i].indexOf(')') > -1) {
currDownloadTime[i] = currDownloadTime[i].split(')')[0];
}
}
if (GMTIndex !== undefined) {
currDownloadTime.splice(GMTIndex, 1);
}
currDownloadTime = currDownloadTime.join(' ');
if ($('#selected-image-url').length > 0) {
currentImg = $('#selected-image-url').val();
} else if($('#coverImageUrl').length>0){
currentImg = $('#coverImageUrl').attr('src') || $('#coverImageUrl').val();
} else if($('#coverImage').length>0){
currentImg = $('#coverImage').attr('src') || $('#coverImage').val();
}
if(~currentImg.indexOf('?id=')) {
currentImg = currentImg.split('?id=')[1];
}
var param='';
var isCitationExist='';
if(doctype =="article") {
}
if (doctype == "audio") {
param = "type=" + doctype + "&xmlPath=" + "collections/57/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-download.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BBY_Collections_420x75_COLOUR.png" + "&mlaCitation=" + "&lang=" + lang + "&documentId=" + "b-9781501319723" + "¤tTime=" + currDownloadTime + "&tocId=" + ("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname +"¤tImg=" + currentImg + "&cachepagetype=" + "monodet";
} else if(doctype == "catalogue"){
param = "type=" + doctype + "&xmlPath=" + "collections/57/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-download.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BBY_Collections_420x75_COLOUR.png" + "&mlaCitation=" + "&lang=" + lang + "&documentId=" + "b-9781501319723" + "¤tTime=" + currDownloadTime + "&tocId=" + ("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname +"¤tImg=" + currentImg + "&cachepagetype=" + "monodet"+"&taxonomyLoc=" + "collections/57/content-types/taxonomy/taxonomy.xml";
} else if (doctype == "video") {
param = "type=" + doctype + "&xmlPath=" + "collections/57/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-download.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BBY_Collections_420x75_COLOUR.png" + "&mlaCitation=" + "&lang=" + lang + "&documentId=" + "b-9781501319723" + "¤tTime=" + currDownloadTime + "&tocId=" + ("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname +"¤tImg=" + currentImg + "&cachepagetype=" + "monodet";
} else if (doctype == "image") {
isCitationExist = true;
param = "type=" + doctype + "&xmlPath=" + "collections/57/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-download.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BBY_Collections_420x75_COLOUR.png" + "&mlaCitation=" + "&lang=" + lang + "&documentId=" + "b-9781501319723" + "¤tTime=" + currDownloadTime + "&tocId=" + ("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname +"¤tImg=" + currentImg+ "&citationExist=" + isCitationExist + "&cachepagetype=" + "monodet";
} else if (doctype == "da-volume" || doctype == "archive" || doctype == "da-volume-part") {
param = "type=" + doctype + "&xmlPath=" + "collections/57/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-download.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BBY_Collections_420x75_COLOUR.png" + "&mlaCitation=" + "&lang=" + lang + "&documentId=" + documentId + "¤tTime=" + currDownloadTime + "&tocId=" + ("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname + "&workloc=" + "$workLoc"+"&productVersion=" + 57 + "&taxonomyLoc=" + "collections/57/content-types/taxonomy/taxonomy.xml" + "&citationExist=" + isCitationExist + "&territory=" + "" + "&cachepagetype=" + "monodet" + "¤tImg=" + currentImg;
} else if (doctype == "screenplay" || doctype == "playtext") {
isCitationExist = true;
param = "type=" + doctype + "&xmlPath=" + "collections/57/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-download.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BBY_Collections_420x75_COLOUR.png" + "&mlaCitation=" + "&lang=" + lang + "&documentId=" + documentId + "¤tTime=" + currDownloadTime + "&tocId=" + ("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname + "&workloc=" + "$workLoc"+"&productVersion=" + 57 + "&taxonomyLoc=" + "collections/57/content-types/taxonomy/taxonomy.xml" + "&citationExist=" + isCitationExist + "&territory=" + "" + "&cachepagetype=" + "monodet";
var playtextPage = "$playtextPage";
if ( playtextPage == "playtext-detail"){
param += "&actId=" + "$actId";
}
} else {
isCitationExist = true;
param = "type=" + doctype + "&xmlPath=" + "collections/57/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-download.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BBY_Collections_420x75_COLOUR.png" + "&mlaCitation=" + "&lang=" + lang + "&documentId=" + "b-9781501319723" + "¤tTime=" + currDownloadTime + "&tocId=" + ("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname + "&citationExist=" + isCitationExist + "&workloc=" + "$workPath" +"&territory=" + "" + "&cachepagetype=" + "monodet";
}
if ($('#pdf-name').length > 0) {
param+="&pdfUrl=/content-types/pdf"+"/"+$('#pdf-name').val().split("pdfs/")[1]+"&pdfId=/"+$('#pdf-name').val().split("pdfs/")[1];
}
if ("b-9781501319723-chapter4" != "" && $('#chapter-pdfId').val() != null) {
if ($('#chapter-pdfId').val().length > 0) {
param += "&chapterPdfId=" +$('#chapter-pdfId').val().split("pdfs/")[1];
}
}
var openAcc = $(".open-access").length;
if ("b-9781501319723-chapter4" != '') {
param += "&tocPage=false";
} else if(openAcc > 0) {
param += "&tocPage=true";
} else {
param += "&tocPage=false";
}
var epdfIsbn = $.trim($("#epdf-isbn-squid").val());
if(epdfIsbn != "false") {
param += "&epdfIsbn="+$("#epdf-isbn-squid").val();
}
param+="&docIdS=b-9781501319723";
var openAcc = $(".open-access").length;
if(openAcc > 0){
param+="&openAccess=true";
} else {
param+="&openAccess=false";
}
if (doctype == "professional") {
param+="&contentType="+doctype+"&taxonomyLoc="+"collections/57/content-types/taxonomy/taxonomy.xml"+"&tocId=" + ("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId);
// param+="&taxonomyLoc="+"collections/57/content-types/taxonomy/taxonomy.xml"+"&tocId=" + ("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId);
}
$("#download").attr('href', '/app/downloadpdf?'+param);
var OS = getMobileOperatingSystem();
if (OS == "iOS") {
$("#download").attr('href', '/app/downloadpdf.pdf?'+param);
}
$("#download").attr('target', '_blank');
$("#download").attr('download', 'b-9781501319723'+'-'+lang+'.pdf');
} catch (err) {
console.log("Error in createPdf function::", err);
}
},
createFrame: function() {
try {
var currentImg = '';
var GMTIndex;
var openAccess= $(".open-access").length > 0? "true":"false";
var currPrintTime = (new Date()).toString().split(' ');
var printType = $('input[name="print-type"]:checked').val();
var selectedImages="";
var docIdF="";
docIdF = "b-9781501319723-chapter4";
if(printType=="range"){
var printFrom = $("#print-from").val();
var printTo = $("#print-to").val();
var imageUrls = $("#buildprevimagelist").val().split("~");
for(var i=printFrom-1; i -1 || currPrintTime[i].indexOf('UTC') > -1) {
GMTIndex = i;
}
if (currPrintTime[i].indexOf('(') > -1) {
currPrintTime[i] = currPrintTime[i].split('(')[1];
}
if (currPrintTime[i].indexOf(')') > -1) {
currPrintTime[i] = currPrintTime[i].split(')')[0];
}
}
if (GMTIndex !== undefined) {
currPrintTime.splice(GMTIndex, 1);
}
currPrintTime = currPrintTime.join(' ');
if ($('#selected-image-url').length > 0) {
currentImg = $('#selected-image-url').val();
if(doctype=="catalogue"){
var index = $('#selected-image-url').attr('data-index');
currentImg = $("#buildprevimagelist").val().split("~")[index];
}
} else if($('#coverImage').length>0){
currentImg = $('#coverImage').attr('src') || $('#coverImage').val();
} else if($('#coverImageUrl').length>0){
currentImg = $('#coverImageUrl').attr('src') || $('#coverImageUrl').val();
}
if(~currentImg.indexOf('?id=')) {
currentImg = currentImg.split('?id=')[1];
}
if (typeof partId !== "undefined") {
if (partId.startsWith("$")) {
partId = "";
}
}
$(".print_page").attr('href', 'javascript:;');
$(".print_page").removeAttr('target');
$(".print_page").removeAttr('download');
var xmlreq = new XMLHttpRequest();
xmlreq.onreadystatechange = function () {
if (xmlreq.readyState == 4 && xmlreq.status == 200) {
//hideProgress();
var response = xmlreq.responseText;
if ($("#pdf-name").length > 0) {
$("#printFrame").remove();
var OS = getMobileOperatingSystem();
if (isIE || isFirefox || OS == "Android" || OS == "iOS") {
param = "type=" + doctype + "&xmlPath=" + "collections/57/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-download.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BBY_Collections_420x75_COLOUR.png" + "&mlaCitation=" + "&lang=" + lang + "&documentId=" + "b-9781501319723" + "¤tTime=" + currPrintTime + "&tocId=" + ("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname + "&citationExist=true" + "&workloc=" + "$workPath" +"&territory=" + "" + "&cachepagetype=" + "monodet" + "&docIdS=b-9781501319723";
param+="&pdfUrl=/content-types/"+doctype+"/"+$('#pdf-name').val()+"&pdfId=/"+$('#pdf-name').val().split("pdfs/")[1];
if ("b-9781501319723-chapter4" != "" && $('#chapter-pdfId').val() != null) {
if ($('#chapter-pdfId').val().length > 0) {
param += "&chapterPdfId=" +$('#chapter-pdfId').val().split("pdfs/")[1];
}
}
var epdfIsbn = $.trim($("#epdf-isbn-squid").val());
if(epdfIsbn != "false") {
param += "&epdfIsbn="+$("#epdf-isbn-squid").val();
}
$(".print_page").attr('href', '/app/downloadpdf?'+param+'&print_page=true');
$(".print_page").attr('target', '_blank');
$(".print_page").attr('download', 'b-9781501319723'+'-'+lang+'.pdf');
if (OS == "Android") {
$(".print_page").attr('download', 'b-9781501319723'+'-'+lang+'.pdf');
} else if (OS == "iOS") {
$(".print_page").attr('href', '/app/downloadpdf.pdf?'+param+'&print_page=true');
}
} else {
var frame1 = document.createElement('iframe');
frame1.name = "frame1";
frame1.id = "printFrame";
frame1.style.position = "absolute";
frame1.style.visibility = "hidden";
frame1.style.display = "none";
frame1.style.top = "-1000000px";
frame1.src = "/app/getpdf?id=/downloads/"+$("#pdf-name").val().split("pdfs/")[1]+"&mode=print";
window.printContents = response;
document.body.appendChild(frame1);
}
} else {
if(xmlreq.responseText.indexOf('MapPlaceHolder') > -1){
response = response.replace('MapPlaceHolder', '