$(document).ready(function(){ var currentPathName = window.location.pathname; if(currentPathName === "/course/view.php"){ setActiveCourse(); } $(".linkAnalytics").click(function(e){ e.preventDefault(); var pathname = $(this).attr("href"); var url = 'https://la.ulsan.ac.kr' + pathname popupCenter(url,"강좌 분석","650","650"); }); }); function setActiveCourse(){ var course_id = getQueryStringValue("id") var bcourse_id = btoa(course_id) var imgHtml = ''; $("body").append(imgHtml); } function getQueryStringValue (key) { return decodeURIComponent(window.location.search.replace(new RegExp("^(?:.*[&\\?]" + encodeURIComponent(key).replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1")); } /* Show up POPUP Center care about dual Screen */ function popupCenter(url, title, w, h) { // It's from StackFlow but can't remember Address Sorry. // Fixes dual-screen position Most browsers Firefox var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left; var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top; width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; var left = ((width / 2) - (w / 2)) + dualScreenLeft; var top = ((height / 2) - (h / 2)) + dualScreenTop; var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); // Puts focus on the newWindow if (window.focus) { newWindow.focus(); } }