Speedy theme javascript problems

Başlatan flavio93zena, 24 Şub 2021 06:00

« önceki - sonraki »

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

*

  1. 4

  2. 1

Hi, first of all sorry but my Turkish is terrible, I'm not even going to try ;D
I registered here to help and get help with Speedy theme: https://custom.simplemachines.org/themes/index.php?lemma=2912
This theme is awesome, although I found 2 issues with it:

The first one was annoying but I managed to fix it myself, and it's about collapsed quick reply being collapsed by default even if set to be on.
File: Display.template.php
Kod (Find) Seç
<img src="', $settings['images_url'], '/', $options['display_quick_reply'] == 1 ? 'collapse' : 'expand', '.gif" alt="+" id="quickReplyExpand" class="icon" />
</a>
<a href="javascript:oQuickReply.swap();">', $txt['quick_reply'], '</a>
</span>
</h3>
</div>
<div id="quickReplyOptions"', $options['display_quick_reply'] == 1 ? '' : ' style="display: none"', '>
Kod (Replace with) Seç
<img src="', $settings['images_url'], '/', $options['display_quick_reply'] == 2 ? 'collapse' : 'expand', '.gif" alt="+" id="quickReplyExpand" class="icon" />
</a>
<a href="javascript:oQuickReply.swap();">', $txt['quick_reply'], '</a>
</span>
</h3>
</div>
<div id="quickReplyOptions"', $options['display_quick_reply'] == 2 ? '' : ' style="display: none"', '>
Same file:
Kod (Find) Seç
bDefaultCollapsed: ', !empty($options['display_quick_reply']) && $options['display_quick_reply'] == 1 ? 'false' : 'true', ',
Kod (Replace with) Seç
bDefaultCollapsed: ', !empty($options['display_quick_reply']) && $options['display_quick_reply'] == 2 ? 'false' : 'true', ',At the very least this fixed it for me.

The second one I unfortunately haven't managed to fix as of yet, it's a silly race condition that makes it so sometimes smileys/BBC in the quick reply are loaded and sometimes they are not, I suspect html template layer is not correctly called by javascript somewhere, but my javascript skills are much less than my php ones.

It produces this in the browser console, breaking both smileys and JumpToBox:
Uncaught ReferenceError: aJumpTo is not defined
Uncaught TypeError: this.opt.oSmileyLocations[sLocation][iSmileyRowIndex][iSmileyIndex].sSrc.php_htmlspecialchars is not a function
    at smc_SmileyBox.getSmileyRowsContent (editor.js?fin20:1431)
    at smc_SmileyBox.init (editor.js?fin20:1392)
    at new smc_SmileyBox (editor.js?fin20:1386)
    at index.php?topic=154221.new:914
It's really silly because it's a coin toss whether they load or not, you can literally press F5 and you get either result with no logical pattern. ALWAYS an error on first load after clearing the cache, so it's definitely some kind of race condition...

Any input would be deeply appreciated, because otherwise the theme is pretty solid. Thanks in advance!

*

  1. 4

  2. 1
The theme also doesn't replace icons in this page index.php?action=unreadreplies and index.php?action=unread because it doesn't have a Recent.template.php file.
To fix this, copy the default Recent.template.php and combine the code present in MessageIndex.template.php to replace these:
<p class="smalltext para2">
 <img src="', $settings['images_url'], '/icons/quick_lock.gif" alt="" align="middle" /> ', $txt['locked_topic'], '<br />', ($modSettings['enableStickyTopics'] == '1' ? '
 <img src="' . $settings['images_url'] . '/icons/quick_sticky.gif" alt="" align="middle" /> ' . $txt['sticky_topic'] . '<br />' : ''), ($modSettings['pollMode'] == '1' ? '
 <img src="' . $settings['images_url'] . '/topic/normal_poll.gif" alt="" align="middle" /> ' . $txt['poll'] : ''), '
 </p>
And
<p class="smalltext para2">
 <img src="', $settings['images_url'], '/icons/quick_lock.gif" alt="" align="middle" /> ', $txt['locked_topic'], '<br />', ($modSettings['enableStickyTopics'] == '1' ? '
 <img src="' . $settings['images_url'] . '/icons/quick_sticky.gif" alt="" align="middle" /> ' . $txt['sticky_topic'] . '<br />' : '') . ($modSettings['pollMode'] == '1' ? '
 <img src="' . $settings['images_url'] . '/topic/normal_poll.gif" alt="" align="middle" /> ' . $txt['poll'] : '') . '
 </p>

The font-awesome icons are, from MessageIndex.template.php:
<span class="icons">';

 if ($topic['is_locked'])
 echo '
 <i class="fa fa-lock floatright"></i>';
 if ($topic['is_sticky'])
 echo '
 <i class="fa fa-sticky floatright"></i>';

 if ($topic['is_poll'])
 echo '
 <i class="fa fa-post_poll floatright"></i>';
 echo '
 </span>';

*

  1. 1,131

  2. 105

  3. 331
24 Şub 2021 19:39 #2 Son düzenlenme: 24 Şub 2021 19:48 CeeMoo
Speedy/index.template.php Edit:
<script type="text/javascript" async="" src="', $settings['theme_url'], '/scripts/script.js?fin20"></script>Change:
<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js?fin20"></script>
And
Display.template.php
<script async="" type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/editor.js?fin20"></script>Change:
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/editor.js?fin20"></script>
You need Try...

*

  1. 4

  2. 1

Absolute legend, that fixed it! Thank you SO much!!! :D
I had removed editor.js from async load but didn't think about doing it for script.js!


MENU ×