function.js 1.67 KB
function includeStyleElement(styles, styleId) {
  if (document.getElementById(styleId)) {
    return
  }
  var style = document.createElement("style");
  style.id = styleId;
  (document.getElementsByTagName("head")[0] || document.body).appendChild(style);
  if (style.styleSheet) { //for ie
    style.styleSheet.cssText = styles;
  } else {//for w3c
    style.appendChild(document.createTextNode(styles));
  }
}
function LoadJS(fileName) {
  var oHead = document.body;
  var oScript = document.createElement("script");
  oScript.type = "text/javascript";
  oScript.src = "" + fileName + ".js";
  document.body.appendChild(oScript);
}
var antiCopyStyles = "body {-moz-user-select: none;-webkit-user-select: none;-ms-user-select: none;}";
var isAntiCopy = false;
var param = new Base64().decode(window.location.search);
if (param.indexOf("=") > 0 && param.indexOf("isCopy") != -1) {
  if (getQueryString("isCopy") == 1) {
    isAntiCopy = true;
  }
}
//isCopy
if (isAntiCopy) {
  includeStyleElement(antiCopyStyles, "newstyle");
  LoadJS("a");
};
//isDownload
if (param.indexOf("=") > 0 && param.indexOf("isDownload") != -1 && getQueryString("isDownload") == 0) {
  document.getElementById("download").style.display = "none";
  document.getElementById("secondaryDownload").style.display = "none";
}
//isPrint
if (param.indexOf("=") > 0 && param.indexOf("isPrint") != -1 && getQueryString("isPrint") == 0) {
  document.getElementById("print").style.display = "none";
  document.getElementById("secondaryPrint").style.display = "none";
}

function getQueryString(key) {
  var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)");
  var result = param.match(reg);
  return result ? decodeURIComponent(result[2]) : null;
}