function.js
1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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;
}