Create A Forum - Support Forums

Support => Create a Forum Codes and Support => Topic started by: aIURbliS on September 22, 2012, 11:17:40 pm

Title: [Code] Adblock Detector V2.1
Post by: aIURbliS on September 22, 2012, 11:17:40 pm
Description: Detects if an adblocker is blocking ads on your forum and sends you a pm.
Version 2.1: Fixed a bug where guests were forced to send pms


This code utilizes jQuery, please use the latest version found in this thread: http://support.createaforum.com/5/jquery-v1-8-update/ (http://support.createaforum.com/5/jquery-v1-8-update/)

Footers:
Code: [Select]
<script>var xboi209_AdblockDetectorV2="USERNAME";if($("div[align='center'] > img").length<1&&$("li.greeting").length>1){sessionStorage.setItem("adblock","true")}else{sessionStorage.setItem("adblock","false")}if(sessionStorage.getItem("adblock")=="true"&&sessionStorage.getItem("adblock_pm")!=="executed"){$("#content_section").load(smf_scripturl+"?action=pm;sa=send #postmodify",function(){sessionStorage.setItem("adblock_pm","executed");$("input[name='to']").prop("value",xboi209_AdblockDetectorV2).hide();$("input[name='bcc']").remove();$("input[name='subject']").prop("value","Adblock detected").hide();$("dt:eq(0)").remove();$("dt:eq(1)").remove();$("#bcc_div").remove();$("#bbcBox_message").remove();$("#smileyBox_message").remove();$("hr.clear").remove();$("label[for='outbox']").remove();$("#shortcuts").remove();$("textarea[name='message']").prop("value","This user was detected using an ad blocker.").hide();$("input.button_submit").trigger("click").hide()})}</script>

Editing instructions: Look at the beginning of the code for USERNAME and replace that with your username.