The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Theme Picker Issue

View previous topic View next topic Go down

Solved Theme Picker Issue

Post by Lady Galaxia on November 17th 2014, 1:29 am

Hello, I tried to install the theme picker via the javascript code management.

I have Javascript enabled and this code is set to "all pages"

Here is the link to the forum:

http://gcftester.forumotion.com/forum


Here is the code I am using:

Code:
$(function() {
      // disable the default stylesheet for better compatibility with themes
      // if you have modified templates styled with CSS it is better to choose : false
      var disable_default_stylesheet = true;

      // add new themes by writing : addTheme('theme_name', 'theme_url');
      // default themes below are for phpbb3, you can remove or modify them for other versions
      addTheme('Friendship Dark','http://gcftester.forumotion.com/forum?theme_id=205891');
      addTheme('Friendship Light','http://gcftester.forumotion.com/forum?theme_id=205892');
   
   
      var c = document.cookie.split(';'), dds = disable_default_stylesheet, s;
      for (i=0;i<c.length;i++) {
        if (/newtheme=\/\d+-ltr\.css/.test(c[i])) {
          var theme = c[i].replace(/newtheme=(\/\d+-ltr.css)/,'$1').replace(/\s/g,'');
          newSheet();
        if (window.localStorage) { $('#themeStyle').html(localStorage.selectedTheme); cleanStyle() }
          else $('#themeStyle').load(theme,function(){cleanStyle()});
          $('#themePicker option[value="'+theme+'"]').attr('selected','true');
        }
      }
   
      function addTheme(name, theme) {
        if (!document.getElementById('themePicker')) {
          var n = document.createElement('DIV'), d = document.createElement('OPTION');
        s = document.createElement('SELECT');
          n.innerHTML = '<span style="font-weight:bold;font-size:12px;vertical-align:middle;">Select theme&nbsp;:&nbsp;</span>';
          s.id = 'themePicker';
          d.value = $('head link[href$="-ltr.css"]').attr('href') + '(default)';
          d.innerHTML = 'Default';
          n.appendChild(s);
          s.appendChild(d);
          $('#page-footer, #pun-about, #gfooter').append(n);
        }
        var o = document.createElement('OPTION');
        o.value = theme.replace(/.*?(\d+)/,'/$1-ltr.css');
        o.innerHTML = name;
        s.appendChild(o);
      };
   
      s.onchange = function() {
        var date = new Date();
        date.setTime(date.getTime() + (365*24*60*60*1000));
        if (!document.getElementById('themeStyle')) newSheet();
        if (/\(default\)/.test(s.value)) {var v='default'; if ($('#themeStyle').html().length > 0 && dds==true) $('#themeStyle').load(s.value.replace(/\(default\)/,'')); else $('#themeStyle').html('')}
        else {var v=s.value; $('#themeStyle').load(s.value,function(){cleanStyle();if (window.localStorage) localStorage.selectedTheme = $('#themeStyle').html()})}
        document.cookie = 'newtheme='+v+'; expires='+date.toGMTString()+';';
      };
      function newSheet(){var t=document.createElement('STYLE'); t.id='themeStyle'; document.getElementsByTagName('HEAD')[0].appendChild(t)};
      function cleanStyle(){if($('head link[href$="-ltr.css"]').length && dds==true) $('head link[href$="-ltr.css"]').remove(); $('#themeStyle').html($('#themeStyle').html().replace(/#hitskin_preview.*/,''))};
    });

I have a modified "Overall_header" however I rest it to "default" to see if the code would work and it did not so it's currently set to what I normally use.


Do I need to do something else?

Lady Galaxia
Forumember

Posts : 34
Reputation : 0
Language : English

http://galaxycauldron.forumotion.com/

Back to top Go down

Solved Re: Theme Picker Issue

Post by Ange Tuteur on November 17th 2014, 1:38 am

Hello Lady Galaxia,

There is a syntax error on your forum causing your other scripts to stop working. The script(s) in question are these :
Code:
<script type="text/javascript"src="http://yourjavascript.com/7182956244/slides.min.jquery.js"></script><script>$(function(){$('#slides').slides({preload:true,preloadImage:'http://i1077.photobucket.com/albums/w467/galaxykakyuu/promo/loading_zps41b5ba34.gif',play:5000,pause:2500,hoverPause:true,animationStart:function(current){$('.caption').animate({bottom:-35},100);if(window.console&&console.log){console.log('animationStart on slide: ',current)}},animationComplete:function(current){$('.caption').animate({bottom:0},200);if(window.console&&console.log){console.log('animationComplete on slide: ',current)}},slidesLoaded:function(){$('.caption').animate({bottom:0},200)}})});</script>

They contain the <script> tag, which is used in HTML and not JavaScript files. Removing (these||this) script(s) should hopefully solve the error.

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2684
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Theme Picker Issue

Post by Ange Tuteur on November 17th 2014, 1:51 am

I see that you removed those scripts, but there is another error :

In your snow fall script the comment is missing its beginning : "/*" causing another error.

Line :
Code:
Snow Fall 1-no images-Java Script Visit http:for this script and many more*/

You can replace that portion with :
Code:
/*Snow Fall 1-no images-Java Script Visit http:for this script and many more*/

or remove it.

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2684
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Theme Picker Issue

Post by Lady Galaxia on November 17th 2014, 2:01 am

It was the snowfall js, Thank you!

Lady Galaxia
Forumember

Posts : 34
Reputation : 0
Language : English

http://galaxycauldron.forumotion.com/

Back to top Go down

Solved Re: Theme Picker Issue

Post by Ange Tuteur on November 17th 2014, 2:33 am

You're welcome

Topic archived

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2684
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum