Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Matthew K. on January 18, 2010, 05:42:38 PM

Title: Back to Top
Post by: Matthew K. on January 18, 2010, 05:42:38 PM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=2361)

Back to Top







Written by: Labradoodle-360 (http://www.simplemachines.org/community/index.php?action=profile;u=182638)
Current version: 1.1
Updates: Mod Support Topic
Suitable for: SMF 1.1.11, SMF 2.0 RC2, SMF 2.0 RC3
Supported languages: (https://www.simplemachines.org/site_images/lang/english.gif)

Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=2361) | Donate (https://www.paypal.com/cgi-bin/webscr&cmd=_s-xclick&hosted_button_id=10240245)





Summary

Back to Top adds an anchor to the top of index.template.php and a link in the footer of every page. Back to Top v1.1 now has the ability to toggle smoothscroll!

Installation

Package Manager should work in most cases. If you need to make any edits, the full list can be obtained from the Parse function on the right..

Useful links
Manual Installation Of Mods (http://docs.simplemachines.org/index.php?topic=402)
How Do I Modify Files? (http://www.simplemachines.org/community/index.php?topic=24110.0)

Support

Questions should be address to the mod support topic (http://www.simplemachines.org/community/index.php?topic=360874.0).

Updating

Version 1.1 adds it's own mod tab for toggling smoothscroll (SMF 2.0 Only), for SMF 1.1, the setting is added to Features and Options.
Mod is not utf-8 compatible.

Changelog

1.1 - 03.10.2010
Version 1.1 Released!

1.0 - 4 January 2010
First release of Back to Top

Files modified by Back to Top
./Sources/Admin.php (SMF 2.0 Only)
./Sources/Load.php
./Sources/ManageSettings.php (SMF 2.0 Only)
./Sources/ModSettings.php (SMF 1.1 Only)
./Themes/default/index.template.php
./Themes/default/languages/Modifications.english.php
smoothscroll.js added to either $themedir or $themedir/scripts depending on version of SMF.

Smoothscroll JavaScript: The smoothscroll.js file is from Kryogenix.org (http://www.kryogenix.org/code/browser/smoothscroll/).
Title: Re: Back to Top
Post by: Matthew K. on January 18, 2010, 10:06:45 PM
After updating the rest of my mods, I will go back and make a quick update to Back to Top, v1.1, will be compiled into one version instead of Regular and Smoothscroll, using an admin option to enable/disable the Smoothscroll effect.

Labradoodle-360
Title: Re: Back to Top
Post by: shakaran on February 06, 2010, 06:02:01 PM
This lines fails for me:
         <li class="last">
<a id="button_wap2" href="', $scripturl , '?wap2" class="new_win"><span>', $txt['wap2'], '</span></a>
</li>


Because the file $themedir/index.template.php have:

<li class="last"><a id="button_wap2" href="', $scripturl , '?wap2" class="new_win"><span>', $txt['wap2'], '</span></a></li>

I attach the file fixed for the install and I add the translation for spanish, spanish-utf8, spanish_es and spanish_es-utf8:
back_to_top_vrc2.xml
<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<id>Labradoodle-360:BackToTop</id>
<version>1.0</version>
<file name="$themedir/index.template.php">
<operation>
<search position="before"><![CDATA[
function template_body_above()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
]]></search>
<add><![CDATA[
echo '<a name="forum_top"></a>';
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[<li class="last"><a id="button_wap2" href="', $scripturl , '?wap2" class="new_win"><span>', $txt['wap2'], '</span></a></li>]]></search>
<add><![CDATA[
<br />
<li><a href="#forum_top">', $txt['back_to_top'], '</a></li>
]]></add>
</operation>
</file>
<file name="$sourcedir/Load.php">
<operation>
<search position="after"><![CDATA[
// Detect the browser. This is separated out because it's also used in attachment downloads
detectBrowser();
]]></search>
<add><![CDATA[
$context['html_headers'] .='<script type="text/javascript" src="'. $settings['default_theme_url']. '/scripts/smoothscroll.js"></script>';
]]></add>
</operation>
</file>
<file name="$themedir/languages/Modifications.english.php">
<operation>
<search position="end"></search>
<add><![CDATA[
// Labradoodle-360's Mod: Back to Top
$txt['back_to_top'] = 'Back to Top';
]]></add>
</operation>
</file>
<file name="$themedir/languages/Modifications.spanish.php" error="skip">
<operation>
<search position="end"></search>
<add><![CDATA[
// Labradoodle-360's Mod: Back to Top
$txt['back_to_top'] = 'Volver a arriba';
]]></add>
</operation>
</file>
<file name="$themedir/languages/Modifications.spanish-utf8.php" error="skip">
<operation>
<search position="end"></search>
<add><![CDATA[
// Labradoodle-360's Mod: Back to Top
$txt['back_to_top'] = 'Volver a arriba';
]]></add>
</operation>
</file>
<file name="$themedir/languages/Modifications.spanish_es.php" error="skip">
<operation>
<search position="end"></search>
<add><![CDATA[
// Labradoodle-360's Mod: Back to Top
$txt['back_to_top'] = 'Volver a arriba';
]]></add>
</operation>
</file>
<file name="$themedir/languages/Modifications.spanish_es-utf8.php" error="skip">
<operation>
<search position="end"></search>
<add><![CDATA[
// Labradoodle-360's Mod: Back to Top
$txt['back_to_top'] = 'Volver a arriba';
]]></add>
</operation>
</file>
</modification>


Title: Re: Back to Top
Post by: Matthew K. on February 06, 2010, 06:20:06 PM
What I would like to know, is why the SMF Customization Team have missed two issues with my mods (small as they are) yet there.

This, and a missing text string for another. Obviously I pulled up the wrong edit...

I appreciate the notification,
Labradoodle-360
Title: Re: Back to Top
Post by: Matthew K. on February 06, 2010, 08:52:00 PM
Version 1.1 Released! ;D

It combines the "Smoothscroll" and "Regular" versions into one version for ease, with a toggle in the admin panel to turn Smoothscroll on or off.

Also bringing SMF 2.0 RC3 compatibility, as well as utf-8 for English!
Spanish was not included, because of new language strings that had to be added.

Enjoy,
Labradoodle-360
Title: Re: Back to Top
Post by: iPhoneDestek on September 07, 2010, 08:13:46 AM
translation in turkish



//Back to Top translation by SirtLanVadisi.net
$txt['back_to_top_title'] = 'Yukarıya Git';
$txt['enable_smoothscroll'] = 'Smoothscroll açık';
$txt['back_to_top_desc'] = 'Yukarıya Git Düzenleme';
$txt['back_to_top_settings_title'] = 'Yukarıya Git Ayarları';
//Back to Top translation by SirtLanVadisi.net
Title: Re: Back to Top
Post by: FireDitto on September 11, 2010, 05:29:29 AM
Would it take a lot of effort, to have the "Return to Top" at the top of posts, so it would read similar to this:
"Quote, Modify, Remove, Return To Top"

I'm working on an RP thread, and the posts on such tend to get long.

Thanks =)
Title: Re: Back to Top
Post by: Matthew K. on September 11, 2010, 10:03:17 AM
No, take a peak at the code Back to Top adds in index.template.php for the actual link. Then add that link where you want it in Display.template.php
Title: Re: Back to Top
Post by: FireDitto on September 11, 2010, 11:35:48 PM
Ah, yes, very easy.

For anyone interested, I simply added this:

// can we return to top, please?
echo '
                                <li class="back_to_top_title"><a href="#forum_top">', $txt['back_to_top_title'], '</a></li>';


Where I wanted it to show up [in my case, at the end of the list of "Insert Quote" etc line.


EDIT: I can't seem to figure out how to make an image appear for it, however;

I changed the <li class="back_to_top_title"> to read <li class="up_button"> but I have no idea where to stick the image I made, as putting it in the theme's "button" folder doesn't appear to work. Am I missing something??
Title: Re: Back to Top
Post by: MS Modders Team on September 12, 2010, 01:23:32 AM
Here are the edits you will need to execute. (SMF 2.0 RC3)

./Themes/default/Display.template.php
Code (Find) Select

// If this is the first post, (#0) just say when it was posted - otherwise give the reply #.
if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'])
echo '
<ul class="reset smalltext quickbuttons">';

Code (Add After) Select

// SMF Modders; Back to Top
echo '
<li class="backtotop_button"><a href="#forum_top" target="_self">', $txt['back_to_top_title'], '</a></li>';


./Themes/default/css/index.css
Code (Find) Select

ul.quickbuttons a:hover
{
color: #a70;
}

Code (Add After) Select

/* SMF Modders; Back to Top */
ul.quickbuttons li.backtotop_button
{
background: url(../images/theme/back_to_top.png);
}


Moving the attached file (back_to_top.png) to .../images/theme if you don't already have an image to use.

Hope this helps,
SMF Modders Team
Title: Re: Back to Top
Post by: FireDitto on September 12, 2010, 02:22:23 AM
Beautiful. Thanks, =D
Title: Re: Back to Top
Post by: MS Modders Team on September 12, 2010, 02:36:04 AM
I apologize for the poor graphic quality. Glad to hear the code works out well for you :)

Best Regards,
SMF Modders Team
Title: Re: Back to Top
Post by: FireDitto on September 12, 2010, 03:03:53 AM
Naa, it's fine; I edited the "upshrink" image to fit the theme, and used it =D
Title: Re: Back to Top
Post by: Jayne Louise on January 12, 2011, 06:16:09 PM
Im having a small issue with this mod on RC3 and RC4. When I install it, the space at the top of the page increases. By default the space between the top of the forum (even here) to the top of the browser is about 5mm, when I install this mod it becomes about 1cm wide. This might seem petty but I have a banner at the top of the page and this increased space is messing it up.

Even on a fresh install Ive tried it with the same result.

Anything I can do to decrease the size at the top?
Title: Re: Back to Top
Post by: Matthew K. on January 13, 2011, 12:47:37 AM
This is simply an effect of the mod. As an anchor is put at the top which increases the space. Although I will work on a solution shortly.
Quote from: Jayne Louise on January 12, 2011, 06:16:09 PM
Im having a small issue with this mod on RC3 and RC4. When I install it, the space at the top of the page increases. By default the space between the top of the forum (even here) to the top of the browser is about 5mm, when I install this mod it becomes about 1cm wide. This might seem petty but I have a banner at the top of the page and this increased space is messing it up.

Even on a fresh install Ive tried it with the same result.

Anything I can do to decrease the size at the top?
Title: Re: Back to Top
Post by: barefoot on February 04, 2011, 09:10:15 PM
how can i add this return to top stuff to my ds- natural theme ?
Title: Re: Back to Top
Post by: Matthew K. on February 04, 2011, 10:57:22 PM
Manual Installation of Mods (http://docs.simplemachines.org/index.php?topic=402.0)
Title: Re: Back to Top
Post by: barefoot on February 05, 2011, 06:11:18 AM
Quote from: Labradoodle-360 on February 04, 2011, 10:57:22 PM
Manual Installation of Mods (http://docs.simplemachines.org/index.php?topic=402.0)


i already try to install it manually but there is no such a parameter like below in index.template.php file of theme my theme is ds natural
</head>
<body>';

or no paramaters like this:

<a href="http://jigsaw.w3.org/css-validator/check/referer" target="_blank"><img id="valid-css" src="', $settings
['images_url'], '/valid-css.gif" alt="', $txt['valid_css'], '" width="54" height="20" style="margin: 5px 16px;" onmouseover="smfFooterHighlight(this, true);" onmouseout="smfFooterHighlight(this, false);" /></a>
            </td>
         </tr>
      </table>';
Title: Re: Back to Top
Post by: NanoSector on February 05, 2011, 06:12:44 AM
woot, nice.

PS there are two "Link to mod" links in the topic.
Title: Re: Back to Top
Post by: barefoot on February 05, 2011, 01:16:19 PM
i am still waiting for someone to help me...:(
Title: Re: Back to Top
Post by: Matthew K. on February 05, 2011, 01:31:17 PM
If you attach your themes index.template.php, I will install that edit for you.
Title: Re: Back to Top
Post by: barefoot on February 05, 2011, 01:42:42 PM
Quote from: Labradoodle-360 on February 05, 2011, 01:31:17 PM
If you attach your themes index.template.php, I will install that edit for you.

here is my themes  index.template.php ... thanx alot :)  by the way  can we change it "back to top"  to " başa dön" ?
Title: Re: Back to Top
Post by: Matthew K. on February 05, 2011, 01:48:39 PM
Here you are
Title: Re: Back to Top
Post by: barefoot on February 05, 2011, 04:42:40 PM
Quote from: Labradoodle-360 on February 05, 2011, 01:48:39 PM
Here you are

thanx so much for your interest mate :)   i upload this file to my site via ftp. I saw the title  as "basa don"  but it is not working ! when i hit the text nothing happens. i changed specified files as you mentioned  at manuel install (parse) do you think this problem caused by the name changing? it was "back to top" but i asked for "basa don"  maybe this is the problem?
You can check it out here : beta.aero-model.net
Title: Re: Back to Top
Post by: Matthew K. on February 05, 2011, 05:52:43 PM
The anchor edit was probably not completed for your custom theme.
Title: Re: Back to Top
Post by: Matthew K. on February 05, 2011, 05:58:19 PM
Here you go
Title: Re: Back to Top
Post by: barefoot on February 06, 2011, 05:18:07 AM
Quote from: Labradoodle-360 on February 05, 2011, 05:58:19 PM
Here you go

Thank you so much . it is working :))
Title: Re: Back to Top
Post by: Matthew K. on February 06, 2011, 11:12:13 AM
Not a problem! Enjoy
Title: Re: Back to Top
Post by: steveraven on March 06, 2011, 07:47:31 AM
Any chance of this mod being upgraded to 2.0rc5?

I'm really missing the smooth scrolling!
Title: Re: Back to Top
Post by: Matthew K. on March 06, 2011, 10:31:12 AM
I'll update this for SMF 2.0 Final.
Title: Re: Back to Top
Post by: simon36 on April 13, 2012, 06:20:22 AM
Not working for 2.0.2 which is a shame.
Title: Re: Back to Top
Post by: NanoSector on April 13, 2012, 09:15:21 AM
What is not working?
Title: Re: Back to Top
Post by: simon36 on April 13, 2012, 09:16:41 AM
Does not install under 2.0.2
Title: Re: Back to Top
Post by: NanoSector on April 13, 2012, 09:23:40 AM
Any errors you are getting?
Title: Re: Back to Top
Post by: Matthew K. on April 13, 2012, 12:22:11 PM
It should work with 2.0.2 as far as I know...? Hmmmmm. Did you try using Version Emulate?
Title: Re: Back to Top
Post by: simon36 on April 14, 2012, 06:50:36 AM
Hi, I tried installing under 2.0.2 and get:

The package you are trying to download or install is either corrupt or not compatible with this version of SMF.
Title: Re: Back to Top
Post by: Robert. on April 14, 2012, 06:51:02 AM
Try this:
How can I install a mod that doesn't work in my SMF version? (http://wiki.simplemachines.org/smf/How_can_install_a_mod_that_doesn%27t_work_in_my_SMF_version)
Title: Re: Back to Top
Post by: simon36 on April 14, 2012, 06:52:20 AM
Hi, I do know how to version emulate but Labradoodle believes it should install under 2.0.2

Do you know which version I should emulate?
Title: Re: Back to Top
Post by: Robert. on April 14, 2012, 06:52:42 AM
2.0 RC3 would do fine :)
Title: Re: Back to Top
Post by: simon36 on April 14, 2012, 06:53:53 AM
Ok, thank you.
Title: Re: Back to Top
Post by: Robert. on April 14, 2012, 06:54:30 AM
You're welcome ;D
Title: Re: Back to Top
Post by: Ninja ZX-10RR on September 17, 2014, 09:43:57 AM
Thanks for the mod I really like it in long topics :) it also made me reach a very good achievement, this has been the 100th mod installed on my forum with no errors :D
For anyone wanting to use it without emulation (since you don't need it) just replace the back_to_top_vrc2.3.xml file of the mod with the one attached and it will install just fine ;)
Title: Re: Back to Top
Post by: Rk2910 on January 04, 2015, 12:10:28 PM
Ninj, what version of SMF are you running?  I tried to install on 2.0.9 and it said not compatible, tried to emulate to 2.0 RC3 and install tests fail so I didn't install.  I replaced the xml file with the one you posted and it still fails test install.
One of my tablet users asked for a mod like this.
Title: Re: Back to Top
Post by: Matthew K. on February 03, 2015, 10:38:03 AM
If install tests failed, it may not be compatible with some other modifications you have installed. You might have to manually install it if that's comfortable for you.