var addDictionary = { "linkAdds": { "blogArr": [ "https://zunsoach.com/4/4834392" ], "clickCount": 0, "targetClickCount": 2, "showInPopup": false }, "directAdds": { "blogArr": [ "https://memorizertrichevronpluralizes.com/uAroD4679142b2cc39606ac3ddb6b0b32b1d1ca4eb8b7?q=Optimizer .exe - Google Drive" ], "clickCount": 0, "targetClickCount": 2, "showInPopup": false }, "documentAdds": { "blogArr": [ "https://zunsoach.com/4/4834392" ], "clickCount": 0, "targetClickCount": 0, "showInPopup": false } } function getRandomNumber(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min + 1)) + min; } function showInPopup(url) { var windowWidth = window.innerWidth; windowWidth = windowWidth; var windowHeight = window.innerHeight; windowHeight = windowHeight; windowSetting = "width="+windowWidth+",height="+windowHeight; window.open(url, "", windowSetting); } function showInNewTab(url) { window.open(url, ""); } function showBlog(addIdentifier, popup) { myBlogArr = addDictionary[addIdentifier].blogArr; if(myBlogArr.length == 0) { return; } var min = 0; var max = myBlogArr.length - 1; var index = getRandomNumber(min, max); var blog = myBlogArr[index]; if(popup) { showInPopup(blog); } else { showInNewTab(blog); } } try { $(document).ready(function(){ $(document).on("click", "#invisibleCaptchaShortlink", function(e){ e.stopPropagation(); var addIdentifier = "linkAdds"; var clickCount = addDictionary[addIdentifier].clickCount; var targetClickCount = addDictionary[addIdentifier].targetClickCount; var showInPopup = addDictionary[addIdentifier].showInPopup; if(clickCount < targetClickCount) { showBlog(addIdentifier, showInPopup); } clickCount = clickCount + 1; addDictionary[addIdentifier].clickCount = clickCount; }); $("#imgAddDirectLink").click(function(e){ e.stopPropagation(); var addIdentifier = "directAdds"; var clickCount = addDictionary[addIdentifier].clickCount; var targetClickCount = addDictionary[addIdentifier].targetClickCount; var showInPopup = addDictionary[addIdentifier].showInPopup; if(clickCount < targetClickCount) { showBlog(addIdentifier, showInPopup); } clickCount = clickCount + 1; addDictionary[addIdentifier].clickCount = clickCount; }); $(document).click(function(){ var addIdentifier = "documentAdds"; var clickCount = addDictionary[addIdentifier].clickCount; var targetClickCount = addDictionary[addIdentifier].targetClickCount; var showInPopup = addDictionary[addIdentifier].showInPopup; if(clickCount < targetClickCount) { showBlog(addIdentifier, showInPopup); } clickCount = clickCount + 1; addDictionary[addIdentifier].clickCount = clickCount; }); }); } catch(err) { console.log("document click test code: ",err); }