Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
- <html>
- <head>
- <title>Reddit Tag Generator</title>
- <noscript><style> .jsonly { display: none } </style></noscript>
- </head>
- <style type="text/css">
- tr { width: 100% }
- table { width: 100% }
- input, textarea { box-sizing: border-box; display:inline-block }
- input { margin:0;
- padding:0;
- }
- body {
- background-color: gray;
- font-family:Verdana,Arial,sans-serif;
- }
- h1 {
- width:80%;
- border:3px;
- border-style:solid;
- padding:20px;
- background-color: #08465b;
- color:#eee;
- border-color:black;
- border-radius:10px;
- }
- h3 {
- background-color: #18566b;
- color:#eee;
- padding-left:30px;
- padding-top:5px;
- padding-bottom:5px;
- border-radius:6px;
- border:1px;
- border-style:solid;
- border-color:#00364b;
- }
- .text {
- text-align:left;
- margin-left:2%
- }
- .group {
- margin-top:5px;
- margin-bottom:5px;
- height:170px;
- }
- .cell {
- display: inline-block;
- width: 19.6%;
- margin:0.2%;
- height:300px;
- overflow:hidden;
- }
- .code {
- padding-left:8px;
- padding-right:8px;
- border:1px;
- border-style:solid;
- border-color:gray;
- color:gray;
- background-color:#333;
- font-family:monospace;
- }
- .exampletag_tag {
- padding-left:8px;
- padding-right:8px;
- border:1px;
- border-style:solid;
- border-color:gray;
- color:gray;
- background-color:yellow;
- font-family:monospace;
- border-radius:3px;
- }
- .box {
- width: 80%;
- padding: 20px;
- background-color: #444;
- border-width: 3px;
- border-style: solid;
- border-color: black;
- color: white;
- margin-left:auto;
- margin-right:auto;
- border-radius:10px;
- }
- select, input, textarea {
- background-color:#5896ab;
- border:1px;
- border-style:solid;
- border-color:black;
- border-radius:4px;
- width:100%;
- color:black;
- padding-left:5px;
- }
- *::-webkit-input-placeholder { color:#444; }
- *:-ms-input-placeholder{ color:#444; }
- *::-moz-placeholder { color:#444; opacity:1; }
- *:-moz-placeholder { color:#444; opacity:1; }
- </style>
- <script language="JavaScript" src="json2.js"></script>
- <script>
- function change_color(what) {
- what.style.backgroundColor = what.options[what.selectedIndex].value;
- if ( { "aqua": true, "lime": true, "silver": true, "white": true, "yellow": true }[what.style.backgroundColor] ) { var fgcolor="black"; } else { var fgcolor="white"; }
- what.style.color = fgcolor;
- }
- function show_exampletag() {
- document.getElementById('exampletag').style.display='block';
- }
- function make_exampletag() {
- var exampletag = "";
- var checks_in = document.getElementsByClassName("check_in");
- var checks_se = document.getElementsByClassName("check_se");
- var count = checks_in.length;
- var highest_count = 0
- var highest = 1;
- for (var i = 0; i < count; i++) {
- var currentcell = document.getElementById("cell"+(i+1));
- if ( checks_in[i].value && checks_se[i].value ) {
- currentcell.style.opacity=1;
- var random_count = Math.floor((Math.random() * 100) + 1)
- exampletag += checks_in[i].value+":"+random_count+" ";
- if ( random_count > highest_count ) {
- highest_count = random_count;
- highest = i+1;
- }
- } else {
- currentcell.style.opacity=0.5;
- }
- }
- if ( exampletag ) {
- var bgcolor = document.getElementById("col"+highest).value;
- if ( bgcolor ) {
- document.getElementById('exampletag_tag').style.background = bgcolor;
- } else {
- document.getElementById('exampletag_tag').style.background = '#444';
- }
- if ( { "aqua": true, "lime": true, "silver": true, "white": true, "yellow": true }[bgcolor] ) { var fgcolor="black"; } else { var fgcolor="white"; }
- document.getElementById('exampletag_tag').style.color = fgcolor;
- document.getElementById('exampletag_fromscript').innerHTML=' {'+exampletag.slice(0,-1)+'}';
- }
- }
- function add_element() {
- document.activeElement.blur()
- var stdelement = document.getElementsByClassName("cell")[0].innerHTML;
- var count = document.querySelectorAll(".cell").length;
- stdelement = stdelement.replace("group1","group"+count);
- stdelement = stdelement.replace("col1","col"+count);
- stdelement = stdelement.replace("name1","name"+count);
- stdelement = stdelement.replace("Group 1","Group "+count);
- stdelement = stdelement.replace("group 1","group "+count);
- document.getElementById('variable_space').innerHTML+="<div class='cell' id='cell"+count+"'>"+stdelement+"</div>";
- make_exampletag()
- }
- function update_oldusers() {
- var oldtags = document.getElementById('oldtags').value;
- var oldusers = document.getElementById('oldusers');
- if ( oldtags ) {
- oldtags = JSON.parse(oldtags);
- var oldcount = Object.keys(oldtags).length;
- oldusers.innerHTML='<br>You currently have '+oldcount+' users tagged.';
- if ( oldcount > 1000 ) {
- oldusers.innerHTML+=' This is a large amount of data whose processing may lead to problems.<br>If you experience difficulties, upload a file below instead.<br><br>'
- }
- } else {
- oldusers.innerHTML='<br><i>-- OR --</i><br><br>';
- }
- }
- function afterload() {
- show_exampletag();
- make_exampletag();
- update_oldusers();
- }
- document.addEventListener("load", afterload, false);
- document.addEventListener("DOMContentLoaded", afterload, false);
- </script>
- <body>
- <?php
- $metas = json_decode(file_get_contents('subreddits'), true);
- $subcount = 0;
- foreach ( $metas as $meta ) { $subcount += count($meta); }
- $usercount = file_get_contents('usercount');
- ?>
- <div class='box' style='background-color:#08465b'><div style='margin-left:2%'><span style='font-size:xx-large'>Reddit Enhancement Suite Tag Generator</span><br>
- <?php
- print "Currently tracking ".number_format($usercount)." users on ".number_format($subcount)." subreddits - and growing!";
- ?>
- </div></div>
- <br>
- <div class='box'>
- <div class='text' style='color:red'>In RES 4.5.0.2, the settings console is nonfunctional due to a bug. If your
- page just reloads instead of opening the tag window, you'll have to wait for the fix to get into a stable version or downgrade RES.</div>
- <h3>Intro</h3>
- <div class='text'>
- Please select which subreddits should be in which group and enter a short name and color for each of them.<br>
- You can select multiple subreddits in per group by holding Ctrl.<br>
- If no name is entered or if no subreddits are selected, a group is ignored.<br>
- The color will be determined by the group in which the user has the highest number of postings.<br>
- You can copy and paste your old tags below. They will be added to the generated tags.<br>
- Note: Anything between { and } in the old tags will be removed as to prevent duplicate auto-tagging.
- </div>
- <form action="generate.php" enctype="multipart/form-data" method="post">
- <h3>Group definitions</h3>
- <?php
- $group_select = '';
- $color_options = '';
- $meta_keys = array_keys($metas);
- foreach ($meta_keys as $meta) {
- $dummy = array();
- if ( preg_match_all("/.*?(\d+)$/", $meta, $dummy) ) {
- $basename = trim(str_replace(range(0,9),'',$meta));
- if ( $metas[$basename] ) {
- $metas[$basename] = array_merge($metas[$basename],$metas[$meta]);
- unset($metas[$meta]);
- }
- }
- }
- $meta_keys = array_keys($metas);
- natcasesort($meta_keys);
- $new_key = array_search('New',$meta_keys);
- if ( $new_key ) {
- array_splice($meta_keys,$new_key-1,1);
- array_push($meta_keys,'New');
- }
- foreach ($meta_keys as $meta) {
- if ( $meta == 'New' ) {
- if ( !empty($metas['New']) ) { $style='color:darkred'; } else { continue; }
- } else { $style=''; }
- $group_select .= "<optgroup label='$meta' style='$style'>";
- natcasesort($metas[$meta]);
- foreach ($metas[$meta] as $sub) { $group_select .= "<option style='$style'>$sub</option>"; }
- $group_select .= "</optgroup>";
- }
- if ( $new_key and $metas['New'] ) {
- $new = '';
- foreach ( $metas['New'] as $sub ) { $new .= $sub.', '; }
- echo "<div class='text' style='color:red;font-size:small'><b>NEW subreddits: </b>".substr($new,0,strlen($new)-2)."<br></div>";
- }
- $tag_colors = array( "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red", "silver", "teal", "white", "yellow" );
- $tag_colors_black_fg = array( "aqua", "lime", "silver", "white", "yellow" );
- foreach ($tag_colors as $tag_color) {
- if ( in_array( $tag_color, $tag_colors_black_fg ) ) { $fg_color='black'; } else { $fg_color='white'; }
- $color_options .= "<option value='$tag_color' style='background-color:$tag_color;color: $fg_color'>$tag_color</option>";
- }
- foreach ( range(1,4) as $i ) {
- echo "<div class='cell' id='cell$i'>
- <h3>Group $i</h3>
- <input name='name$i' placeholder='Enter group $i token' style='padding:10' id='name$i' onKeyUp='make_exampletag()' class='check_in'><br>
- <select class='group check_se' name='group".$i."[]' multiple id='group$i' onChange='make_exampletag()'>
- $group_select
- </select><br>
- <select onChange='change_color(this);make_exampletag()' name='col$i' id='col$i'>
- <option value='' selected disabled>Select color...</option>
- $color_options
- </select>
- </div>";
- }
- ?><noscript><span class='cell' style='vertical-align:top'><h3 style='height:263px;opacity:0.5;'><br>Please enable JavaScript to add more groups.</h3></span></noscript><span class="jsonly"><span id='variable_space'></span><span class='cell'>
- <h3>New Group</h3>
- <input onClick='add_element()' style='background-color:#444;color:#444'><br>
- <textarea onClick='add_element()' style='background-color:#444;resize:none;color:#444' id='dummybox' multiple class='group'></textarea><br>
- <input onClick='add_element()' style='background-color:#444;color:#444;vertical-align:top;display:block'></select>
- </span></span>
- <div class='text'><span id='exampletag' style='display:none'><br>Example tag: <span class='exampletag_tag' id='exampletag_tag'>The Tag You Had Before<span id='exampletag_fromscript'></span></span></span></div>
- <h3>Old tags</h3>
- <div class='text'>
- To retrieve your old tags, go on reddit and press ".", which will open the RES console.<br>
- In the console, paste <span class='code'>RESStorage update RESmodules.userTagger.tags</span> and press Enter.<br>
- Note that depending on your number of tags, this step may take quite a while.<br>
- Click into the resulting field, press Ctrl+a and then Ctrl+c to copy all your old tags.<br>
- Now click in the entry field below and press Ctrl+v to paste your tags.<br><br>
- <textarea id='oldtags' onChange='update_oldusers()' name="oldtags" style="height:100px; width:90%;padding-top:5px;" placeholder='Paste your tags here...'></textarea>
- <div id='oldusers'></div>
- <input name="tagfile" type="file" style='width:90%' accept="text/*"><br><br>
- To upload a file with tags, paste them into a text file on your computer and locate it by clicking 'Browse'.<br>
- This is necessary in browsers which limit the maximum length of the entry field above.<br>
- If you upload a file, its contents will take precedence over the contents of the entry field.
- </div>
- <h3>Done?</h3>
- <div class='text'>
- <input type="checkbox" name="return_tagfile" value="true" style='width:30px;padding:0;margin:0'> Return tags as a text file - use this if you expect the output to be very large<br>
- <input type="checkbox" name="override" value="true" style='width:30px;padding:0;margin:0'> Override colors - use this when changing your color selection<br>
- <input style='width:30px' name="mincomments" placeholder='2'> comments minimum to count a group<br><br>
- Now go on reddit in a new tab and press ".", which will open the RES console.<br>
- In the console, paste <span class='code'>RESStorage update RESmodules.userTagger.tags</span> and press Enter.<br>
- Once your current tags are displayed, delete them with Ctrl+a and Del.<br>
- Now click "Generate" below. Note that depending on the output, this may take a lot of time.<br>
- <span style='color:red'>If you get timeout errors, reset errors or similar:</span><br>
- <div style='margin-left:30px'>- Upload your old tags as a file<br>
- - Select the option to return tas as a text file<br>
- - Retry, possibly at a later time<br></div>
- Copy all resulting tags with Ctrl+a and Ctrl+c.<br>
- Go back to the RES console and paste the tags there with Ctrl+v and click confirm.<br>
- Reload the page and you're done!<br><br>
- </div>
- <input type="submit" value="Generate" style='height:40px;font-size:large;background-color:#08465b;color:white'>
- </form>
- </div>
- <div style='color:#ccc;font-size:small' align='center'><br>Made in July 2014 by <a href='http://www.reddit.com/message/compose/?to=genitaliban' style='color:#ccc'>/u/genitaliban</a> - message me for bug reports, tracking requests and other suggestions!<br>
- This website, the script that builds the databases and a local version of this tag generator are available under the GPL upon request.<br>
- This website comes without ANY warranty, use at your own risk and keep a backup of your old tags!
- <!-- START OF HIT COUNTER CODE -->
- <span style='opacity:0.001'><br><script language="JavaScript" src="http://www.counter160.com/js.js?img=11"></script><br><a href="http://www.000webhost.com"><img src="http://www.counter160.com/images/11/left.png" alt="Free web hosting" border="0" align="texttop"></a><a href="http://www.hosting24.com"><img alt="Web hosting" src="http://www.counter160.com/images/11/right.png" border="0" align="texttop"></a></span>
- <!-- END OF HIT COUNTER CODE -->
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment