TorrentFlux.com Welcome, Guest. Please login or register.
03-12-2010, 14:46:33
Home Help Search Login Register donate
TorrentFlux Home | TorrentFlux Hosting

+  TorrentFlux Forums
|-+  Code Hacks and Tools
| |-+  TorrentFlux 2.1 Hacks
| | |-+  Big bold drivespace warning. no popup!
« previous next »
Pages: [1] Go Down Print
Author Topic: Big bold drivespace warning. no popup!  (Read 1105 times)
FLX
Newbie
*
Offline Offline

Posts: 9



View Profile
« on: 05-17-2006, 03:39:53 »

Hey,

Personally i got pretty tired of the javascript popup as soon as my harddrive went full.
It is pretty annoying when you have torrentflux open i a browser, and every 60 seconds a warning popup comes up.
Ok, i have to admin that i could change the disable the pop interval or even the remove the popup itself, but i still wanted a reminder that i'm out of Gbs.

Anyway, i created a lame hack that shows a warning on the page itself in bold red letters, instead of an annoying popup.



yup, i also know that i already have a drivespace bar show the amount i have left, but personally i like a big)bold red warning Smiley

Anyway, on with the little hack.

Open index.php
Search for:
Code:
if($drivespace >= 98)
    {

        echo "\n\n<script  language=\"JavaScript\">\n alert(\""._WARNING.": ".$drivespace."% "._DRIVESPACEUSED."\")\n </script>";
    }

and change it to:
Code:
/*    if($drivespace >= 98)
    {

        echo "\n\n<script  language=\"JavaScript\">\n alert(\""._WARNING.": ".$drivespace."% "._DRIVESPACEUSED."\")\n </script>";
    }
*/

by this the popup will be disabled Smiley

Now to implement the big bold warning.
Search for the end of the table just before the torrent listing and add this above </table>:

Code:
<?php
//Big bold warning hack by FLX
if($drivespace >= 98){
    echo '<tr>
    <td bgcolor="'.$cfg['table_data_bg'].'" colspan="2" nowrap>
    <div align="center">
    <font face="Arial" size="2" color="red">
    <strong>
    Warning! ';
    echo $drivespace;
    echo '% drivespace is used! You have ';
    echo formatFreeSpace($cfg["free_space"]);
    echo ' left!
    </strong>
    </font>
    </div>
    </td>
    </tr> ';
} ?>

If you dont like that location, just put it somewhere else Smiley

I hope this helps you, and keep torrentflux going!

Regards,

FLX
« Last Edit: 05-17-2006, 06:34:57 by FLX » Logged
ryaner
Hero Member
*****
Offline Offline

TF Base: Linux 2.x
Posts: 919





View Profile
« Reply #1 on: 05-17-2006, 04:19:53 »

Nicely done and I must agree that the popup is the single most annoying thing about TF which is why it's the first thing I change.
Logged

SERVER: Debian Sarge 2.6.16| AMD XP2000+ | 1.5GB Ram  | 1.6T - Raid 5 | TF 2.1 | Apache 2.0.54 | PHP 4.3.10 | MySQL 4.1.11 | Mod/Hacks: XFER Transfer Stats/Multi Torrent Delete/Seed Time Hack/Ajax Details/Torrent Details/RSS Hack
Paczesiowa
Full Member
***
Offline Offline

TF Base: Linux 2.x
Posts: 177



View Profile
« Reply #2 on: 05-17-2006, 04:32:50 »

who doesn't:D
Logged

Pages: [1] Go Up Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by SMF 1.1.1 | SMF © 2006, Simple Machines LLC Powered by PHP