Browse Source

Replace inline JS gtoggles with html attributes and some global JS

End goal is to remove all inline JS, starting with onclick
spaghetti 8 years ago
parent
commit
20aae61a7d

+ 2
- 2
classes/debug.class.php View File

478
 ?>
478
 ?>
479
   <table class="layout" width="100%">
479
   <table class="layout" width="100%">
480
     <tr>
480
     <tr>
481
-      <td align="left"><strong><a href="#" onclick="$('#debug_ocelot').gtoggle(); return false;" class="brackets">View</a> <?=number_format(count($OcelotRequests))?> Ocelot requests:</strong></td>
481
+      <td align="left"><strong><a toggle-target="#debug_ocelot" class="brackets">View</a> <?=number_format(count($OcelotRequests))?> Ocelot requests:</strong></td>
482
     </tr>
482
     </tr>
483
   </table>
483
   </table>
484
   <table id="debug_ocelot" class="debug_table hidden" width="100%">
484
   <table id="debug_ocelot" class="debug_table hidden" width="100%">
485
 <?    foreach ($OcelotRequests as $i => $Request) { ?>
485
 <?    foreach ($OcelotRequests as $i => $Request) { ?>
486
     <tr>
486
     <tr>
487
       <td align="left" class="debug_data debug_ocelot_data">
487
       <td align="left" class="debug_data debug_ocelot_data">
488
-        <a href="#" onclick="$('#debug_ocelot_<?=$i?>').gtoggle(); return false"><?=display_str($Request['path'])?></a>
488
+        <a toggle-target="#debug_ocelot_<?=$i?>"><?=display_str($Request['path'])?></a>
489
         <pre id="debug_ocelot_<?=$i?>" class="hidden"><?=display_str($Request['response'])?></pre>
489
         <pre id="debug_ocelot_<?=$i?>" class="hidden"><?=display_str($Request['response'])?></pre>
490
       </td>
490
       </td>
491
       <td align="left" class="debug_info" style="width: 100px;">
491
       <td align="left" class="debug_info" style="width: 100px;">

+ 2
- 2
classes/donationsview.class.php View File

103
       <div class="box">
103
       <div class="box">
104
         <div class="head">
104
         <div class="head">
105
           <span><?=!empty($ProfileRewards['ProfileInfoTitle' . $i]) ? display_str($ProfileRewards['ProfileInfoTitle' . $i]) : "Extra Profile " . ($i + 1)?></span>
105
           <span><?=!empty($ProfileRewards['ProfileInfoTitle' . $i]) ? display_str($ProfileRewards['ProfileInfoTitle' . $i]) : "Extra Profile " . ($i + 1)?></span>
106
-          <span style="float: right;"><a href="#" onclick="$('#profilediv_<?=$i?>').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets">Hide</a></span>
106
+          <span style="float: right;"><a toggle-target="#profilediv_<?=$i?>" toggle-replace="Show" class="brackets">Hide</a></span>
107
         </div>
107
         </div>
108
         <div class="pad profileinfo" id="profilediv_<?=$i?>">
108
         <div class="pad profileinfo" id="profilediv_<?=$i?>">
109
 <?          echo Text::full_format($ProfileRewards['ProfileInfo' . $i]); ?>
109
 <?          echo Text::full_format($ProfileRewards['ProfileInfo' . $i]); ?>
121
 ?>
121
 ?>
122
     <div class="box box2" id="donation_history_box">
122
     <div class="box box2" id="donation_history_box">
123
       <div class="head">
123
       <div class="head">
124
-        Donation History <a href="#" onclick="$('#donation_history').gtoggle(); return false;" class="brackets" style="float: right;">Toggle</a>
124
+        Donation History <a toggle-target="#donation_history" class="brackets" style="float: right;">Toggle</a>
125
       </div>
125
       </div>
126
       <div class="hidden" id="donation_history">
126
       <div class="hidden" id="donation_history">
127
         <table cellpadding="6" cellspacing="1" border="0" class="border" width="100%">
127
         <table cellpadding="6" cellspacing="1" border="0" class="border" width="100%">

+ 2
- 2
classes/testingview.class.php View File

56
         <div class="head">
56
         <div class="head">
57
           <span><?=self::render_method_definition($Method)?></span>
57
           <span><?=self::render_method_definition($Method)?></span>
58
           <span style="float: right;">
58
           <span style="float: right;">
59
-            <a href="#" class="brackets" onclick="$('#method_params_<?=$Index?>').gtoggle(); return false;">Params</a>
59
+            <a toggle-target="#method_params_<?=$Index?>" class="brackets">Params</a>
60
             <a href="#" class="brackets run" data-gazelle-id="<?=$Index?>" data-gazelle-class="<?=$ClassName?>" data-gazelle-method="<?=$MethodName?>">Run</a>
60
             <a href="#" class="brackets run" data-gazelle-id="<?=$Index?>" data-gazelle-class="<?=$ClassName?>" data-gazelle-method="<?=$MethodName?>">Run</a>
61
           </span>
61
           </span>
62
         </div>
62
         </div>
172
     echo $Results;
172
     echo $Results;
173
   }
173
   }
174
 
174
 
175
-}
175
+}

+ 1
- 1
design/views/generic/reply/staffpm.php View File

22
 
22
 
23
         <input type="button" value="Preview" class="hidden button_preview_<?=$TextPrev->getID()?>" />
23
         <input type="button" value="Preview" class="hidden button_preview_<?=$TextPrev->getID()?>" />
24
         <input type="submit" value="Send message" />
24
         <input type="submit" value="Send message" />
25
-        <input type="button" value="Hide" onclick="$('#compose').gtoggle(); return false;" />
25
+        <input type="button" value="Hide" toggle-target="#compose" />
26
       </form>
26
       </form>
27
     </div>
27
     </div>

+ 2
- 2
sections/artist/artist.php View File

630
       <div id="info" class="head">
630
       <div id="info" class="head">
631
         <a href="#">&uarr;</a>&nbsp;
631
         <a href="#">&uarr;</a>&nbsp;
632
         <strong>Information</strong>
632
         <strong>Information</strong>
633
-        <a href="#" class="brackets" onclick="$('#body').gtoggle(); return false;">Toggle</a>
633
+        <a class="brackets" toggle-target="#body">Toggle</a>
634
       </div>
634
       </div>
635
       <div id="body" class="body"><?=Text::full_format($Body)?></div>
635
       <div id="body" class="body"><?=Text::full_format($Body)?></div>
636
     </div>
636
     </div>
656
     $Range = range(0,count($Collages) - 1);
656
     $Range = range(0,count($Collages) - 1);
657
     shuffle($Range);
657
     shuffle($Range);
658
     $Indices = array_slice($Range, 0, MAX_COLLAGES);
658
     $Indices = array_slice($Range, 0, MAX_COLLAGES);
659
-    $SeeAll = ' <a href="#" onclick="$(\'.collage_rows\').gtoggle(); return false;">(See all)</a>';
659
+    $SeeAll = ' <a toggle-target=".collage_rows">(See all)</a>';
660
   } else {
660
   } else {
661
     $Indices = range(0, count($Collages)-1);
661
     $Indices = range(0, count($Collages)-1);
662
     $SeeAll = '';
662
     $SeeAll = '';

+ 1
- 1
sections/forums/forum.php View File

87
 <? if (Forums::check_forumperm($ForumID, 'Write') && Forums::check_forumperm($ForumID, 'Create')) { ?>
87
 <? if (Forums::check_forumperm($ForumID, 'Write') && Forums::check_forumperm($ForumID, 'Create')) { ?>
88
     <a href="forums.php?action=new&amp;forumid=<?=$ForumID?>" class="brackets">New thread</a>
88
     <a href="forums.php?action=new&amp;forumid=<?=$ForumID?>" class="brackets">New thread</a>
89
 <? } ?>
89
 <? } ?>
90
-    <a href="#" onclick="$('#searchforum').gtoggle(); this.innerHTML = (this.innerHTML == 'Search this forum' ? 'Hide search' : 'Search this forum'); return false;" class="brackets">Search this forum</a>
90
+    <a toggle-target="#searchforum" toggle-replace="Hide search" class="brackets">Search this forum</a>
91
     <div id="searchforum" class="hidden center">
91
     <div id="searchforum" class="hidden center">
92
       <div style="display: inline-block;">
92
       <div style="display: inline-block;">
93
         <h3>Search this forum:</h3>
93
         <h3>Search this forum:</h3>

+ 2
- 2
sections/forums/newthread.php View File

35
     </div>
35
     </div>
36
 <?  if (check_perms('forums_polls_create')) { ?>
36
 <?  if (check_perms('forums_polls_create')) { ?>
37
     <div class="box thin clear hidden" id="pollpreview">
37
     <div class="box thin clear hidden" id="pollpreview">
38
-      <div class="head colhead_dark"><strong>Poll</strong> <a href="#" onclick="$('#threadpoll').gtoggle(); return false;" class="brackets">View</a></div>
38
+      <div class="head colhead_dark"><strong>Poll</strong> <a toggle-target="#threadpoll" class="brackets">View</a></div>
39
       <div class="pad" id="threadpoll">
39
       <div class="pad" id="threadpoll">
40
         <p><strong id="pollquestion"></strong></p>
40
         <p><strong id="pollquestion"></strong></p>
41
         <div id="pollanswers"></div>
41
         <div id="pollanswers"></div>
135
         <tr>
135
         <tr>
136
           <td colspan="2" class="center">
136
           <td colspan="2" class="center">
137
             <strong>Poll Settings</strong>
137
             <strong>Poll Settings</strong>
138
-            <a href="#" onclick="$('#poll_question, #poll_answers').gtoggle(); return false;" class="brackets">View</a>
138
+            <a toggle-target="#poll_question, #poll_answers" class="brackets">View</a>
139
           </td>
139
           </td>
140
         </tr>
140
         </tr>
141
         <tr id="poll_question" class="hidden">
141
         <tr id="poll_question" class="hidden">

+ 1
- 1
sections/forums/search.php View File

334
 <?
334
 <?
335
   }
335
   }
336
   if ($Type == 'body') { ?>
336
   if ($Type == 'body') { ?>
337
-        <a href="#" onclick="$('#post_<?=$PostID?>_text').gtoggle(); return false;">(Show)</a> <span style="float: right;" class="tooltip last_read" title="Jump to post"><a href="forums.php?action=viewthread&amp;threadid=<?=$ID?><? if (!empty($PostID)) { echo "&amp;postid=$PostID#post$PostID"; } ?>"></a></span>
337
+        <a toggle-target="#post_<?=$PostID?>_text">(Show)</a> <span style="float: right;" class="tooltip last_read" title="Jump to post"><a href="forums.php?action=viewthread&amp;threadid=<?=$ID?><? if (!empty($PostID)) { echo "&amp;postid=$PostID#post$PostID"; } ?>"></a></span>
338
 <?  } ?>
338
 <?  } ?>
339
       </td>
339
       </td>
340
       <td>
340
       <td>

+ 3
- 3
sections/forums/thread.php View File

179
     <div class="center">
179
     <div class="center">
180
       <a href="reports.php?action=report&amp;type=thread&amp;id=<?=$ThreadID?>" class="brackets">Report thread</a>
180
       <a href="reports.php?action=report&amp;type=thread&amp;id=<?=$ThreadID?>" class="brackets">Report thread</a>
181
       <a href="#" onclick="Subscribe(<?=$ThreadID?>);return false;" id="subscribelink<?=$ThreadID?>" class="brackets"><?=(in_array($ThreadID, $UserSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a>
181
       <a href="#" onclick="Subscribe(<?=$ThreadID?>);return false;" id="subscribelink<?=$ThreadID?>" class="brackets"><?=(in_array($ThreadID, $UserSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a>
182
-      <a href="#" onclick="$('#searchthread').gtoggle(); this.innerHTML = (this.innerHTML == 'Search this thread' ? 'Hide search' : 'Search this thread'); return false;" class="brackets">Search this thread</a>
182
+      <a toggle-target="#searchthread" toggle-replace="Hide search" class="brackets">Search this thread</a>
183
     </div>
183
     </div>
184
     <div id="searchthread" class="hidden center">
184
     <div id="searchthread" class="hidden center">
185
       <div style="display: inline-block;">
185
       <div style="display: inline-block;">
548
   $Notes = G::$DB->to_array();
548
   $Notes = G::$DB->to_array();
549
 ?>
549
 ?>
550
   <br />
550
   <br />
551
-  <h3 id="thread_notes">Thread notes</h3> <a href="#" onclick="$('#thread_notes_table').gtoggle(); return false;" class="brackets">Toggle</a>
551
+  <h3 id="thread_notes">Thread notes</h3> <a toggle-target="#thread_notes_table" class="brackets">Toggle</a>
552
   <form action="forums.php" method="post">
552
   <form action="forums.php" method="post">
553
     <input type="hidden" name="action" value="take_topic_notes" />
553
     <input type="hidden" name="action" value="take_topic_notes" />
554
     <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
554
     <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
582
       <tr>
582
       <tr>
583
         <td class="label"><label for="sticky_thread_checkbox">Sticky</label></td>
583
         <td class="label"><label for="sticky_thread_checkbox">Sticky</label></td>
584
         <td>
584
         <td>
585
-          <input type="checkbox" id="sticky_thread_checkbox" onclick="$('#ranking_row').gtoggle();" name="sticky"<? if ($ThreadInfo['IsSticky']) { echo ' checked="checked"'; } ?> tabindex="2" />
585
+          <input type="checkbox" id="sticky_thread_checkbox" toggle-target="#ranking_row" name="sticky"<? if ($ThreadInfo['IsSticky']) { echo ' checked="checked"'; } ?> tabindex="2" />
586
         </td>
586
         </td>
587
       </tr>
587
       </tr>
588
       <tr id="ranking_row"<?=!$ThreadInfo['IsSticky'] ? ' class="hidden"' : ''?>>
588
       <tr id="ranking_row"<?=!$ThreadInfo['IsSticky'] ? ' class="hidden"' : ''?>>

+ 2
- 2
sections/index/private.php View File

457
   <div class="box" id="recommended">
457
   <div class="box" id="recommended">
458
     <div class="head colhead_dark">
458
     <div class="head colhead_dark">
459
       <strong>Latest Vanity House additions</strong>
459
       <strong>Latest Vanity House additions</strong>
460
-      <a href="#" onclick="$('#vanityhouse').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets">Show</a>
460
+      <a toggle-target="#vanityhouse", toggle-replace="Hide" class="brackets">Show</a>
461
     </div>
461
     </div>
462
 
462
 
463
     <table class="torrent_table hidden" id="vanityhouse">
463
     <table class="torrent_table hidden" id="vanityhouse">
504
 <?  if (check_perms('admin_manage_news')) { ?>
504
 <?  if (check_perms('admin_manage_news')) { ?>
505
         - <a href="tools.php?action=editnews&amp;id=<?=$NewsID?>" class="brackets">Edit</a>
505
         - <a href="tools.php?action=editnews&amp;id=<?=$NewsID?>" class="brackets">Edit</a>
506
 <?  } ?>
506
 <?  } ?>
507
-      <span style="float: right;"><a href="#" onclick="$('#newsbody<?=$NewsID?>').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets">Hide</a></span>
507
+      <span style="float: right;"><a toggle-target="#newsbody<?=$NewsID?>" toggle-replace="Show" class="brackets">Hide</a></span>
508
       </div>
508
       </div>
509
       <div id="newsbody<?=$NewsID?>" class="pad"><?=Text::full_format($Body)?></div>
509
       <div id="newsbody<?=$NewsID?>" class="pad"><?=Text::full_format($Body)?></div>
510
     </div>
510
     </div>

+ 1
- 1
sections/staff/index.php View File

18
     <h3>Contact Staff</h3>
18
     <h3>Contact Staff</h3>
19
     <div id="below_box">
19
     <div id="below_box">
20
       <p>If you are looking for help with a general question, we appreciate it if you would only message through the staff inbox, where we can all help you.</p>
20
       <p>If you are looking for help with a general question, we appreciate it if you would only message through the staff inbox, where we can all help you.</p>
21
-      <p>You can do that by <strong><a href="#" onclick="$('#compose').gtoggle(); return false;">sending a message to the Staff Inbox</a></strong>.</p>
21
+      <p>You can do that by <strong><a toggle-target="#compose">sending a message to the Staff Inbox</a></strong>.</p>
22
     </div>
22
     </div>
23
     <? View::parse('generic/reply/staffpm.php', array('Hidden' => true)); ?>
23
     <? View::parse('generic/reply/staffpm.php', array('Hidden' => true)); ?>
24
 <? if ($FrontLineSupport) { ?>
24
 <? if ($FrontLineSupport) { ?>

+ 1
- 1
sections/staffblog/index.php View File

85
       <div class="head">
85
       <div class="head">
86
         <?=((empty($_GET['action'])) ? 'Create a staff blog post' : 'Edit staff blog post')?>
86
         <?=((empty($_GET['action'])) ? 'Create a staff blog post' : 'Edit staff blog post')?>
87
         <span style="float: right;">
87
         <span style="float: right;">
88
-          <a href="#" onclick="$('#postform').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets"><?=(($_REQUEST['action'] != 'editblog') ? 'Show' : 'Hide')?></a>
88
+          <a toggle-target="#postform" toggle-replace="<?=(($_REQUEST['action'] != 'editblog') ? 'Hide' : 'Show')?>" class="brackets"><?=(($_REQUEST['action'] != 'editblog') ? 'Show' : 'Hide')?></a>
89
         </span>
89
         </span>
90
       </div>
90
       </div>
91
       <form class="<?=((empty($_GET['action'])) ? 'create_form' : 'edit_form')?>" name="blog_post" action="staffblog.php" method="post">
91
       <form class="<?=((empty($_GET['action'])) ? 'create_form' : 'edit_form')?>" name="blog_post" action="staffblog.php" method="post">

+ 1
- 1
sections/staffpm/user_inbox.php View File

24
   <div class="header">
24
   <div class="header">
25
     <h2>Staff PMs</h2>
25
     <h2>Staff PMs</h2>
26
     <div class="linkbox">
26
     <div class="linkbox">
27
-      <a href="#" onclick="$('#compose').gtoggle();" class="brackets">Compose new</a>
27
+      <a toggle-target="#compose" class="brackets">Compose new</a>
28
     </div>
28
     </div>
29
   </div>
29
   </div>
30
   <br />
30
   <br />

+ 2
- 2
sections/staffpm/viewconv.php View File

232
   if ($Status != 'Resolved') { ?>
232
   if ($Status != 'Resolved') { ?>
233
           <input type="button" value="Resolve" onclick="location.href='staffpm.php?action=resolve&amp;id=<?=$ConvID?>';" />
233
           <input type="button" value="Resolve" onclick="location.href='staffpm.php?action=resolve&amp;id=<?=$ConvID?>';" />
234
 <?    if ($IsFLS) { //Moved by request ?>
234
 <?    if ($IsFLS) { //Moved by request ?>
235
-          <input type="button" value="Common answers" onclick="$('#common_answers').gtoggle();" />
235
+          <input type="button" value="Common answers" toggle-target="#common_answers" />
236
 <?    } ?>
236
 <?    } ?>
237
           <input type="button" id="previewbtn" value="Preview" class="hidden button_preview_<?=$TextPrev->getID()?>" />
237
           <input type="button" id="previewbtn" value="Preview" class="hidden button_preview_<?=$TextPrev->getID()?>" />
238
           <input type="submit" value="Send message" />
238
           <input type="submit" value="Send message" />
242
   }
242
   }
243
   if (check_perms('users_give_donor')) { ?>
243
   if (check_perms('users_give_donor')) { ?>
244
           <br />
244
           <br />
245
-          <input type="button" value="Make Donor" onclick="$('#make_donor_form').gtoggle(); return false;" />
245
+          <input type="button" value="Make Donor" toggle-target="#make_donor_form" />
246
 <?  } ?>
246
 <?  } ?>
247
         </form>
247
         </form>
248
 <?  if (check_perms('users_give_donor')) { ?>
248
 <?  if (check_perms('users_give_donor')) { ?>

+ 2
- 2
sections/tools/managers/enable_requests.php View File

139
     <a class="brackets tooltip" href="tools.php?action=enable_requests&amp;view=invalid_email&amp;<?=Format::get_url(array('view', 'action'))?>" title="Non-matching email address">Invalid Email</a>
139
     <a class="brackets tooltip" href="tools.php?action=enable_requests&amp;view=invalid_email&amp;<?=Format::get_url(array('view', 'action'))?>" title="Non-matching email address">Invalid Email</a>
140
     <a class="brackets tooltip" href="tools.php?action=enable_requests&amp;view=ip_overlap&amp;<?=Format::get_url(array('view', 'action'))?>" title="Requests with IP matches to other accounts">IP Overlap</a>
140
     <a class="brackets tooltip" href="tools.php?action=enable_requests&amp;view=ip_overlap&amp;<?=Format::get_url(array('view', 'action'))?>" title="Requests with IP matches to other accounts">IP Overlap</a>
141
     <a class="brackets tooltip" href="tools.php?action=enable_requests&amp;view=manual_disable&amp;<?=Format::get_url(array('view', 'action'))?>" title="Requests for accounts that were not disabled for inactivity">Manual Disable</a>
141
     <a class="brackets tooltip" href="tools.php?action=enable_requests&amp;view=manual_disable&amp;<?=Format::get_url(array('view', 'action'))?>" title="Requests for accounts that were not disabled for inactivity">Manual Disable</a>
142
-    <a class="brackets tooltip" href="" title="Show/Hide Search" onclick="$('#search_form').gtoggle(); return false;">Search</a>
143
-    <a class="brackets tooltip" href="" title="Show/Hide Search" onclick="$('#scores').gtoggle(); return false;">Scores</a>
142
+    <a class="brackets tooltip" title="Show/Hide Search" toggle-target="#search_form">Search</a>
143
+    <a class="brackets tooltip" title="Show/Hide Search" toggle-target="#scores">Scores</a>
144
 </div><br />
144
 </div><br />
145
 <div class="thin">
145
 <div class="thin">
146
     <table id="scores" class="hidden" style="width: 50%; margin: 0 auto;">
146
     <table id="scores" class="hidden" style="width: 50%; margin: 0 auto;">

+ 1
- 1
sections/torrents/browse.php View File

387
       <table class="layout cat_list" width="100%">
387
       <table class="layout cat_list" width="100%">
388
         <tr>
388
         <tr>
389
           <td class="label">
389
           <td class="label">
390
-            <a class="brackets" href="#" onclick="$('#taglist').gtoggle(); if (this.innerHTML == 'View tags') { this.innerHTML = 'Hide tags'; } else { this.innerHTML = 'View tags'; }; return false;"><?=(empty($LoggedUser['ShowTags']) ? 'View tags' : 'Hide tags')?></a>
390
+            <a class="brackets" toggle-target="#taglist" toggle-replace="<?=(empty($LoggedUser['ShowTags']) ? 'Hide tags' : 'View tags')?>"><?=(empty($LoggedUser['ShowTags']) ? 'View tags' : 'Hide tags')?></a>
391
           </td>
391
           </td>
392
         </tr>
392
         </tr>
393
       </table>
393
       </table>

+ 6
- 6
sections/torrents/details.php View File

540
 <?  }?>
540
 <?  }?>
541
             | <a href="torrents.php?torrentid=<?=$TorrentID ?>" class="tooltip" title="Permalink">PL</a>
541
             | <a href="torrents.php?torrentid=<?=$TorrentID ?>" class="tooltip" title="Permalink">PL</a>
542
           ]</span>
542
           ]</span>
543
-          &raquo; <a href="#" onclick="$('#torrent_<?=$TorrentID?>').gtoggle(); return false;"><?=$ExtraInfo; ?></a>
543
+          &raquo; <a toggle-target="#torrent_<?=$TorrentID?>"><?=$ExtraInfo; ?></a>
544
         </td>
544
         </td>
545
         <td class="number_column nobr"><?=Format::get_size($Size)?></td>
545
         <td class="number_column nobr"><?=Format::get_size($Size)?></td>
546
         <td class="number_column"><?=number_format($Snatched)?></td>
546
         <td class="number_column"><?=number_format($Snatched)?></td>
625
     <div class="box">
625
     <div class="box">
626
       <div class="head">
626
       <div class="head">
627
         <span style="font-weight: bold;">Requests (<?=number_format(count($Requests))?>)</span>
627
         <span style="font-weight: bold;">Requests (<?=number_format(count($Requests))?>)</span>
628
-        <a href="#" style="float: right;" onclick="$('#requests').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets">Show</a>
628
+        <a toggle-target="#requests" toggle-replace="Hide" style="float: right;" class="brackets">Show</a>
629
       </div>
629
       </div>
630
       <table id="requests" class="request_table hidden">
630
       <table id="requests" class="request_table hidden">
631
         <tr class="colhead">
631
         <tr class="colhead">
674
     $Range = range(0, count($Collages) - 1);
674
     $Range = range(0, count($Collages) - 1);
675
     shuffle($Range);
675
     shuffle($Range);
676
     $Indices = array_slice($Range, 0, MAX_COLLAGES);
676
     $Indices = array_slice($Range, 0, MAX_COLLAGES);
677
-    $SeeAll = ' <a href="#" onclick="$(\'.collage_rows\').gtoggle(); return false;">(See all)</a>';
677
+    $SeeAll = ' <a toggle-target=".collage_rows">(See all)</a>';
678
   } else {
678
   } else {
679
     $Indices = range(0, count($Collages) - 1);
679
     $Indices = range(0, count($Collages) - 1);
680
     $SeeAll = '';
680
     $SeeAll = '';
725
     $Range = range(0,count($PersonalCollages) - 1);
725
     $Range = range(0,count($PersonalCollages) - 1);
726
     shuffle($Range);
726
     shuffle($Range);
727
     $Indices = array_slice($Range, 0, MAX_PERS_COLLAGES);
727
     $Indices = array_slice($Range, 0, MAX_PERS_COLLAGES);
728
-    $SeeAll = ' <a href="#" onclick="$(\'.personal_rows\').gtoggle(); return false;">(See all)</a>';
728
+    $SeeAll = ' <a toggle-target=".personal_rows">(See all)</a>';
729
   } else {
729
   } else {
730
     $Indices = range(0, count($PersonalCollages) - 1);
730
     $Indices = range(0, count($PersonalCollages) - 1);
731
     $SeeAll = '';
731
     $SeeAll = '';
769
 <?
769
 <?
770
     if (count($Screenshots) > 0) {
770
     if (count($Screenshots) > 0) {
771
 ?>
771
 ?>
772
-    <a style="float: right;" class='brackets' onclick="$('.torrent_screenshots').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide');">Show</a>
773
-<?   }
772
+    <a style="float: right;" class='brackets' toggle-target=".torrent_screenshots" toggle-replace="Hide">Show</a>
773
+<?  }
774
 
774
 
775
     $DB->query("
775
     $DB->query("
776
       SELECT UserID
776
       SELECT UserID

+ 1
- 1
sections/torrents/functions.php View File

403
 <?  } ?>
403
 <?  } ?>
404
               | <a href="torrents.php?torrentid=<?=($TorrentID)?>" class="tooltip" title="Permalink">PL</a>
404
               | <a href="torrents.php?torrentid=<?=($TorrentID)?>" class="tooltip" title="Permalink">PL</a>
405
             ]</span>
405
             ]</span>
406
-            &raquo; <a href="#" onclick="$('#torrent_<?=($TorrentID)?>').gtoggle(); return false;"><?=($ExtraInfo)?></a>
406
+            &raquo; <a toggle-target="#torrent_<?=($TorrentID)?>"><?=($ExtraInfo)?></a>
407
           </td>
407
           </td>
408
           <td class="number_column nobr"><?=(Format::get_size($Size))?></td>
408
           <td class="number_column nobr"><?=(Format::get_size($Size))?></td>
409
           <td class="number_column"><?=(number_format($Snatched))?></td>
409
           <td class="number_column"><?=(number_format($Snatched))?></td>

+ 1
- 1
sections/torrents/voter_picks.php View File

39
 ?>
39
 ?>
40
     <table class="box vote_matches_table" id="vote_matches">
40
     <table class="box vote_matches_table" id="vote_matches">
41
       <tr class="colhead">
41
       <tr class="colhead">
42
-        <td><a href="#">&uarr;</a>&nbsp;People who like this also liked... <a href="#" onclick="$('.votes_rows').gtoggle(); return false;" class="brackets" style="float: right;">Toggle</a></td>
42
+        <td><a href="#">&uarr;</a>&nbsp;People who like this also liked... <a toggle-target=".votes_rows" class="brackets" style="float: right;">Toggle</a></td>
43
       </tr>
43
       </tr>
44
 <?
44
 <?
45
   $Top10Groups = array_keys($Top10);
45
   $Top10Groups = array_keys($Top10);

+ 1
- 1
sections/upload/upload.php View File

112
   <p><?=$NewDNU ? '<strong class="important_text">' : '' ?>Last updated: <?=time_diff($Updated)?><?=$NewDNU ? '</strong>' : '' ?></p>
112
   <p><?=$NewDNU ? '<strong class="important_text">' : '' ?>Last updated: <?=time_diff($Updated)?><?=$NewDNU ? '</strong>' : '' ?></p>
113
   <p>The following releases are currently forbidden from being uploaded to the site. Do not upload them unless your torrent meets a condition specified in the comment.
113
   <p>The following releases are currently forbidden from being uploaded to the site. Do not upload them unless your torrent meets a condition specified in the comment.
114
 <?  if ($HideDNU) { ?>
114
 <?  if ($HideDNU) { ?>
115
-  <span id="showdnu"><a href="#" onclick="$('#dnulist').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets">Show</a></span>
115
+  <span id="showdnu"><a toggle-target="#dnulist" toggle-replace="Hide" class="brackets">Show</a></span>
116
 <?  } ?>
116
 <?  } ?>
117
   </p>
117
   </p>
118
   <table id="dnulist" class="<?=($HideDNU ? 'hidden' : '')?>">
118
   <table id="dnulist" class="<?=($HideDNU ? 'hidden' : '')?>">

+ 1
- 1
sections/user/linkedfunctions.php View File

197
       <input type="hidden" id="form_comment_hash" name="form_comment_hash" value="<?=$CommentHash?>" />
197
       <input type="hidden" id="form_comment_hash" name="form_comment_hash" value="<?=$CommentHash?>" />
198
       <div class="box box2" id="l_a_box">
198
       <div class="box box2" id="l_a_box">
199
         <div class="head">
199
         <div class="head">
200
-          Linked Accounts (<?=max($DupeCount - 1, 0)?>) <span style="float: right;"><a href="#" onclick="$('.linkedaccounts').gtoggle(); return false;" class="brackets">Toggle</a></span>
200
+          Linked Accounts (<?=max($DupeCount - 1, 0)?>) <span style="float: right;"><a toggle-target=".linkedaccounts" class="brackets">Toggle</a></span>
201
         </div>
201
         </div>
202
         <table width="100%" class="layout hidden linkedaccounts">
202
         <table width="100%" class="layout hidden linkedaccounts">
203
           <?=($DupeCount ? "<tr>\n" : '')?>
203
           <?=($DupeCount ? "<tr>\n" : '')?>

+ 1
- 1
sections/user/notify_edit.php View File

89
     <a href="feeds.php?feed=torrents_notify_<?=$N['ID']?>_<?=$LoggedUser['torrent_pass']?>&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;name=<?=urlencode($N['Label'])?>"><img src="<?=STATIC_SERVER?>/common/symbols/rss.png" alt="RSS feed" /></a>
89
     <a href="feeds.php?feed=torrents_notify_<?=$N['ID']?>_<?=$LoggedUser['torrent_pass']?>&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;name=<?=urlencode($N['Label'])?>"><img src="<?=STATIC_SERVER?>/common/symbols/rss.png" alt="RSS feed" /></a>
90
     <?=display_str($N['Label'])?>
90
     <?=display_str($N['Label'])?>
91
     <a href="user.php?action=notify_delete&amp;id=<?=$N['ID']?>&amp;auth=<?=$LoggedUser['AuthKey']?>" onclick="return confirm('Are you sure you want to delete this notification filter?')" class="brackets">Delete</a>
91
     <a href="user.php?action=notify_delete&amp;id=<?=$N['ID']?>&amp;auth=<?=$LoggedUser['AuthKey']?>" onclick="return confirm('Are you sure you want to delete this notification filter?')" class="brackets">Delete</a>
92
-    <a href="#" onclick="$('#filter_<?=$N['ID']?>').gtoggle(); return false;" class="brackets">Show</a>
92
+    <a toggle-target="#filter_<?=$N['ID']?>" class="brackets">Show</a>
93
   </h3>
93
   </h3>
94
 <?  } ?>
94
 <?  } ?>
95
   <form class="box pad slight_margin <?=($NewFilter ? 'create_form' : 'edit_form')?>" id="<?=($NewFilter ? 'filter_form' : '')?>" name="notification" action="user.php" method="post">
95
   <form class="box pad slight_margin <?=($NewFilter ? 'create_form' : 'edit_form')?>" id="<?=($NewFilter ? 'filter_form' : '')?>" name="notification" action="user.php" method="post">

+ 6
- 6
sections/user/user.php View File

646
     <div class="box">
646
     <div class="box">
647
       <div class="head">
647
       <div class="head">
648
         <?=!empty($InfoTitle) ? $InfoTitle : 'Profile';?>
648
         <?=!empty($InfoTitle) ? $InfoTitle : 'Profile';?>
649
-        <span style="float: right;"><a href="#" onclick="$('#profilediv').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets">Hide</a></span>&nbsp;
649
+        <span style="float: right;"><a toggle-target="#profilediv" toggle-replace="Show" class="brackets">Hide</a></span>&nbsp;
650
       </div>
650
       </div>
651
       <div class="pad profileinfo" id="profilediv">
651
       <div class="pad profileinfo" id="profilediv">
652
 <?
652
 <?
778
     <div class="head">
778
     <div class="head">
779
       <?=display_str($CName)?> - <a href="collages.php?id=<?=$CollageID?>" class="brackets">See full</a>
779
       <?=display_str($CName)?> - <a href="collages.php?id=<?=$CollageID?>" class="brackets">See full</a>
780
       <span style="float: right;">
780
       <span style="float: right;">
781
-        <a href="#" onclick="$('#collage<?=$CollageID?>_box .images').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets"><?=$FirstCol ? 'Hide' : 'Show' ?></a>
781
+        <a toggle-target="#collage<?=$CollageID?>_box .images" toggle-replace="<?=$FirstCol ? 'Show' : 'Hide' ?>" class="brackets"><?=$FirstCol ? 'Hide' : 'Show' ?></a>
782
       </span>
782
       </span>
783
     </div>
783
     </div>
784
     <div id="user_collage_images" class="collage_images">
784
     <div id="user_collage_images" class="collage_images">
828
 ?>
828
 ?>
829
     <div class="box" id="invitetree_box">
829
     <div class="box" id="invitetree_box">
830
       <div class="head">
830
       <div class="head">
831
-        Invite Tree <span style="float: right"><a href="#" onclick="$('#invitetree').gtoggle(); return false;" class="brackets">Toggle</a></span>
831
+        Invite Tree <span style="float: right"><a toggle-target="#invitetree" class="brackets">Toggle</a></span>
832
       </div>
832
       </div>
833
       <div id="invitetree" class="hidden">
833
       <div id="invitetree" class="hidden">
834
 <?        $Tree->make_tree(); ?>
834
 <?        $Tree->make_tree(); ?>
857
 ?>
857
 ?>
858
     <div class="box" id="requests_box">
858
     <div class="box" id="requests_box">
859
       <div class="head">
859
       <div class="head">
860
-        Requests <span style="float: right;"><a href="#" onclick="$('#requests').gtoggle(); return false;" class="brackets">Show</a></span>
860
+        Requests <span style="float: right;"><a toggle-target="#requests" class="brackets">Show</a></span>
861
       </div>
861
       </div>
862
       <div id="requests" class="hidden">
862
       <div id="requests" class="hidden">
863
         <table cellpadding="6" cellspacing="1" border="0" width="100%">
863
         <table cellpadding="6" cellspacing="1" border="0" width="100%">
951
 ?>
951
 ?>
952
     <div class="box" id="staffpms_box">
952
     <div class="box" id="staffpms_box">
953
       <div class="head">
953
       <div class="head">
954
-        Staff PMs <a href="#" onclick="$('#staffpms').gtoggle(); return false;" class="brackets" style="float:right;">Toggle</a>
954
+        Staff PMs <a toggle-target="#staffpms" class="brackets" style="float:right;">Toggle</a>
955
       </div>
955
       </div>
956
       <table width="100%" class="message_table hidden" id="staffpms">
956
       <table width="100%" class="message_table hidden" id="staffpms">
957
         <tr class="colhead">
957
         <tr class="colhead">
1026
         Staff Notes
1026
         Staff Notes
1027
         <a href="#" name="admincommentbutton" onclick="ChangeTo('text'); return false;" class="brackets">Edit</a>
1027
         <a href="#" name="admincommentbutton" onclick="ChangeTo('text'); return false;" class="brackets">Edit</a>
1028
         <span style="float: right;">
1028
         <span style="float: right;">
1029
-        <a href="#" onclick="$('#staffnotes').gtoggle(); return false;" class="brackets">Toggle</a>
1029
+        <a toggle-target="#staffnotes" class="brackets">Toggle</a>
1030
         </span>
1030
         </span>
1031
       </div>
1031
       </div>
1032
       <div id="staffnotes" class="pad">
1032
       <div id="staffnotes" class="pad">

+ 2
- 2
sections/userhistory/email_history2.php View File

283
     $Record['IP'] = apc_exists('DBKEY') ? DBCrypt::decrypt($Record['IP']) : '[Encrypted]';
283
     $Record['IP'] = apc_exists('DBKEY') ? DBCrypt::decrypt($Record['IP']) : '[Encrypted]';
284
 ?>
284
 ?>
285
     <tr class="row">
285
     <tr class="row">
286
-      <td><?=display_str($Record['Email'])?><?=(($MatchCount > 0) ? ' <a href="#" onclick="$(\'#matches_'.$j.'\').gtoggle(); return false;">('.$MatchCount.')</a>' : '')?></td>
286
+      <td><?=display_str($Record['Email'])?><?=(($MatchCount > 0) ? ' <a toggle-target="#matches_'.$j.'">('.$MatchCount.')</a>' : '')?></td>
287
       <td><?=time_diff($Record['StartTime'])?></td>
287
       <td><?=time_diff($Record['StartTime'])?></td>
288
       <td><?=time_diff($Record['EndTime'])?></td>
288
       <td><?=time_diff($Record['EndTime'])?></td>
289
       <td><?=time_diff($Record['ElapsedTime'])?></td>
289
       <td><?=time_diff($Record['ElapsedTime'])?></td>
353
 $Invite['IP'] = apc_exists('DBKEY') ? DBCrypt::decrypt($Invite['IP']) : '[Encrypted]';
353
 $Invite['IP'] = apc_exists('DBKEY') ? DBCrypt::decrypt($Invite['IP']) : '[Encrypted]';
354
 ?>
354
 ?>
355
     <tr class="row">
355
     <tr class="row">
356
-      <td><?=display_str($Invite['Email'])?><?=(($MatchCount > 0) ? ' <a href="#" onclick="$(\'#matches_invite\').gtoggle(); return false;">('.$MatchCount.')</a>' : '')?></td>
356
+      <td><?=display_str($Invite['Email'])?><?=(($MatchCount > 0) ? ' <a toggle-target="#matches_invite">('.$MatchCount.')</a>' : '')?></td>
357
       <td>Never</td>
357
       <td>Never</td>
358
       <td><?=time_diff($Invite['EndTime'])?></td>
358
       <td><?=time_diff($Invite['EndTime'])?></td>
359
       <td><?=time_diff($Invite['AccountAge'])?></td>
359
       <td><?=time_diff($Invite['AccountAge'])?></td>

+ 1
- 1
sections/userhistory/subscribed_collages.php View File

252
           <strong><a href="collage.php?id=<?=$CollageID?>"><?=$CollageName?></a></strong> (<?=$NewTorrentCount?> new torrent<?=($NewTorrentCount == 1 ? '' : 's')?>)
252
           <strong><a href="collage.php?id=<?=$CollageID?>"><?=$CollageName?></a></strong> (<?=$NewTorrentCount?> new torrent<?=($NewTorrentCount == 1 ? '' : 's')?>)
253
         </span>&nbsp;
253
         </span>&nbsp;
254
         <span style="float: right;">
254
         <span style="float: right;">
255
-          <a href="#" onclick="$('#discog_table_<?=$CollageID?>').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets"><?=($ShowAll ? 'Show' : 'Hide')?></a>&nbsp;&nbsp;&nbsp;<a href="userhistory.php?action=catchup_collages&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;collageid=<?=$CollageID?>" class="brackets">Catch up</a>&nbsp;&nbsp;&nbsp;<a href="#" onclick="CollageSubscribe(<?=$CollageID?>); return false;" id="subscribelink<?=$CollageID?>" class="brackets">Unsubscribe</a>
255
+          <a toggle-target="#discog_table_<?=$CollageID?>" toggle-replace="<?=($ShowAll ? 'Hide' : 'Show')?>" class="brackets"><?=($ShowAll ? 'Show' : 'Hide')?></a>&nbsp;&nbsp;&nbsp;<a href="userhistory.php?action=catchup_collages&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;collageid=<?=$CollageID?>" class="brackets">Catch up</a>&nbsp;&nbsp;&nbsp;<a href="#" onclick="CollageSubscribe(<?=$CollageID?>); return false;" id="subscribelink<?=$CollageID?>" class="brackets">Unsubscribe</a>
256
         </span>
256
         </span>
257
       </td>
257
       </td>
258
     </tr>
258
     </tr>

+ 9
- 0
static/functions/global.js View File

210
     var a = $('[cover]')[0]
210
     var a = $('[cover]')[0]
211
     if (a) preload(a.attributes.cover.value)
211
     if (a) preload(a.attributes.cover.value)
212
   }
212
   }
213
+
214
+  document.querySelectorAll('[toggle-target]').forEach(function(el) {
215
+    el.addEventListener('click', function(event) {
216
+      $(el.attributes['toggle-target'].value).gtoggle()
217
+      if (el.attributes['toggle-replace']) {
218
+        [el.innerHTML, el.attributes['toggle-replace'].value] = [el.attributes['toggle-replace'].value, el.innerHTML]
219
+      }
220
+    })
221
+  })
213
 })
222
 })

+ 2
- 2
static/functions/news_ajax.js View File

32
           }));
32
           }));
33
           // I'm so happy with this condition statement.
33
           // I'm so happy with this condition statement.
34
           if (privileged) {
34
           if (privileged) {
35
-            $('#news' + this[0]).append('<div class="head"><strong>' + this[1] + '</strong> ' + this[2] + ' - <a href="tools.php?action=editnews&amp;id=' + this[0] + '" class="brackets">Edit</a><span style="float: right;"><a class="brackets" onclick="$(\'#newsbody' + this[0] + '\').gtoggle(); this.innerHTML=(this.innerHTML == \'Hide\' ? \'Show\' : \'Hide\'); return false;" href="#">Hide</a></span></div>');
35
+            $('#news' + this[0]).append('<div class="head"><strong>' + this[1] + '</strong> ' + this[2] + ' - <a href="tools.php?action=editnews&amp;id=' + this[0] + '" class="brackets">Edit</a><span style="float: right;"><a class="brackets" toggle-target="#newsbody' + this[0] + '" toggle-replace="Show">Hide</a></span></div>');
36
           } else {
36
           } else {
37
-            $('#news' + this[0]).append('<div class="head"><strong>' + this[1] + '</strong> ' + this[2] + '<span style="float: right;"><a class="brackets" onclick="$(\'#newsbody' + this[0] + '\').gtoggle(); this.innerHTML=(this.innerHTML == \'Hide\' ? \'Show\' : \'Hide\'); return false;" href="#">Hide</a></span></div>');
37
+            $('#news' + this[0]).append('<div class="head"><strong>' + this[1] + '</strong> ' + this[2] + '<span style="float: right;"><a class="brackets" toggle-target="#newsbody' + this[0] + '" toggle-replace="Show">Hide</a></span></div>');
38
           }
38
           }
39
           $('#news' + this[0]).append('<div class="pad" id="newsbody'+this[0]+'">' + this[3] + '</div>');
39
           $('#news' + this[0]).append('<div class="pad" id="newsbody'+this[0]+'">' + this[3] + '</div>');
40
         });
40
         });

+ 4
- 0
static/styles/global.css View File

96
   width: 20%;
96
   width: 20%;
97
 }
97
 }
98
 
98
 
99
+[toggle-target] {
100
+  cursor: pointer;
101
+}
102
+
99
 button, input[type=button], input[type=submit] {
103
 button, input[type=button], input[type=submit] {
100
   cursor: pointer;
104
   cursor: pointer;
101
   background: #fff;
105
   background: #fff;

Loading…
Cancel
Save