Advertise Here

Author Topic: Javascript?  (Read 10055 times)

0 Members and 1 Guest are viewing this topic.

Offline davidjtsteele

  • SMF For Free Member
  • *
  • Posts: 27
    • View Profile

  • Total Badges: 11
    Badges: (View All)
    Level 3 One year Anniversary 10 Posts Search Level 2
Javascript?
« on: July 17, 2014, 06:33:39 pm »
Would this go on the footer or header of my board?

Code: [Select]
function detectTapatalk() {
if (document.cookie.indexOf("tapatalk_redirect4=false") < 0) {
if (!navigator.userAgent.match(/Opera/i)) {

if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
setTapatalkCookies();
if (confirm("This forum has an app for iPhone and iPod Touch! Click OK to learn more about Tapatalk."))
window.location = "http://itunes.apple.com/us/app/tapatalk-forum-app/id307880732?mt=8";
} else if(navigator.userAgent.match(/iPad/i)) {
setTapatalkCookies();
if (confirm("This forum has an app for iPad! Click OK to learn more about Tapatalk."))
window.location = "http://itunes.apple.com/us/app/tapatalk-hd-for-ipad/id481579541?mt=8";
} else if(navigator.userAgent.match(/Kindle Fire/i)) {
setTapatalkCookies();
if (confirm("This forum has an app for Kindle Fire! Click OK to learn more about Tapatalk."))
window.location = "http://www.amazon.com/gp/mas/dl/android?p=com.quoord.tapatalkpro.activity";
} else if(navigator.userAgent.match(/Android/i)) {
setTapatalkCookies();
if (confirm("This forum has an app for Android. Click OK to learn more about Tapatalk."))
window.location = "market://details?id=com.quoord.tapatalkpro.activity";
} else if(navigator.userAgent.match(/BlackBerry/i)) {
setTapatalkCookies();
if (confirm("This forum has an app for BlackBerry! Click OK to learn more about Tapatalk."))  
window.location = "http://appworld.blackberry.com/webstore/content/46654?lang=en";
} else if(window.chrome) {
   
    if ((typeof(tapatalkdir)) == 'undefined' ) var tapatalkdir = 'mobiquo';
    else if(tapatalkdir == '' || tapatalkdir == null) tapatalkdir = 'mobiquo';
   
setTapatalkCookies();
var script1 = document.createElement('script');
var script2;
script1.setAttribute('src',tapatalkdir+'/tapatalkdetect/jquery-1.7.min.js');
script1.setAttribute('type','text/javascript');
var loaded=false;
var loaded2=false;
var loaded3=false;
var loadFunction3 = function() {
var notice = '<div class="notice">'
+ '<div class="notice-body">'
+ '<p>Download <a href="https://chrome.google.com/webstore/detail/plfhcjljnfjpfcbjpgnflfofmahljkjj" target="_new">Tapatalk Notifier</a> for Chrome to keep notified of new Private Messages from this forum. <br /></p>'
+ '</div>'
+ '</div>';
$( notice ).purr(
{
usingTransparentPNG: true,
removeTimer:12000
}
);
}

var loadFunction = function() {

var script2=document.createElement("link");
script2.setAttribute("rel", "stylesheet");
script2.setAttribute("type", "text/css");
script2.setAttribute("href", tapatalkdir+'/tapatalkdetect/notice.css');
script2.media='screen';
 
document.getElementsByTagName("head")[0].appendChild(script2);
var script3 = document.createElement('script');
script3.setAttribute('src',tapatalkdir+'/tapatalkdetect/jquery.purr.js');
script3.setAttribute('type','text/javascript');
script3.onload=loadFunction3;
document.getElementsByTagName("head")[0].appendChild(script3);

};
script1.onload = loadFunction;
document.getElementsByTagName("head")[0].appendChild(script1);
}
        }
    }
}

function setTapatalkCookies() {
var date = new Date();
var days = 90;
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+ date.toGMTString();
var domain = "; path=/";
document.cookie = "tapatalk_redirect4=false" + expires + domain;
}

detectTapatalk();

Offline SMF For Free

  • Administrator
  • *
  • Posts: 7304
    • View Profile
    • SMF For Free

  • Total Badges: 38
    Badges: (View All)
    Quick Poster Tenth year Anniversary Spammer 25 Posts in one day Nineth year Anniversary Eighth year Anniversary
Re: Javascript?
« Reply #1 on: July 17, 2014, 11:07:32 pm »
I would place it in the footer make sure you put script tags around the code.
SMF For Free-Free Simple Machines Forum hosting.
Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline davidjtsteele

  • SMF For Free Member
  • *
  • Posts: 27
    • View Profile

  • Total Badges: 11
    Badges: (View All)
    Level 3 One year Anniversary 10 Posts Search Level 2
Re: Javascript?
« Reply #2 on: July 18, 2014, 11:18:09 am »
What would you put around the code so it works?

Offline SMF For Free

  • Administrator
  • *
  • Posts: 7304
    • View Profile
    • SMF For Free

  • Total Badges: 38
    Badges: (View All)
    Quick Poster Tenth year Anniversary Spammer 25 Posts in one day Nineth year Anniversary Eighth year Anniversary
Re: Javascript?
« Reply #3 on: July 18, 2014, 11:42:59 am »
Code: [Select]
<script language="javascript">



</script>
SMF For Free-Free Simple Machines Forum hosting.
Like What I do? Support me at https://www.patreon.com/vbgamer45/

 

Related Topics

  Subject / Started by Replies Last post
20 Replies
14408 Views
Last post June 05, 2008, 06:34:37 am
by Crasy
2 Replies
8723 Views
Last post November 15, 2007, 06:55:07 pm
by mr_css
1 Replies
1512 Views
Last post January 05, 2008, 01:30:11 pm
by LaundryLady
3 Replies
13961 Views
Last post July 01, 2008, 10:20:57 am
by guest4485
2 Replies
1741 Views
Last post June 20, 2008, 05:41:35 am
by Supernovadelta