'+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");
} else {
$("#goto_pagenobtn").addClass("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/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-download.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.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/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-download.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.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/40/content-types/taxonomy/taxonomy.xml";
} else if (doctype == "video") {
param = "type=" + doctype + "&xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-download.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.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/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-download.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.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/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-download.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&mlaCitation=" + "&lang=" + lang + "&documentId=" + documentId + "¤tTime=" + currDownloadTime + "&tocId=" + ("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname + "&workloc=" + "$workLoc"+"&productVersion=" + 40 + "&taxonomyLoc=" + "collections/40/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/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-download.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&mlaCitation=" + "&lang=" + lang + "&documentId=" + documentId + "¤tTime=" + currDownloadTime + "&tocId=" + ("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname + "&workloc=" + "$workLoc"+"&productVersion=" + 40 + "&taxonomyLoc=" + "collections/40/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/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-download.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.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/40/content-types/taxonomy/taxonomy.xml"+"&tocId=" + ("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId);
// param+="&taxonomyLoc="+"collections/40/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/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-download.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.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', '' + $('#globalMap').html().split('href=').join('data-href=').split('
0?"/content-types/monograph/monograph-detail-download.xsl":"/content-types/monograph/monograph-detail-print.xsl";
param = "xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + xslPath + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&mlaCitation=" + mlaCitation + "&partId=" + partId + "&lang=" + lang + "¤tImg=" + currentImg + "¤tdate=" + currPrintTime + "&doctype=" + doctype + "&docid=" + documentId + "&tocId=" +"b-9781501319723-chapter4" + "&productName="+ productname + "&productVersion=" + 40 + "&territory=" + "" + "&cachepagetype=" + "monodet";
}
if (doctype == "encyclopedia") {
var xslPath = $("#pdf-name").length>0?"/content-types/monograph/monograph-detail-download.xsl":"/content-types/monograph/monograph-detail-print.xsl";
param = "xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + xslPath + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&hasCitation=" + hasCitation + "&partId=" + partId + "&lang=" + lang + "¤tImg=" + currentImg + "¤tdate=" + currPrintTime + "&doctype="+ doctype + "&docid=" + documentId + "&tocId=" +("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname + "&productVersion=" + 40 + "&territory=" + "" + "&cachepagetype=" + "monodet";
}
if (doctype == "dictionary") {
mlaCitation = encodeURIComponent(mlaCitation);
param = "xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-print.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&mlaCitation=" + mlaCitation + "&partId=" + partId + "&lang=" + lang + "¤tImg=" + currentImg + "¤tdate=" + currPrintTime + "&doctype=dictionary" + "&docid=" + documentId + "&tocId=" +("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname + "&workloc=" + "$dictionaryWork" + "&productVersion=" + 40 + "&territory=" + "" + "&cachepagetype=" + "monodet";
}
if (doctype == "sourcetype") {
param = "xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-print.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&mlaCitation=" + mlaCitation + "&partId=" + partId + "&lang=" + lang + "¤tImg=" + currentImg + "¤tdate=" + currPrintTime + "&doctype=sourcetype" + "&docid=" + documentId + "&tocId=" +("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname + "&productVersion=" + 40 + "&territory=" + "" + "&cachepagetype=" + "monodet";
}
if (doctype == "building") {
mlaCitation = '';
param = "xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-print.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&mlaCitation=" + mlaCitation + "&partId=" + partId + "&lang=" + lang + "¤tImg=" + currentImg + "¤tdate=" + currPrintTime + "&doctype=" + doctype + "&docid=" + documentId + "&tocId=" + "b-9781501319723-chapter4"+"&taxonomyLoc=" + "collections/40/content-types/taxonomy/taxonomy.xml" + "&productName="+ productname + "&productVersion=" + 40 + "&territory=" + "" + "&cachepagetype=" + "monodet";
}
if (doctype == "museum") {
mlaCitation = '';
param = "xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-print.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&mlaCitation=" + mlaCitation + "&partId=" + partId + "&lang=" + lang + "¤tImg=" + currentImg + "¤tdate=" + currPrintTime + "&doctype=" + doctype + "&docid=" + documentId + "&tocId=" + "b-9781501319723-chapter4" + "&taxonomyLoc=" + "collections/40/content-types/taxonomy/taxonomy.xml" + "&productName="+ productname + "&productVersion=" + 40 + "&territory=" + "" + "&cachepagetype=" + "monodet";
}
if (doctype == "imagecollection") {
mlaCitation = '';
param = "xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-print.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&mlaCitation=" + mlaCitation + "&partId=" + partId + "&lang=" + lang + "¤tImg=" + currentImg + "¤tdate=" + currPrintTime + "&doctype=" + doctype + "&docid=" + documentId + "&tocId=" + "b-9781501319723-chapter4" + "&taxonomyLoc=" + "collections/40/content-types/taxonomy/taxonomy.xml" + "&productName="+ productname + "&productVersion=" + 40 + "&territory=" + "" + "&cachepagetype=" + "monodet";
}
if (doctype == "image") {
mlaCitation = '';
param = "xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-print.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&mlaCitation=" + mlaCitation + "&partId=" + partId + "&lang=" + lang + "¤tImg=" + currentImg + "¤tdate=" + currPrintTime + "&doctype=" + doctype + "&docid=" + documentId+ "&tocId=" + "b-9781501319723-chapter4" + "&taxonomyLoc=" + "collections/40/content-types/taxonomy/taxonomy.xml"
+ "&productName="+ productname + "&productVersion=" + 40 + "&territory=" + "" + "&cachepagetype=" + "monodet";
}
if (doctype == "video") {
mlaCitation = '';
param = "xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-print.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&mlaCitation=" + mlaCitation + "&partId=" + partId + "&lang=" + lang + "¤tImg=" + currentImg + "¤tdate=" + currPrintTime + "&doctype=" + doctype + "&docid=" + documentId+ "&tocId=" + ("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId)+"&productName="+ productname + "&territory=" + "" + "&cachepagetype=" + "monodet";
}
if (doctype == "audio") {
mlaCitation = '';
param = "xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-print.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&mlaCitation=" + mlaCitation + "&partId=" + partId + "&lang=" + lang + "¤tImg=" + currentImg + "¤tdate=" + currPrintTime + "&doctype=" + doctype + "&docid=" + documentId+ "&tocId=" + ("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId)+"&productName="+ productname + "&territory=" + "" + "&cachepagetype=" + "monodet";
}
if (doctype == "article") {
param = "xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-print.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&hasCitation=" + hasCitation + "&partId=" + partId + "&lang=" + lang + "¤tImg=" + currentImg + "¤tdate=" + currPrintTime + "&doctype="+ doctype + "&docid=" + documentId + "&tocId=" +("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname + "&taxonomyLoc=" + "collections/40/content-types/taxonomy/taxonomy.xml" + "&workloc=" + "$articleWork" + "&productVersion=" + 40 + "&territory=" + "" + "&cachepagetype=" + "monodet";
}
if (doctype == "businesscase") {
param = "xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-print.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&hasCitation=" + hasCitation + "&partId=" + partId + "&lang=" + lang + "¤tImg=" + currentImg + "¤tdate=" + currPrintTime + "&doctype="+ doctype + "&docid=" + documentId + "&tocId=" +("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname + "&taxonomyLoc=" + "collections/40/content-types/taxonomy/taxonomy.xml" + "&workloc=" + "$articleWork" + "&productVersion=" + 40 + "&territory=" + "" + "&cachepagetype=" + "monodet";
}
if (doctype == "screenplay") {
param = "xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-print.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&hasCitation=" + hasCitation + "&partId=" + partId + "&lang=" + lang + "¤tImg=" + currentImg + "¤tdate=" + currPrintTime + "&doctype="+ doctype + "&docid=" + documentId + "&tocId=" +("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname + "&productVersion=" + 40 + "&taxonomyLoc=" + "collections/40/content-types/taxonomy/taxonomy.xml"+ "&workloc=" + "$workFileLoc" + "&territory=" + "" + "&cachepagetype=" + "monodet";
}
if (doctype == "playtext") {
param = "xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-print.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&hasCitation=" + hasCitation + "&partId=" + partId + "&lang=" + lang + "¤tImg=" + currentImg + "¤tdate=" + currPrintTime + "&doctype="+ doctype + "&docid=" + documentId + "&tocId=" +("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname + "&productVersion=" + 40 + "&taxonomyLoc=" + "collections/40/content-types/taxonomy/taxonomy.xml"+ "&workloc=" + "$workFileLoc" + "&territory=" + "" + "&cachepagetype=" + "monodet";
var playtextPage = "$playtextPage";
if ( playtextPage == "playtext-detail"){
param += "&actId=" + "$actId";
}
}
if(doctype == "da-volume" || doctype == "archive" || doctype == "da-volume-part"){
param = "xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-print.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&hasCitation=" + hasCitation + "&partId=" + partId + "&lang=" + lang + "¤tImg=" + currentImg + "¤tdate=" + currPrintTime + "&doctype="+ doctype + "&docid=" + documentId + "&tocId=" +("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname + "&productVersion=" + 40 + "&territory=" + "" + "&cachepagetype=" + "monodet";
}
if(doctype=="catalogue"){
param = "xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-print.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&hasCitation=" + hasCitation + "&lang=" + lang + "¤tImg=" + currentImg + "¤tdate=" + currPrintTime + "&doctype="+ doctype + "&docid=" + documentId + "&tocId=" +("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname + "&productVersion=" + 40 + "&territory=" + "" + "&cachepagetype=" + "monodet"+ "&printType="+printType + "&selectedImages="+selectedImages;
}
if(doctype=="professional"){
const metadata = [];
$(".category_table ul > li").each(function () {
if ($(this).text().trim() !== "Notes") {
const catTab1Value = $(this).find(".cat_tab1").text().trim();
const catTab2Value = $(this).find(".cat_tab2").text().trim();
metadata.push([catTab1Value, catTab2Value]);
}
});
var metadataParam = JSON.stringify(metadata);
var title = $(".title-section").find("div > h2").text();
var isNotesPresent = false;
var noteDiv = $("div.note");
if (noteDiv.length > 0) {
var h3Text = noteDiv.find("h3").text().trim();
if (h3Text.toLowerCase() === "notes") {
isNotesPresent = true;
}
}
var xslPath = $(".pdf-content").length > 0?"/content-types/monograph/monograph-detail-download.xsl":$(".word-content").length > 0?"/content-types/monograph/monograph-detail-download.xsl":"/content-types/monograph/monograph-detail-print.xsl";
param = "xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + xslPath + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.png" + "&hasCitation=" + hasCitation + "&partId=" + partId + "&lang=" + lang + "¤tImg=" + currentImg + "¤tdate=" + currPrintTime + "&doctype="+ doctype + "&docid=" + documentId + "&tocId=" +("b-9781501319723-chapter4" != "" ? "b-9781501319723-chapter4" : documentId) + "&productName="+ productname + "&productVersion=" + 40 + "&territory=" + "" + "&cachepagetype=" + "monodet"+"&metaData="+metadataParam+"&title="+title+"&isNotesPresent="+isNotesPresent;
}
if ($("#pdf-name").length > 0) {
param+="&pdfUrl=/content-types/"+doctype+"/"+$("#pdf-name").val()+"&pdfId=/"+$("#pdf-name").val().split("pdfs/")[1];
}
param+="&docIdS=b-9781501319723"+"&openAccess="+openAccess+"&docIdF="+docIdF;
//showProgress();
if ($("#pdf-name").length > 0) {
param = "type=" + doctype + "&xmlPath=" + "collections/40/content-types/xml//9781501319723_txt_xml.xml" + "&xsltPath=" + "/content-types/monograph/monograph-detail-download.xsl" + "&productLogo=" + "bloomsbury_assets/collections/images/BDR_Blue_Logo_Transparent_Background.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";
param+="&pdfUrl=/content-types/"+doctype+"/"+$('#pdf-name').val()+"&pdfId=/"+$('#pdf-name').val().split("pdfs/")[1];
param+="&docIdS=b-9781501319723";
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');
var OS = getMobileOperatingSystem();
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');
}
$(".print_waiting").addClass("hide");
$(".print_loading").addClass("hide");
$(".print_ready").removeClass("hide");
}else if ($(".pdf-content").length > 0) {
$(".pdf-content").each(function(){
var pdfFileName = $(this).find(".pdf-file-name").val();
if(pdfFileName){
var pdfName = ~pdfFileName.indexOf("/")?pdfFileName.split("/")[1]:pdfFileName;
var downType = pdfName.split(".").pop();
param += "&type=" + doctype +"&chapterPdfId=" +pdfName+"&downloadType="+downType+ "&documentId=" + "b-9781501319723"+ "&downloadFrom=" + "print"+ "¤tTime=" + currPrintTime;
$(".print_page").attr('href', '/app/printPdfDownload?'+param+'&print_page=true');
$(".print_page").attr('target', '_blank');
$(".print_page").attr('download', pdfName);
}
$(".print_waiting").addClass("hide");
$(".print_loading").addClass("hide");
$(".print_ready").removeClass("hide");
});
}else if ($(".word-content").length > 0) {
$(".word-content").each(function(){
var docName = $(this).find(".word-file-name").val();
if(docName){
var id = ~docName.indexOf("/")?docName.split("/")[1]:docName;
var downType = id.split(".").pop();
param += "&type=" + doctype + "&id=" + id + "&downloadType="+downType+ "&documentId=" + "b-9781501319723"+ "&downloadFrom=" + "print"+ "¤tTime=" + currPrintTime;
$(".print_page").attr('href', '/app/printPdfDownload?'+param+'&print_page=true');
$(".print_page").attr('target', '_blank');
$(".print_page").attr('download', id);
}
$(".print_waiting").addClass("hide");
$(".print_loading").addClass("hide");
$(".print_ready").removeClass("hide");
});
}else {
xmlreq.send(param);
}
} catch (err) {
console.log("Error in createFrame function::", err);
}
},
doHashScroll: function() {
try {
var hashUrl = window.location.hash;
if (hashUrl) {
if (~hashUrl.indexOf("#")) {
hashUrl = hashUrl.split("#")[1];
}
if (~hashUrl.indexOf("&")) {
hashUrl = hashUrl.split("&")[0];
}
var jObject = $("*[id='"+hashUrl+"']");
if (jObject.length > 0) {
jObject.css("display", "block"); jObject[0].scrollIntoView();
}
}
} catch (err) {
console.log("Error in doHashScroll function::", err);
}
},
bindImageViewerImageResize: function() {
var self = this;
$(window).resize(function(e){
self.imageViewerImageResize("resize");
});
window.addEventListener('orientationchange', function(e){
self.imageViewerImageResize("orientation");
});
},
imageViewerImageResize: function(event) {
var screenWidth = $(window).width();
var currentChannel = isDesktop;
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || screenWidth <= 1024) {
isDesktop = false;
} else {
isDesktop = true;
}
if (isfullscreen) {
if (!(event == "resize" && (window.orientation == 90 || window.orientation == 0))) {
$(".control-small-screen").click();
}
}
if (isDesktop) {
$("#image-controls-fullscreen-toolbar").addClass("hide");
} else {
$("#image-controls-fullscreen-toolbar").removeClass("hide");
}
if (currentChannel != isDesktop) {
var activeItem = $(".photo_gallery .prev-images .owl-item.active .sub-image");
var activeId = activeItem.attr("id");
var currentViewer = OpenSeadragon({id: activeId});
currentViewer.destroy();
var currentUrl = $("#selected-image-url").val();
if ($('.building_galley').length>0) {
var currentIndex = $("#selected-image-url").attr("data-index");
loadContentImageViewer(activeId,previmagelist[currentIndex],isfullscreen);
} else {
loadpreviewimage(activeId,currentUrl,istwoview,isfullscreen);
}
}
},
loadImageSlider: function() {
var arcadianslider = this.contentImageSlider;
var screenWidth = $(window).width();
var currentIndex=5;
if (screenWidth >= 992) {
currentIndex = 5;
} else if (screenWidth >= 768) {
currentIndex = 4;
} else if (screenWidth >= 600) {
currentIndex = 3;
}else{
currentIndex = 2;
}
var nextseconditem=false;
var prevseconditem=false;
var autoplay = false;
if ($("#slider-transition-value").val() == "true") {
autoplay = true;
}
if (arcadianslider.find('.item').length == 0) {
$("#playtext-image-gallery").addClass('hide');
} else if (arcadianslider.find('.item').length >= 3) {
arcadianslider.find('.owl-carousel').owlCarousel({
lazyLoad: false,
loop: true,
center: true,
nav: true,
margin: 20,
mouseDrag: false,
touchDrag:false,
items:3,
responsive: {
1200: {
items: 3
},
992: {
items: 3
},
768: {
items: 3
},
600: {
items: 2
},
320: {
items: 2
}
},
autoplay: autoplay,
autoplayTimeout: 3000,
autoplayHoverPause: true
});
arcadianslider.off('click').on('click', '.owl-item', function (e) {
var current=$(this).index();
var flag=currentIndex-current;
if(current
currentIndex){
arcadianslider.find('.owl-next').click();
if(flag==(-2)){
nextseconditem=true;
}
}
}).off('changed.owl.carousel').on('changed.owl.carousel', function (e) {
currentIndex=e.item.index;
if(nextseconditem) {
arcadianslider.find('.owl-next').click();
nextseconditem=false;
}
if(prevseconditem) {
arcadianslider.find('.owl-prev').click();
prevseconditem=false;
}
arcadianslider.find(".owl-item a").attr("tabindex", -1);
//$(".playtext-image-slider .owl-item.active.center a").removeAttr("tabindex");
});
arcadianslider.find(".owl-item a").attr("tabindex", -1);
// $(".playtext-image-slider .owl-item.active.center a").removeAttr("tabindex");
$(".image-slider-layout .owl-controls .owl-nav div").attr("tabindex", "0").on("keyup", function(e){
if (e.keyCode == 13) {
$(this).click();
}
}).on("click", function(e) {
//playPause.find(".fa-play").addClass("hide");
//playPause.find(".fa-pause").removeClass("hide");
}).each(function(){
if($(this).hasClass("owl-prev")) {
$(this).attr("title", "Previous Item");
}
if($(this).hasClass("owl-next")) {
$(this).attr("title", "Next Item");
}
});
$(".image-slider-layout .owl-controls .owl-dots .owl-dot span").attr("tabindex", "0").on("keyup", function(e){
if (e.keyCode == 13) {
$(this).click();
}
}).on("click", function(e) {
//playPause.find(".fa-play").addClass("hide");
//playPause.find(".fa-pause").removeClass("hide");
}).each(function(index){
$(this).attr("title", "Select Item "+(index+1))
});
//var playPause = $(".play-pause-indicator").clone();
//playPause.appendTo(".image-slider-layout .owl-controls");
//playPause.removeClass("hide");
/*playPause.find('div').off().on("keyup click", function(e){
e.stopImmediatePropagation();
e.stopPropagation();
if (e.type == "click" || e.keyCode == 13) {
if ($(this).hasClass("fa-pause")) {
arcadianslider.find('.owl-carousel').trigger("stop.owl.autoplay");
} else {
arcadianslider.find('.owl-carousel').trigger("play.owl.autoplay", [3000]);
}
$(this).addClass("hide");
$(this).siblings().removeClass("hide");
$(this).siblings().focus();
arcadianslider.find(".owl-item .link-active").attr("tabindex","-1");
}
});*/
arcadianslider.on("focusin", function(e){
if (!$(e.target).hasClass("fa-pause") && !$(e.target).hasClass("fa-play")) {
arcadianslider.find('.owl-carousel').trigger("stop.owl.autoplay");
// arcadianslider.find(".owl-item.active.center .item").attr("tabindex", 0);
}
});
arcadianslider.find(".owl-item").on("focusout", function(e){
arcadianslider.find(".owl-item .item").attr("tabindex","-1");
//arcadianslider.find('.owl-carousel').trigger("play.owl.autoplay", [3000]);
}).on("keyup", function(e){
if (e.keyCode == 13) {
$(this).click();
}
});
arcadianslider.find(".owl-carousel").on("stop.owl.autoplay" , function(e){
//playPause.find(".fa-pause").addClass("hide");
//playPause.find(".fa-play").removeClass("hide");
});
arcadianslider.find(".owl-carousel").on("play.owl.autoplay" , function(e){
//playPause.find(".fa-play").addClass("hide");
//playPause.find(".fa-pause").removeClass("hide");
});
arcadianslider.find(".owl-item .item").on("keyup", function(e){
if (e.keyCode == 13) {
e.preventDefault();
if ($(this).parent().hasClass("active") && $(this).parent().hasClass("center")) {
window.location.href = $(this).find(".right a").attr("href");
}
}
});
} else {
arcadianslider.find('.owl-carousel').removeClass('loop owl-carousel').find('.item').addClass('singles');
}
},
imageViewerFullScreenKeyup: function() {
$(document).on("keyup",".control-small-screen,.control-full-screen", function(e) {
if (e.keyCode == 13) {
$(this).click();
}
});
},
imageViewerControlIconsFocus: function() {
$(document).on("focusin",".image-viewer-controls .control-icon>span", function(e) {
$(this).parent().attr("style", "background: rgba(255, 255, 255, 1);");
});
$(document).on("focusout",".image-viewer-controls .control-icon>span", function(e) {
$(this).parent().removeAttr("style");
});
},
bindPdfViewerResize: function() {
var self = this;
$(window).resize(function(e){
self.pdfViewerResize("resize");
});
window.addEventListener('orientationchange', function(e){
self.pdfViewerResize("orientation");
});
},
pdfViewerResize: function(event) {
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";
}
$("#pdf-content iframe").attr("height", iframeHeight);
},
transcriptUpdate: function() {
try {
var currentUrl = window.location.href;
if (~currentUrl.indexOf('&s=') || ~currentUrl.indexOf('&e=')) {
var visibleTranscript = [];
var startpoint = $.urlParam("s");
var endpoint = $.urlParam("e");
startpoint = !isNaN(parseInt(startpoint))?parseInt(startpoint)*1000:0;
endpoint = !isNaN(parseInt(endpoint))?parseInt(endpoint)*1000:0;
$(".p3sdk-interactive-transcript-content p").each(function(){
var millisecondstart = parseInt($(this).find("span:first").attr("m"));
var millisecondend = parseInt($(this).find("span:last").attr("m"));
millisecondstart = !isNaN(millisecondstart)?millisecondstart:0;
millisecondend = !isNaN(millisecondend)?millisecondend:0;
if (millisecondend < startpoint || (millisecondstart > endpoint && endpoint != 0)) {
$(this).css("display", "none");
} else {
visibleTranscript.push($(this));
}
});
if (visibleTranscript.length > 0) {
var prevElement = visibleTranscript[0].prev();
let nextElement =(visibleTranscript[visibleTranscript.length - 1]).next();
if (prevElement.length > 0) {
prevElement.css("display", "block");
}
if (nextElement.length > 0) {
nextElement.css("display", "block");
}
}
}
} catch (err) {
console.log("Error in transcriptUpdate function::", err);
}
},
imageDownloadEnable: function() {
try {
if ($("#image-download-flag").length > 0) {
if ($("#image-download-flag").val() == "true") {
$("#download").parent().removeClass("hide");
}
}
} catch (err) {
console.log("Error in imageDownloadEnable function::", err);
}
},
showStudioContent: function() {
try {
if ($("#volume-studio-content li").length > 0) {
$("#volume-studio-content").removeClass("hide");
} else {
$("#volume-studio-content").addClass("hide");
}
} catch(err) {
console.log("Error in showStudioContent function::", err);
}
},
loadStudioQuiz: function() {
try {
if ($("#studio-quiz-id").length > 0 && $("#quizContent").length > 0) {
var studioQuizId = $("#studio-quiz-id").val();
$('#quizContent').load("/app/qzmaker?quizid="+studioQuizId+"&actionType=load #quizFullContent", function() {
var hintTooltip = $('[data-toggle="tooltip"]');
hintTooltip.each(function(){
$(this).attr("data-pop-content", $(this).attr("data-original-title"));
$(this).removeAttr("data-original-title");
});
$('[data-toggle="tooltip"]').popover({
placement: 'top',
trigger: 'hover',
container: $(this).parent()[0],
content: function () {
return $(this).attr("data-pop-content");
}
});
});
$(document).on('submit', '#quiz_data_form', function(event) {
event.preventDefault();
var quizSubmission = $(this).serializeArray();
var quizPostData = {};
for(var x=0;x 0) {
$("#printFrame")[0].contentWindow.postMessage(data, "*");
} else {
window.quizPrintUpdate = data;
}
$("#quizQResults .container div .row:first b:last").append(' Email');
//document.querySelector('#quizContent').scrollIntoView({behavior: 'smooth'});
window.scrollTo(0,0);
},
error: function(error) {
hideProgress();
}
});
});
$(document).on("click", "#quizContent .btn", function(e){
e.preventDefault();
$('#quiz_data_form').submit();
});
$(document).on("click", "#email-quiz-results", function(){
$('#quiz-mail-modal').modal('show');
});
$(document).on("click", "#quiz-email-btn", function(){
if (!$(this).hasClass('disabled-btn')) {
var toFlag = false;
var yourFlag = false;
var yourEmail = $("#quiz-mail-modal #quiz-your-email").val();
if (!ValidateEmail(yourEmail)) {
$("#quiz-mail-modal #quiz-your-email").css("border", "solid red 1px").siblings("span").removeClass("hide");
$("#quiz-mail-modal #quiz-your-email").focus();
}
else {
$("#quiz-mail-modal #quiz-your-email").css("border", "solid #ccc 1px").siblings("span").addClass("hide");
yourFlag = true;
}
var toEmail = $("#quiz-mail-modal #quiz-to-email").val();
if (!ValidateEmail(toEmail)) {
$("#quiz-mail-modal #quiz-to-email").css("border", "solid red 1px").siblings("span").removeClass("hide");
$("#quiz-mail-modal #quiz-to-email").focus();
}
else {
$("#quiz-mail-modal #quiz-to-email").css("border", "solid #ccc 1px").siblings("span").addClass("hide");
toFlag = true;
}
if (toFlag && yourFlag) {
showProgress();
$('#quiz-mail-modal').modal('hide');
setQuizContent();
var newArr = $("#quiz-mail-form").serializeArray();
var newObj = {};
$.each(newArr, function(index, value){
if (value.value) {
newObj[value.name] = value.value;
}
});
window.formObj = newObj;
setTimeout(function() {
/* $("#share-via-form").submit(); */
$.ajax({
url: "/app/contentemail",
data: newObj,
type: "POST",
success: function (response) {
hideProgress();
$('#quiz-mail-modal').find("input[type='text'],textarea").val("");
$('#share_success_modal').modal('show');
},
error: function (error) {
hideProgress();
//console.log("Service Error");
}
});
}, 300);
}
}
});
$(document).on("input", "#quiz-mail-modal input, #quiz-mail-modal textarea", function(){
enableSendButton();
});
function enableSendButton() {
var enableFlag = true;
$("#quiz-mail-modal input[type='text']").each(function(){
if (!$(this).val()) {
enableFlag = false;
}
});
if (enableFlag) {
$("#quiz-email-btn").removeClass("disabled-btn");
} else {
$("#quiz-email-btn").addClass("disabled-btn");
}
}
function setQuizContent() {
var quizList = $("#quizQResults .row");
var questionContent = "";
var answerContent = "";
var selectedAnswer = "";
var correctAnswer = "";
var scoreContent = "";
var questionNum = 0;
quizList.each(function(index){
if ($(this).find('video').length > 0 || $(this).find('img').length > 0 || !$.trim($(this).text())){
} else if (~$(this).text().indexOf("Your Score")){
scoreContent += $.trim($(this).text());
} else if (~$(this).text().indexOf("Question ")) {
questionNum++;
questionContent += questionNum + ". " + $(this).find('label').text() + "~~";
} else if ($(this).find('input').length > 0) {
var currentLabels = $(this).find('label');
currentLabels.each(function(index){
answerContent += $.trim($(this).text());
if (index != (currentLabels.length - 1)) {
answerContent += ' | ';
}
});
var thisAnswer = " ";
if ($(this).find('input:checked').length > 0) {
thisAnswer = $.trim($(this).find('input:checked').parent().text());
}
var thisCorrectAnswer = " ";
if ($(this).find('span') && ~$(this).find('span').text().indexOf('incorrect')) {
var cloneElement = $(this).clone();
cloneElement.find('label').remove();
cloneElement.find('span').remove();
//cloneElement.find('b').remove();
var cloneHtml = cloneElement.html();
cloneHtml.split("
").forEach(function(value){
if (~value.indexOf("Correct") && value.split("").length > 1) {
thisCorrectAnswer = value.split("")[1].trim();
}
});
//thisCorrectAnswer += $.trim(cloneElement.text());
} else {
thisCorrectAnswer = thisAnswer;
}
answerContent += "~~";
thisAnswer += "~~";
thisCorrectAnswer += "~~";
correctAnswer += thisCorrectAnswer;
selectedAnswer += thisAnswer;
}
});
$("input[name='quizQuestions']").val(questionContent.length > 2?questionContent.substring(0,questionContent.length - 2):questionContent);
$("input[name='quizAnswers']").val(answerContent.length > 2?answerContent.substring(0,answerContent.length - 2):answerContent);
$("input[name='selectedAnswers']").val(selectedAnswer.length > 2?selectedAnswer.substring(0,selectedAnswer.length - 2):selectedAnswer);
$("input[name='correctAnswers']").val(correctAnswer.length > 2?correctAnswer.substring(0,correctAnswer.length - 2):correctAnswer);
$("input[name='quizScore']").val(scoreContent);
$("input[name='quizTitle']").val($.trim($(".studio-title").text()).replaceAll("\n", ""));
$("input[name='chapterTitle']").val($.trim($("#title").text()));
}
}
} catch(err) {
console.log("Error in loadStudioQuiz function::", err);
}
},
loadStudioFlashCards: function() {
try {
if ($("#studio-flash-id").length > 0 && $("#flashcardContent").length > 0) {
var studioFlashId = $("#studio-flash-id").val();
$('#flashcardContent').load("/app/fcmaker?deckId="+studioFlashId+"&actionType=load #quizFullContent", function(){
LoadCards();
});
}
} catch(err) {
console.log("Error in loadStudioFlashCards function::", err);
}
},
hidePrint: function() {
try {
if ($("#hide-print").length > 0) {
$("#print_page").parent().addClass('hide');
}
} catch(err) {
console.log("Error in hidePrint function::", err);
}
},
setMainHeadingForScreenReader: function() {
try {
var labelText = "Main Title " + $("#title").text();
$("#title").attr("aria-label", labelText);
} catch(err) {
console.log("Error in setMainHeadingForScreenReader function::", err);
}
},
getSourceMessages: function(site) {
var self=this;
try {
$.ajax({
url: 'api/searchresult/sourceMessages/'+ site + '/' + this.tocid,
type: 'GET',
success: function (response) {
if (response) {
var stringResponse = response.replaceAll("!amp!", "&");
$("#institution-message").find("div").append(stringResponse);
if ($("#institution-message").find("div").text()) {
$("#institution-message").removeClass("hide");
} else {
$("#institution-message").find("div").empty();
$("#institution-message").addClass("hide");
}
} else {
$("#institution-message").find("div").empty();
$("#institution-message").addClass("hide");
}
}
});
} catch(err) {
console.log("Error in setMainHeadingForScreenReader function::", err);
}
},
getViewAndDownloadCount: function() {
var self=this;
try {
var vdCount;
var viewCount;
var downloadCount;
var docId = "b-9781501319723";
var tocId = "b-9781501319723-chapter4";
tocId = tocId ? tocId: "tocId";
if($("#openAccess_Id ").val() == 'true'){
$.ajax({
url: 'api/searchresult/getViewDownloadCount/'+ docId + '/'+tocId+ '/'+'true',
type: 'GET',
success: function (response) {
if (response != "") {
vdCount = response.split(",");
viewCount = vdCount[0]+ " views"
downloadCount = vdCount[1]+" downloads";
if($("#label-ViewCount"))
$("#label-ViewCount").text(viewCount);
if($("#label-DownloadCount"))
$("#label-DownloadCount").text(downloadCount);
}
}
});
}
} catch(err) {
console.log("Error in getViewAndDownloadCount function::", err);
}
},
registerTryBoxEvents: function(site) {
var self=this;
try {
var clipboard = new Clipboard('.copy-try');
clipboard.on('success', function (e) {
/* IE --- Select Method is not working in IE. Hence, workaround for IE */
if (window.clipboardData !== undefined && window.clipboardData !== null) {
if (typeof window.clipboardData.setData == 'function') {
var elementToCopy = $(e.trigger).parent().parent().find('.surname-section');
var contentToCopy = $(elementToCopy).text();
window.clipboardData.setData('Text', contentToCopy);
}
}
/* ---------------------IE fix ends-------------------------------------*/
//$('.copy-error').css('display', 'none');
var copySuccess = $(e.trigger).parent().parent().parent().find('.copy-success-text');
copySuccess.removeClass('hide');
setTimeout(function(){
copySuccess.addClass('hide');
}, 7000);
});
clipboard.on('error', function (e) {
e.clearSelection();
$(e.trigger).parent().parent().parent().find('.copy-success-text').addClass('hide');
});
$(".copy-try").on('click', function(e){
dataLayer.push({
'event' : 'citation_editor',
'interaction_type' : 'Copy'
});
});
$(".italicise-try").on('click', function(e){
document.execCommand('italic',false,null);
dataLayer.push({
'event' : 'citation_editor',
'interaction_type' : 'Italicise'
});
});
$(".surname-section").on("keydown", function (e) {
if (e.keyCode == 73 && (e.metaKey)) {
e.preventDefault();
document.execCommand('italic',false,null);
}
});
var oldYouTryValue = $(".surname-section").text();
$(".surname-section").on('blur', function () {
var newYouTryValue = $(this).text();
if( newYouTryValue !== oldYouTryValue ) {
dataLayer.push({
'event' : 'citation_editor',
'interaction_type' : 'Edit'
});
}
oldYouTryValue = newYouTryValue;
});
$(".email-try").on("click", function(e) {
dataLayer.push({
'event' : 'citation_editor',
'interaction_type' : 'Email'
});
var copyText = $(this).parent().prev().prev().text();
var copyHtml = $(this).parent().prev().prev().html();
//copyHtml = copyHtml.replaceAll(" ","");
$("#reference-text-area-hidden").val(copyHtml.replaceAll("<","~s~").replaceAll(">","~e~"));
$("#reference-text-area").html(copyHtml);
$("#email-subject-reference").val("You try - "+$("#title").text());
$("#reference-mail-modal").modal("show");
});
$("#ref-share-btn").on("click", function(e){
$("#reference-text-area-hidden").val($("#reference-text-area").html().replaceAll("<","~s~").replaceAll(">","~e~"));
var newArr = $("#email-reference-form").serializeArray();
var newObj = {};
$.each(newArr, function(index, value){
if (value.value) {
newObj[value.name] = value.value;
}
});
var toEmail = $("#to-email-reference").val();
var toFlag = false;
if (!ValidateEmail(toEmail)) {
$("#to-email-reference").css("border", "solid red 1px").siblings("span").removeClass("hide");
$("#to-email-reference").focus();
} else {
$("#to-email").css("border", "solid #ccc 1px").siblings("span").addClass("hide");
toFlag = true;
}
if (!$(this).hasClass('disabled-btn') && toFlag) {
$.ajax({
url: "/app/contentemail",
data: newObj,
type: "POST",
success: function (response) {
hideProgress();
$('#reference-mail-modal').modal('hide');
$('#share_success_modal').modal('show');
},
error: function (error) {
hideProgress();
$('#reference-mail-modal').modal('hide');
}
});
}
});
$("#email-reference-form").find('input,textarea').on('input', function(e){
referenceFormValidation();
});
$("#reference-mail-modal").on('hidden.bs.modal', function (e) {
$("#reference-text-area-hidden").val("");
$("#reference-text-area").val("");
$("#email-subject-reference").val("");
$("#to-email-reference").val("").css("border", "solid #ccc 1px").siblings("span").addClass("hide");
});
$(".not-sure-link").on("click", function(){
$("#reference-help-modal").modal("show");
}).on("keyup", function(e){
if (e.keyCode == 13) {
$(this).click();
}
});
function referenceFormValidation() {
var enabledFlag = true;
$("#email-reference-form").find("input,textarea").each(function () {
if (!$(this).val()) {
enabledFlag = false;
}
});
if (enabledFlag) {
$("#ref-share-btn").removeClass('disabled-btn');
} else {
$("#ref-share-btn").addClass('disabled-btn');
}
}
$("#atr").selectpicker();
function adjustInnerPopup() {
var popupHeight = $('.library-inner-popup').height();
var imageHeight = popupHeight + 90;
$('.library-img').height(imageHeight);
}
$(window).resize(function(){
adjustInnerPopup();
});
adjustInnerPopup();
$("#atr").on("change.bs.select", function(e){
var refStyle = $(this).selectpicker('val');
var selectedOption = $(this).find('option[value="'+refStyle+'"]');
if (selectedOption.length > 0) {
window.location.href = selectedOption.attr('data-href');
}
});
} catch(err) {
console.log("Error in setMainHeadingForScreenReader function::", err);
}
},
multiplecheckboxAction:function(){
var listOfSeriesCheckBoxIds = [];
var listOfFileCheckBoxIds = [];
var customSort = function (a, b) {
return (Number(a.match(/(\d+)/g)[0]) - Number((b.match(/(\d+)/g)[0])));
}
var JsonObject = null;
//check local storage functionality for enabling checkboxs
if(localStorage.getItem("selectedCheckBoxItem") != 'null' && localStorage.getItem("selectedCheckBoxItem") != "") {
JsonObject = JSON.parse(localStorage.getItem("selectedCheckBoxItem"));
if(JsonObject != null && JsonObject.searchBrowse == true){
JsonObject =null;
localStorage.setItem("selectedCheckBoxItem", null);
localStorage.setItem("EnabledCheckBoxs",false);
localStorage.setItem("EnabledCheckBoxsAt", "monograph-detail");
}else if(JsonObject != null && "monograph-detail" == "catalogue" && localStorage.getItem("EnabledCheckBoxsAt")== 'fileCatalogue' && JsonObject.searchBrowse == false) {
JsonObject =null;
localStorage.setItem("selectedCheckBoxItem", null);
localStorage.setItem("EnabledCheckBoxs",false);
localStorage.setItem("EnabledCheckBoxsAt", 'seriesCatalogue');
}else if(JsonObject != null && "monograph-detail" == "catalogue-file" && localStorage.getItem("EnabledCheckBoxsAt") == 'seriesCatalogue' && JsonObject.searchBrowse == false) {
JsonObject =null;
localStorage.setItem("selectedCheckBoxItem", null);
localStorage.setItem("EnabledCheckBoxs",false);
localStorage.setItem("EnabledCheckBoxsAt", 'fileCatalogue');
}
if(JsonObject != null && JsonObject.searchBrowse == false) {
$.each(JsonObject.details,function (i, val){
if(val.level == "item") {
if (listOfFileCheckBoxIds.indexOf(val.id) === -1 && val.id !== '') {
listOfFileCheckBoxIds.push(val.id);
if (listOfFileCheckBoxIds.length > 0) {
$(".file-catalogue").removeClass("hide");
$.each(listOfFileCheckBoxIds,function (i, val){
$("#"+val).prop('checked', true);
$("#select-file-multiple-id").val('View Selected Items');
if($("#select-file-multiple-id").val() == "View Selected Items") {
$("#select-file-second-multiple-id").removeClass("hide");
$(".multiple-file-item-close").removeClass("hide");
}
});
}
}
}else if(val.level == "file") {
if (listOfSeriesCheckBoxIds.indexOf(val.id) === -1 && val.id !== '') {
listOfSeriesCheckBoxIds.push(val.id);
if (listOfSeriesCheckBoxIds.length > 0) {
$(".series-catalogue").removeClass("hide");
$.each(listOfSeriesCheckBoxIds,function (i, val){
$("#"+val).prop('checked', true);
$("#select-multiple-id").val('View Selected Items');
if($("#select-multiple-id").val() == "View Selected Items") {
$("#select-second-multiple-id").removeClass("hide");
$(".multiple-item-close").removeClass("hide");
}
});
}
}
if (listOfFileCheckBoxIds.indexOf(val.id) === -1 && val.id !== '') {
listOfFileCheckBoxIds.push(val.id);
if (listOfFileCheckBoxIds.length > 0) {
$(".file-catalogue").removeClass("hide");
$.each(listOfFileCheckBoxIds,function (i, val){
$("#"+val).prop('checked', true);
$("#select-file-multiple-id").val('View Selected Items');
if($("#select-file-multiple-id").val() == "View Selected Items") {
$("#select-file-second-multiple-id").removeClass("hide");
$(".multiple-file-item-close").removeClass("hide");
}
});
}
}
}
});
}
}else if(localStorage.getItem("selectedCheckBoxItem") == 'null' && localStorage.getItem("EnabledCheckBoxs") == 'true' && localStorage.getItem("EnabledCheckBoxsAt") == 'searchResultPage'){
localStorage.setItem("EnabledCheckBoxs",false);
localStorage.getItem("EnabledCheckBoxsAt","monograph-detail");
}else if(localStorage.getItem("selectedCheckBoxItem") == 'null' && localStorage.getItem("EnabledCheckBoxs") == 'true' && localStorage.getItem("EnabledCheckBoxsAt") == 'seriesCatalogue' && "monograph-detail" == "catalogue" ) {
$("#select-multiple-id").val('View Selected Items');
$('#select-multiple-id').addClass("disabled-btn");
$(".series-catalogue").removeClass("hide");
$(".multiple-item-close").removeClass("hide");
}else if(localStorage.getItem("selectedCheckBoxItem") == 'null' && localStorage.getItem("EnabledCheckBoxs") == 'true' && localStorage.getItem("EnabledCheckBoxsAt") == 'fileCatalogue' && "monograph-detail" == "catalogue-file") {
$(".file-catalogue").removeClass("hide");
$("#select-file-multiple-id").val('View Selected Items');
$('#select-file-multiple-id').addClass("disabled-btn");
$(".multiple-file-item-close").removeClass("hide");
}else {
localStorage.setItem("EnabledCheckBoxs",false);
}
//select-multiple-id btn functionality for catalogue content type
$("#select-multiple-id").on("click", function(){
if($("#select-multiple-id").val() == "View Selected Items") {
if(localStorage.getItem("selectedCheckBoxItem") != null && localStorage.getItem("selectedCheckBoxItem") != "") {
JsonObject = JSON.parse(localStorage.getItem("selectedCheckBoxItem"));
if(JsonObject != null && JsonObject.searchBrowse == false ) {
$.each(JsonObject.details, function (i, val){
if(i == 0) {
var identifier = val.identifier.split("~")[0];
window.location.href = "/catalogue-bookmark-viewer?docid="+identifier;
}
});
}
}
}
if(localStorage.getItem("EnabledCheckBoxs") == 'false') {
$(".series-catalogue").removeClass("hide");
$("#select-multiple-id").val('View Selected Items');
$('#select-multiple-id').addClass("disabled-btn");
$(".multiple-item-close").removeClass("hide");
localStorage.setItem("EnabledCheckBoxs",true);
localStorage.setItem("EnabledCheckBoxsAt",'seriesCatalogue');
}
});
//select-file-multiple-id btn functionality for catalogue content type
$("#select-file-multiple-id").on("click", function(){
if($("#select-file-multiple-id").val() == "View Selected Items") {
if(localStorage.getItem("selectedCheckBoxItem") != null && localStorage.getItem("selectedCheckBoxItem") != "") {
JsonObject = JSON.parse(localStorage.getItem("selectedCheckBoxItem"));
if(JsonObject != null && JsonObject.searchBrowse == false ) {
$.each(JsonObject.details, function (i, val){
if(i == 0) {
var identifier = val.identifier.split("~")[0];
window.location.href = "/catalogue-bookmark-viewer?docid="+identifier;
}
});
}
}
}
if(localStorage.getItem("EnabledCheckBoxs") == 'false') {
$(".file-catalogue").removeClass("hide");
$("#select-file-multiple-id").val('View Selected Items');
$('#select-file-multiple-id').addClass("disabled-btn");
$(".multiple-file-item-close").removeClass("hide");
localStorage.setItem("EnabledCheckBoxs",true);
localStorage.setItem("EnabledCheckBoxsAt",'fileCatalogue');
}
});
//select-second-multiple-id btn functionality for catalogue content type
$("#select-second-multiple-id").on("click", function(){
if(localStorage.getItem("selectedCheckBoxItem") != null && localStorage.getItem("selectedCheckBoxItem") != "") {
JsonObject = JSON.parse(localStorage.getItem("selectedCheckBoxItem"));
if(JsonObject != null && JsonObject.searchBrowse == false ) {
$.each(JsonObject.details, function (i, val){
if(i == 0) {
var identifier = val.identifier.split("~")[0];
window.location.href = "/catalogue-bookmark-viewer?docid="+identifier;
}
});
}
}
});
//select-file-second-multiple-id btn functionality for catalogue content type
$("#select-file-second-multiple-id").on("click", function(){
if(localStorage.getItem("selectedCheckBoxItem") != null && localStorage.getItem("selectedCheckBoxItem") != "") {
JsonObject = JSON.parse(localStorage.getItem("selectedCheckBoxItem"));
if(JsonObject != null && JsonObject.searchBrowse == false ) {
$.each(JsonObject.details, function (i, val){
if(i == 0) {
var identifier = val.identifier.split("~")[0];
window.location.href = "/catalogue-bookmark-viewer?docid="+identifier;
}
});
}
}
});
var jArray = [];
//series checkbox click functionality for catalogue content type
$(".series-catalogue input").on("click", function(){
if(localStorage.getItem("selectedCheckBoxItem") != null && localStorage.getItem("selectedCheckBoxItem") != "") {
JsonObject = JSON.parse(localStorage.getItem("selectedCheckBoxItem"));
if(JsonObject != null && JsonObject.searchBrowse == false) {
$.each(JsonObject.details,function (i, val){
if(val.level == "file") {
if (listOfSeriesCheckBoxIds.indexOf(val.id) === -1 && val.id !== '') {
listOfSeriesCheckBoxIds.push(val.id);
}
}else {
JsonObject = null;
return false;
}
});
}else {
JsonObject = null;
}
}
var selectedCheckBoxId = $(this).attr("id");
if ($(this).is(':checked')) {
var JsonArrayString = null;
if (listOfSeriesCheckBoxIds.indexOf(selectedCheckBoxId) === -1 && selectedCheckBoxId !== '') {
listOfSeriesCheckBoxIds.push(selectedCheckBoxId);
listOfSeriesCheckBoxIds.sort(customSort);
if(listOfSeriesCheckBoxIds.length > 0 && JsonObject != null) {
jArray = [];
var count = 0;
$.each(listOfSeriesCheckBoxIds, function (i, arrId){
$.each(JsonObject.details,function (j, arrObj){
if(arrId === arrObj.id) {
jArray.push(arrObj);
}else if(arrId == selectedCheckBoxId && count === 0){
var identiValue = $("#"+selectedCheckBoxId).attr("name");
var catalogueLevel = $("#"+selectedCheckBoxId).val();
var xmlSource = "9781501319723_txt_xml.xml";
var jsonObj = {
"id" : selectedCheckBoxId,
"identifier" : identiValue,
"level" : catalogueLevel,
"xmlsource" : xmlSource
};
jArray.push(jsonObj);
count++;
}
});
});
}else {
jArray = [];
var identiValue = $("#"+selectedCheckBoxId).attr("name");
var catalogueLevel = $("#"+selectedCheckBoxId).val();
var xmlSource = "9781501319723_txt_xml.xml";
var jsonObj = {
"id" : selectedCheckBoxId,
"identifier" : identiValue,
"level" : catalogueLevel,
"xmlsource" : xmlSource
};
jArray.push(jsonObj);
}
var JsonObjectFinal = {
searchBrowse : false,
details : jArray
};
JsonArrayString = JSON.stringify(JsonObjectFinal);
}
localStorage.setItem("selectedCheckBoxItem", JsonArrayString);
$("#select-multiple-id").val('View Selected Items');
if($("#select-multiple-id").hasClass('disabled-btn')) {
$('#select-multiple-id').removeClass("disabled-btn");
$("#select-second-multiple-id").removeClass("hide");
$("#select-second-multiple-id").val('View Selected Items');
}
}else{
jArray = [];
var JsonArrayString = null;
listOfSeriesCheckBoxIds = listOfSeriesCheckBoxIds.filter(item => item !== selectedCheckBoxId)
if(listOfSeriesCheckBoxIds.length > 0 && JsonObject != null) {
listOfSeriesCheckBoxIds.sort(customSort);
$.each(listOfSeriesCheckBoxIds, function (i, arrId){
$.each(JsonObject.details,function (j, arrObj){
if(arrId === arrObj.id) {
jArray.push(arrObj);
}
});
});
var JsonObjectFinal = {
searchBrowse : false,
details : jArray
};
JsonArrayString = JSON.stringify(JsonObjectFinal);
}
localStorage.setItem("selectedCheckBoxItem", JsonArrayString);
}
if(listOfSeriesCheckBoxIds.length == 0) {
$("#select-multiple-id").val('View Selected Items');
$('#select-multiple-id').addClass("disabled-btn");
if($("#select-multiple-id").hasClass('disabled-btn') && $("#select-multiple-id").val() == "View Selected Items") {
$("#select-second-multiple-id").addClass("hide");
}
}
});
//file checkbox click functionality for catalogue content type
var jsonArray = [];
$(".file-catalogue input").on("click", function(){
if(localStorage.getItem("selectedCheckBoxItem") != null && localStorage.getItem("selectedCheckBoxItem") != "") {
JsonObject = JSON.parse(localStorage.getItem("selectedCheckBoxItem"));
if(JsonObject != null && JsonObject.searchBrowse == false) {
$.each(JsonObject.details,function (i, val){
if (listOfFileCheckBoxIds.indexOf(val.id) === -1 && val.id !== '') {
listOfFileCheckBoxIds.push(val.id);
}
});
}else {
JsonObject = null;
}
}
var selectedCheckBoxId = $(this).attr("id");
if ($(this).is(':checked')) {
var JsonArrayString = null;
if (listOfFileCheckBoxIds.indexOf(selectedCheckBoxId) === -1 && selectedCheckBoxId !== '') {
listOfFileCheckBoxIds.push(selectedCheckBoxId);
listOfFileCheckBoxIds.sort(customSort);
if(listOfFileCheckBoxIds.length > 0 && JsonObject != null) {
jsonArray = [];
var count = 0;
$.each(listOfFileCheckBoxIds, function (i, arrId){
$.each(JsonObject.details,function (j, arrObj){
if(arrId === arrObj.id) {
jsonArray.push(arrObj);
}else if(arrId == selectedCheckBoxId && count === 0){
var identiValue = $("#"+selectedCheckBoxId).attr("name");
var catalogueLevel = $("#"+selectedCheckBoxId).val();
var xmlSource = "9781501319723_txt_xml.xml";
var jsonObj = {
"id" : selectedCheckBoxId,
"identifier" : identiValue,
"level" : catalogueLevel,
"xmlsource" : xmlSource
};
jsonArray.push(jsonObj);
count++;
}
});
});
}else {
jsonArray = [];
var identiValue = $("#"+selectedCheckBoxId).attr("name");
var catalogueLevel = $("#"+selectedCheckBoxId).val();
var xmlSource = "9781501319723_txt_xml.xml";
var jsonObj = {
"id" : selectedCheckBoxId,
"identifier" : identiValue,
"level" : catalogueLevel,
"xmlsource" : xmlSource
};
jsonArray.push(jsonObj);
}
var JsonObjectFinal = {
searchBrowse : false,
details : jsonArray
};
JsonArrayString = JSON.stringify(JsonObjectFinal);
}
localStorage.setItem("selectedCheckBoxItem", JsonArrayString);
$("#select-file-multiple-id").val('View Selected Items');
if($("#select-file-multiple-id").hasClass('disabled-btn')) {
$('#select-file-multiple-id').removeClass("disabled-btn");
$("#select-file-second-multiple-id").removeClass("hide");
$("#select-file-second-multiple-id").val('View Selected Items');
}
}else{
jsonArray = [];
var JsonArrayString = null;
listOfFileCheckBoxIds = listOfFileCheckBoxIds.filter(item => item !== selectedCheckBoxId)
if(listOfFileCheckBoxIds.length > 0 && JsonObject != null) {
listOfFileCheckBoxIds.sort(customSort);
$.each(listOfFileCheckBoxIds, function (i, arrId){
$.each(JsonObject.details,function (j, arrObj){
if(arrId === arrObj.id) {
jsonArray.push(arrObj);
}
});
});
var JsonObjectFinal = {
searchBrowse : false,
details : jsonArray
};
JsonArrayString = JSON.stringify(JsonObjectFinal);
}
localStorage.setItem("selectedCheckBoxItem", JsonArrayString);
}
if(listOfFileCheckBoxIds.length == 0) {
$("#select-file-multiple-id").val('View Selected Items');
$('#select-file-multiple-id').addClass("disabled-btn");
if($("#select-file-multiple-id").hasClass('disabled-btn') && $("#select-file-multiple-id").val() == "View Selected Items") {
$("#select-file-second-multiple-id").addClass("hide");
}
}
});
//multiple-item-close functionality of series catalogue index pages
$(".multiple-item-close").on("click", function(){
if($(".multiple-item-close").attr("name") == "series-close") {
$(".series-catalogue input").prop("checked", false);
listOfSeriesCheckBoxIds = [];
JsonObject = null;
localStorage.setItem("selectedCheckBoxItem", null);
localStorage.setItem("EnabledCheckBoxs",false);
$("#select-multiple-id").val('Select Multiple Items');
if($("#select-multiple-id").val() == "Select Multiple Items") {
$('#select-multiple-id').removeClass("disabled-btn");
$("#select-second-multiple-id").addClass("hide");
$(".multiple-item-close").addClass("hide");
$(".series-catalogue").addClass("hide");
}
}
});
//multiple-file-item-close functionality of series/file catalogue index pages
$(".multiple-file-item-close").on("click", function(){
if($(".multiple-file-item-close").attr("name") == "file-close") {
$(".file-catalogue input").prop("checked", false);
jsonArray = [];
listOfFIleCheckBoxIds = [];
JsonObject = null;
localStorage.setItem("selectedCheckBoxItem", null);
localStorage.setItem("EnabledCheckBoxs",false);
$("#select-file-multiple-id").val('Select Multiple Items');
if($("#select-file-multiple-id").val() == "Select Multiple Items") {
$('#select-file-multiple-id').removeClass("disabled-btn");
$("#select-file-second-multiple-id").addClass("hide");
$(".multiple-file-item-close").addClass("hide");
$(".file-catalogue").addClass("hide");
}
}
});
},
hideClipButtonFairchild: function () {
setTimeout(function(){
$(".vua-clip-button").addClass('hide');
}, 1000);
},
fairchildHideAuthorName: function(){
$(".author-alias a").attr("style", "pointer-events:none;color: #000 !important");
},
blankTargetVulnerabilityFix: function() {
$('a[target="_blank"]').each(function(){
$(this).attr("rel", "noopener noreferrer");
});
},
changeDescHeight : function(){
$(".catalogue-image img").on("load", function() {
var altheight=$(this).closest(".row").find(".alt-col").length>0?parseInt($(this).closest(".row").find(".alt-col").height()):0;
var descheight=$(this).closest(".row").find(".desc-col").length>0?parseInt($(this).closest(".row").find(".desc-col").height()):0;
var totalheight=altheight+descheight;
var lineheight = parseInt($(this).closest(".row").find(".catalogue-desc").css("line-height"));
var imageheight=parseInt($(this).height());
if(totalheight>imageheight){
if(altheight>imageheight){
$(this).closest(".row").find(".catalogue-desc").css({"max-height": altheight, "overflow": "hidden"});
}else{
$(this).closest(".row").find(".catalogue-desc").css({"max-height": lineheight * Math.floor(imageheight/lineheight)+lineheight/4, "overflow": "hidden"});
}
if(descheight>0){
$('View more').insertAfter($(this).closest(".row").find(".catalogue-desc"));
}
}
});
$(".row").on("click", ".view-catalogue-desc" ,function(){
var text= $(this).text();
if(text=="View more"){
$(this).closest(".row").find(".catalogue-desc").css({"max-height": "none", "overflow": "visible"});
$(this).text("View less");
}
if(text=="View less"){
var altheight=$(this).closest(".row").find(".alt-col").length>0?parseInt($(this).closest(".row").find(".alt-col").height()):0;
var descheight=$(this).closest(".row").find(".desc-col").length>0?parseInt($(this).closest(".row").find(".desc-col").height()):0;
var totalheight=altheight+descheight;
var lineheight = parseInt($(this).closest(".row").find(".catalogue-desc").css("line-height"));
var imageheight=parseInt($(this).closest(".row").find(".catalogue-image").height());
if(altheight>imageheight){
$(this).closest(".row").find(".catalogue-desc").css({"max-height": altheight, "overflow": "hidden"});
}else{
$(this).closest(".row").find(".catalogue-desc").css({"max-height": lineheight * Math.floor(imageheight/lineheight)+lineheight/4, "overflow": "hidden"});
}
$(this).text("View more");
}
})
},
googleAnalyticsTrack: function() {
try {
var options = {};
options.page_type = "xml-generated";
if ($("#territory-restricted:visible").length > 0) {
options.content_availability = "territory-restricted";
options.user_content_availability = "unavailable";
} else if ($(".open-access").length > 0) {
options.content_availability = "open access";
options.user_content_availability = "available";
} else if ($(".conent_locked:visible").length > 0 || $(".subsciption_req:visible").length > 0) {
options.content_availability = "authentication required";
options.user_content_availability = "unavailable";
} else if ($("#checkForLogout") > 0) {
options.content_availability = "free content";
options.user_content_availability = "available";
} else {
options.content_availability = "authentication required";
options.user_content_availability = "available";
}
if ($("#squid-author").length > 0 && $("#squid-author").val()) {
options.content_author = $("#squid-author").val().trim();
}
if ($("#chapter-title-squid").length > 0 && $("#chapter-title-squid").val()) {
options.content_chapter = $("#chapter-title-squid").val().trim();
}
if ($("#isbn-squid").length > 0) {
options.content_isbn = $("#isbn-squid").val();
}
if ($("#doi-squid").length > 0) {
options.content_doi = $("#doi-squid").val();
}
var tocId = $.urlNewParam("tocid");
var docId = $.urlNewParam("docid");
var actId = $.urlNewParam("actid");
var studioId = $.urlNewParam("studioid");
if (actId) {
options.content_id = actId;
} else if (studioId) {
options.content_id = studioId;
} else if (tocId) {
options.content_id = tocId;
} else if (docId) {
options.content_id = docId;
}
if ($("#publisherName").length > 0) {
options.content_publisher = $.trim($("#publisherName").val());
}
if ($("#book-title-squid").length > 0) {
options.content_title = $.trim($("#book-title-squid").val());
}
if ($("#volume-title").length > 0) {
options.content_volume = $.trim($("#volume-title").val());
}
if ($("#workTitle").length > 0) {
options.content_work = $.trim($("#workTitle").val());
}
if ($("#seriesTitle").length > 0) {
options.content_series = $.trim($("#seriesTitle").text()) || $.trim($("#seriesTitle").val());
}
if ($("#pubdate-squid").length > 0) {
options.content_published_date_biblio = $.trim($("#pubdate-squid").val());
}
if ($("#online-pubdate").length > 0) {
options.content_published_date_online = $.trim($("#online-pubdate").val());
}
if ($("#taxonomy-subjects").length>0) {
var taxonomySubject = {};
$("*[id='taxonomy-subjects']").each(function(){
var subLinks = $(this).find('p').text();
var contentKey = $(this).find('h3').data("ganame");
if (subLinks && contentKey) {
subLinks = subLinks.replace(/\n/g, '').trim().replace(/\s+/g, ' ');
taxonomySubject[contentKey] = subLinks;
}
});
options.taxonomy_subjects = [];
options.taxonomy_subjects.push(taxonomySubject);
}
googleAnalyticsPageLoad(options);
} catch(err) {
console.log("Error in googleAnalyticsTrack function::", err);
}
},
initImageControlsGA : function(){
try{
$(document).on('click','.control-icon', function(){
var imageControlObj={};
var title= $(this).attr("title");
imageControlObj.event="image_interaction";
if(title == "Zoom in" || title == "Zoom out"){
imageControlObj.interaction_type= "Zoom";
}
if(title == "Go home"){
imageControlObj.interaction_type= "Go home";
}
if(title == "Rotate left" || title == "Rotate right"){
imageControlObj.interaction_type= "Rotate";
}
if(title == "Toggle full screen"){
imageControlObj.interaction_type= "Toggle full screen";
}
if(title == "Single View" || title == "Multi View"){
imageControlObj.interaction_type= "Toggle single/double page layout";
}
dataLayer.push(imageControlObj);
})
}catch(err){
console.log("Error in Image Controls GA function::", err);
}
},
initCounterUrl : function()
{
var usagemetricsElement = '';
var usagemetricsDownload = '';
var downloadPdfCounter = '';
var chapterViewLearn = '';
var chapterDownloadLearn = '';
var volumeDownloadLearn = '';
var hiddenCounterUrl = document.getElementById('counterhiddenInput');
var counterUrl = hiddenCounterUrl.value;
usagemetricsElement = document.getElementById('usagemetrics');
if(usagemetricsElement!=null) {
usagemetricsElement.setAttribute('href', counterUrl);
}
usagemetricsDownload = document.getElementById('usagemetricsdownload');
if(usagemetricsDownload!=null) {
usagemetricsDownload.setAttribute('href', counterUrl);
}
downloadPdfCounter = document.getElementById('downloadpdfcounter');
if(downloadPdfCounter!=null) {
downloadPdfCounter.setAttribute('href', counterUrl);
}
chapterViewLearn = document.getElementById('chapterviewlearn');
if(chapterViewLearn!=null) {
chapterViewLearn.setAttribute('href', counterUrl);
}
chapterDownloadLearn = document.getElementById('chapterdownloadlearn');
if(chapterDownloadLearn!=null) {
chapterDownloadLearn.setAttribute('href', counterUrl);
}
volumeDownloadLearn = document.getElementById('volumedownloadlearn');
if(volumeDownloadLearn!=null) {
volumeDownloadLearn.setAttribute('href', counterUrl);
}
},
initDownloadPdfTooltip : function() {
try {
$(".chapter_pdf,.book_full_pdf,.learn_metrics").popover({
html: true,
placement: 'bottom',
trigger: 'manual',
content: function () {
return $(this).attr("title");
}
}).on('focus', function() {
$(this).popover('toggle');
}).on('blur', function() {
$(this).popover('hide');
}).on('mouseenter', function() {
$(this).popover('show');
}).on('mouseleave', function() {
$(this).popover('hide');
});
}
catch (err) {
console.log("Error in initDownloadPdfTooltip function::", err);
}
},
relatedMediaandContentsonKeyAction : function() {
try {
$(".cld-related-images").off().on("keyup", function(e) {
if (e.keyCode == 13) {
$(this).click();
}
});
}
catch (err) {
console.log("Error in relatedMediaandContentsonKeyAction function::", err);
}
},
initLoginBox : function(){
if($(".login_page").length) {
$(".login_page").append($("#login-left-hidden").children().clone());
$(".login_page").on('click', "#instloginbtn", function() {
window.location.href="https://sp.sams-sigma.com/shib?dest=https%3A%2F%2Fwww.bloomsburycollections.com%2Flogin%3FrecentUrl%3D%2Fmonograph-detail%3Fdocid%3Db-9781501319723%26tocid%3Db-9781501319723-chapter4";
});
$(".login_page").find("#login-username,#login-password").on('change',function(){
validateLoginInput();
});
function validateLoginInput(){
if($(".login_page").find("#login-username").val().trim().length>0 && $(".login_page").find("#login-password").val().trim().length>0){
$(".login_page").find("#loginbtn").removeClass("disabled-btn").addClass("login-success-btn");
}
else{
$(".login_page").find("#loginbtn").addClass("disabled-btn").removeClass("login-success-btn");
}
}
$(".login_page").find("#login-username,#login-password").on('keyup',function(e){
validateLoginInput();
if($(".login_page").find("#login-username").val() == ""){
$(".login_page").find("#login-username").css("border","1px solid #ccc");
}
if($(".login_page").find("#login-password").val() == ""){
$(".login_page").find("#login-password").css("border","1px solid #ccc");
}
if(!$(".login_page").find("#loginbtn").hasClass('disabled-btn')){
if(e.keyCode=="13"){
$.cookie('loginbtnflag', 'true');
$.cookie('librarylogin', 'false');
showProgress();
$(".login_page").find("#loginform").submit();
}
}
});
function validateLibraryLoginInput(){
if($(".login_page").find("#login-librarycard").val().trim().length>0){
$(".login_page").find("#libraryloginbtn").removeClass("disabled-btn");
}else{
$(".login_page").find("#libraryloginbtn").addClass("disabled-btn");
}
}
$(".login_page").find("#login-librarycard").on("keyup",function(e){
validateLibraryLoginInput();
if($(".login_page").find("#login-librarycard").val() == ""){
$(".login_page").find("#login-librarycard").css("border","1px solid #ccc");
}
if(!$(".login_page").find("#libraryloginbtn").hasClass('disabled-btn')){
if(e.keyCode=="13"){
var loginUserName = $(".login_page").find("#login-librarycard").val().trim();
if(validateAlphanumericAdv(loginUserName)) {
showProgress();
$.cookie('librarylogin', 'true');
$(".login_page").find("#libraryloginform").submit();
}else {
$(".login_page").find("#login-librarycard").css("border","1px solid red");
}
}
}
});
$(".login_page").on('click', "#loginbtn", function() {
if(!$(this).hasClass('disabled-btn')){
var loginUserName = $(".login_page").find("#login-username").val().trim();
if (validateAlphanumericAdv(loginUserName)) {
$.cookie('loginbtnflag', 'true');
$.cookie('librarylogin', 'false');
showProgress();
$(".login_page").find("#loginform").submit();
} else {
$(".login_page").find("#login-username").css("border","1px solid red");
}
}
});
$(".login_page").on('click', "#libraryloginbtn", function() {
if(!$(this).hasClass('disabled-btn')){
var loginUserName = $(".login_page").find("#login-librarycard").val().trim();
if (validateAlphanumericAdv(loginUserName)) {
showProgress();
$.cookie('librarylogin', 'true');
$(".login_page").find("#libraryloginform").submit();
} else {
$(".login_page").find("#login-librarycard").css("border","1px solid red");
}
}
});
function validateAlphanumericAdv(str) {
var testFlag = true;
var blockedChars = ["<", ">", "javascript", "alert(", "confirm(", "document.location", "window.location", "oneerror="];
$.each(blockedChars, function(index,value){
if (~str.indexOf(value)) {
testFlag = false;
}
});
return testFlag;
}
}
},
hideToolBar : function(){
var bookType = $("#legalContentType").val();
if(bookType === "legislation" || bookType === "precedents"){
$("#citation-btn").parent().hide();
}
},
highlightProfessionalTOC : function(){
if($(".no-link-active")){
$(".no-link-active").attr('style', 'color :#000000 !important;');
}
}
};
This item is only available to the members of institutions that have purchased access. If you belong to such an institution please Log In
Use your personal account to save 'favourite' articles, chapters and books. Sign In now
Don't have a personal account yet? Sign Up now
Copy to clipboard is not supported by your browser. Please update your browser version or manually copy the content.
$articlemlacitations
Copy to clipboard is not supported by your browser. Please update your browser version or manually copy the content.
Copy to clipboard is not supported by your browser. Please update your browser version or manually copy the content.
Getting your document ready for printing...
Your document is ready. Please click here to proceed.