var pageName = ""; var url = ""; var decodedUrl = ""; var userId = ""; var company = ""; var topic = ""; var encodedCompany = ""; var encodedTopic = ""; var encodedUrl = ""; var loadingImageUrl = "https://wikirate-production-storage.fra1.cdn.digitaloceanspaces.com/files/20531/12604360-large.gif"; var markedIrrelevant = false; function testSameOrigin(testUrl,pageN) { $.getJSON("Source.json?view=check_iframable&url=" + testUrl, function(data) { if (!data.result) { //remove iframe and show redirection message $('#webpage-preview').html(""); $redirectNotice = $("<div>", { "class": "redirect-notice" }); if(pageN!=="") { //locally //Page_000001545?view=content&slot[structure]=source%20item%20preview $.ajax("/"+pageName+"?view=content&slot[structure]=source%20item%20preview") .done(function(noteFormHtml) { $redirectNotice.append(noteFormHtml); $redirectNotice.trigger('slotReady'); }) .fail(function(xhr, ajaxOptions, thrownError) { var html = $(xhr.responseText); html.find('.card-header').remove(); $redirectNotice.append(html); }); } $('#webpage-preview').append($redirectNotice); $('#webpage-preview').addClass("non-previewable"); } }); } function resizeIframe() { $(".webpage-preview").height($(window).height() - $('.navbar').height()-1); //$(".webpage-preview").css('margin-top',$('.navbar').height()+1); } function closeTabContent(){ $(".preview-view .tab-content .close-tab").click(function(){ $(".source-right-sidebar").hide(); $(".source-iframe-container").addClass("full-width"); $(".nav.nav-tabs .active").removeClass("active"); $(".tab-content .active").removeClass("active"); $(".tab-content").hide(); }) } function showTabContent(){ $(".source-right-sidebar").show(); $(".tab-content").show(); $(".source-iframe-container").removeClass("full-width"); } $(document).ready(function() { if($("body").attr("id")=="source-preview-page-layout"){ closeTabContent(); $('[data-toggle="source_preview_tab_ajax"]').click(function(e) { showTabContent(); var $this = $(this), loadurl = $this.attr('href'), targ = $this.attr('data-target'); if (undefined !== loadurl){ $.get(loadurl, function(data) { $(targ).html(data); }); } $this.tab('show'); return false; }); $("#logo-bar").dblclick(function() { return false; }); pageName = $("#source-name").html(); url = $("#source_url").html(); company = $("#source_company").html(); topic = $("#source_topic").html(); if (url) { testSameOrigin(url,pageName); decodedUrl = decodeURIComponent(url); } resizeIframe(); // $('.show-link-in-popup').each(function(){ // $(this).off("click").click(linkOnClick); // }); $(window).resize(function() { resizeIframe(); }); $('[data-target="#tab_claims"]').trigger("click"); } });