Profile
Personal Photo

No Photo

Options
Custom Title
oh no what am i doing
Personal Info
Location: NE USA
Born: 1 January 1994
Website: No Information
Interests
No Information
Other Information
Gender:: Male
Test: No Information
Statistics
Joined: 06/23/2014
Status: (Offline)
Last Seen: Yesterday at 01:38 pm
Local Time: Mar 25 2017, 08:35 PM
315 posts (0.3 per day)
( 0.15% of total forum posts )
Contact Information
AIM No Information
Yahoo No Information
GTalk No Information
MSN No Information
SKYPE No Information
Unread Message Message: Click here
Unread Message Email: Private
Signature
View Signature

DustBucket

Members

Topics
Posts
Comments
Friends
Video
My Content
Nov 9 2016, 05:44 PM
Hi guys,

Not sure this can actually be done, and it's a relatively insignificant thing, but is there anyway to translate a user ID number into the actual username? ie going from <!-- |id| --> to <!-- |name| -->
Nov 7 2016, 04:01 AM



Award Creation:





Hey guys,

Wasn't really sure where to put this, or if there's some rule against it etcetera, buuut I wrote a Jquery script to give a group of specified members an award. It's still constrained by the limitations of the D-Awards system (ah, 2004), especially in function.. but hey, it works, and I don't have to add awards one by one, so that's pretty cool.

However, be aware that I generally use it offline, à la XHR, and so there was never any real risk to me in using it (that I'm aware of). If you install this on your forum, I'd recommend installing it on a separate webpage that you navigate to. The Webpage Maker is perfectly set up for this - you can also save it as an offline .html file if you don't mind the feedback system being wonky (it'll constantly say 'error' even when it submits fine, and the ACP login at the top won't function correctly so you'd need to copy and paste your session ID).

Since it does involve ~sEnSiTiVe AdMiN~ login information that could be used to hijack your board, I'll post the not minified source below as well. Don't judge me too harshly for my awful coding practices :b

Minified:

CSS:
CODE

#acplgn,#result{position:relative}#datatable td{border:none}#acplgn{font-size:10px;top:-10px!important;width:23%!important}#acppw,#acpusn{font-size:10px;height:16px;width:51%!important}#datatable{font-size:12px;width:350px}#eval{width:100px!important}#datatable input,#datatable textarea{font-size:11px}#datatable td:first-of-type,#zero{font-family:sans-serif;font-size:11px;font-style:italic;width:15%}#datatable td:last-of-type input,#datatable td:last-of-type textarea{width:100%}#result{display:inline-table}

HTML:
CODE

<table id="datatable"><tr id="subzero"><td>ACP Login:</td><td><input style="border: 1px solid gray;" size="20" name="username" id="acpusn" value="" type="text" placeholder="Username"><input style="border: 1px solid gray;" size="20" name="password" id="acppw" value="" type="password" placeholder="Password"> <input value="Log In" id="acplgn" type="submit"></td></tr><tr id="0"><td>Session Key</td><td><input type="text" name="ta-ads" id="ta-adsess" placeholder="No active session found..."></td></tr><tr id="Zero"><td>Field</td><td>Input</td></tr><tr id="usnrow"><td>Username(s)</td><td><textarea id="ta-usn" placeholder="Required"></textarea></td></tr><tr id="anrow"><td>Award Name</td><td> <input type="text" name="ta-nm" id="ta-name" placeholder="Required"></td></tr><tr id="imgrow"><td>Image</td><td> <input type="text" name="ta-image" id="ta-img" placeholder="Required"></td></tr><tr id="gbrow"><td>Given By</td><td> <input type="text" name="ta-gb" id="ta-givenby" placeholder="Required"></td></tr><tr id="descrow"><td>Description</td><td><textarea name="tadsc" id="ta-desc" placeholder="Required"></textarea></td></tr><tr id="darow"><td>Display Award?</td><td> <select id="displayq"><option value="1">Yes</option><option value="0">No</option> </select></td></tr><tr id="submitrow" align="left"><td></td><td> <input type="button" id="eval" value="Add Award(s)"><div id="result"></div></td></tr></table>

JQuery:
CODE

$(function a(){var a='*********BOARD ORIGIN HERE***********';$('input#acplgn').click(function(){var b=[$('#acpusn').val(),$('#acppw').val()];$.get(a+'/admin.php?adsess=&login=yes',{username:b[0],password:b[1]},function(a){var b=a.search('adsess='),c=a.substr(b+7,32);$('#ta-adsess').val(c),$('#acplgn').val('Signed In');});}),$('input#eval').click(function(){var b=[$('#ta-usn').val().split('\n'),[$('#ta-name').val(),$('#ta-img').val(),$('#ta-givenby').val(),$('#ta-desc').val(),$('#displayq').val(),$('#ta-adsess').val()]];$.each(b[0],function(){$.ajax({method:'POST',url:a+'/admin.php?&code=awardsadd&act=awards',timeout:5000,data:{adsess:b[1][5],username:this,name:b[1][0],image:b[1][1],givenby:b[1][2],description:b[1][3],display:b[1][4]},statusCode:{200:function(){$('#result').html('Success!');}},error:function(b,a){$('#result').css('visibility','visible').html(a+' &#x2639;');}});});});});



Source:
CSS:
CODE

#datatable td {
   border: medium none;
}
#acplgn {
   font-size: 10px;
   position: relative;
   top: -10px !important;
   width: 23% !important;
}
#acpusn, #acppw {
   font-size: 10px;
   height: 16px;
   width: 51% !important;
}
#datatable {
   font-size: 12px;
   width: 350px;
}
#eval {
   width: 100px !important;
}
#datatable textarea, #datatable input {
   font-size: 11px;
}
#datatable td:first-of-type, #zero {
   font-family: sans-serif;
   font-size: 11px;
   font-style: italic;
   width: 15%;
}
#datatable td:last-of-type textarea, #datatable td:last-of-type input {
   width: 100%;
}
#result {
   display: inline-table;
   position: relative;
}

HTML:
CODE

<table id="datatable">
 <tr id="subzero">
  <td>ACP Login:</td>
  <td><input style="border: 1px solid gray;" size="20" name="username" id="acpusn" value="" type="text" placeholder="Username"><input style="border: 1px solid gray;" size="20" name="password" id="acppw" value="" type="password" placeholder="Password">
  <input value="Log In" id="acplgn" type="submit"></td>
 </tr>
 <tr id="0">
  <td>Session Key</td>
  <td><input type="text" name="ta-ads" id="ta-adsess" placeholder="No active session found..."></td>
 </tr>
 <tr id="Zero">
  <td>Field</td>
  <td>Input</td>
 </tr>
 <tr id="usnrow">
  <td>Username(s)</td>
  <td>
   <textarea id="ta-usn" placeholder="Required"></textarea>
  </td>
 </tr>
 <tr id="anrow">
  <td>Award Name</td>
  <td>
   <input type="text" name="ta-nm" id="ta-name" placeholder="Required">
  </td>
 </tr>
 <tr id="imgrow">
  <td>Image</td>
  <td>
   <input type="text" name="ta-image" id="ta-img" placeholder="Required">
  </td>
 </tr>
 <tr id="gbrow">
  <td>Given By</td>
  <td>
   <input type="text" name="ta-gb" id="ta-givenby" placeholder="Required">
  </td>
 </tr>
 <tr id="descrow">
  <td>Description</td>
  <td>
   <textarea name="tadsc" id="ta-desc" placeholder="Required"></textarea>
  </td>
 </tr>
 <tr id="darow">
  <td>Display Award?</td>
  <td>
   <select id="displayq">
    <option value="1">Yes</option>
    <option value="0">No</option>
   </select>
  </td>
 </tr>
 <tr id="submitrow" align="left">
  <td>
  </td>
  <td>
   <input type="button" id="eval" value="Add Award(s)">
   <div id="result"></div>
  </td>
 </tr>
</table>

JQuery:
CODE

$(function neato() {
var url = "*********BOARD ORIGIN HERE***********";
$('input#acplgn').click(function() {
var acparray = [ $('#acpusn').val(), $('#acppw').val() ];
$.get(url + "/admin.php?adsess=&login=yes", { username: acparray[0], password: acparray[1]}, function(data){
var test = data.search("adsess="),
 fin = data.substr(test + 7, 32);
$("#ta-adsess").val(fin);
$("#acplgn").val('Signed In');
 });
});
$('input#eval').click(function() {
var array3 = [ $('#ta-usn').val().split('\n'), [ $('#ta-name').val(), $('#ta-img').val(), $('#ta-givenby').val(), $('#ta-desc').val(),  $('#displayq').val(), $('#ta-adsess').val() ] ];
 $.each(array3[0], function() {
 var usn = this;
 $.ajax(
  {
   method: "POST",
   url: (url + "/admin.php?&code=awardsadd&act=awards"),
   timeout: 5000,
   data: {
    adsess: array3[1][5],
    username: this,
    name: array3[1][0],
    image: array3[1][1],
    givenby: array3[1][2],
    description: array3[1][3],
    display: array3[1][4]
   },
           statusCode: {
                200: function() {
                    $('#result').html('Success!')
       }
               },
    error: function(String, errorThrown){
     $('#result').css('visibility', 'visible').html(errorThrown + ' &#x2639;');
     }
    }
    );
 });
});
});


Install is easy: Copy and paste it wherever you want. I used a webpage in the webpage maker, including the CSS in style tags and so on. You must also replace the variable data marked by "*********BOARD ORIGIN HERE***********" with your own root URL (ie: http://forum.jcink.net, or http://www.mysweetsite.com)

Usage is also pretty easy, if a little annoying. Log in with your usual administrative credentials, and click 'log in'. If a string of characters pops up in the Session ID field, you should be set - if not, your login may be wrong or you may have stumbled upon one of what is probably several hundred bugs.

Continuing on, fill out the form as you would normally - the only difference is that you can enter multiple usernames (they must be typed/copied pasted exactly as they appear), separated by a newline. In theory you should be able to enter a very large number of names.

Toodles! Let me know if you use it, and how it goes. It works for me, but that's not exactly wide-spread functionality.



Award Editor:






Hello again! Finished up another utility, slightly more useful than the last.



Award editing stuff whoooo.. Functionality is simple enough, and the scripting itself is messier than ever!

This utility loads an up-to-date award list into a table, with each field editable except the Award ID# and Member ID#. Award names, images, given-by('s?), descriptions, and display status are all editable by hand or via mass replacement. It's neatish.

Download links are below, but I'll go over how to use it first.

Firstly, log in via the login boxes up at the top, and click 'log in'. If it's successful, your ACP session key will appear next to it, the button will change to 'signed in', and a new button labelled 'Build Awards Table' will appear. Click that button.. and then do a jig to pass the time, because your browser is going to freeze for the next ten to fifteen seconds or so. Ignore the warning of 404 not found in the console - it'll retry so long as your connection isn't horrific.

If nothing appears, and you can still navigate the page as normal, click the Build Awards Table button again. If nothing happens again, you've broken it and I hate you a little. Use your browser's developer tools/console to get data on the error, and then send it to me via PM.

If your table did appear, hooray!

The first two columns are not editable - this is because one of them is key to the system and I don't think duplicate IDs would end well, and the other shouldn't really need to be edited (and I'm lazy). The other columns can be edited by clicking the text and typing. Try not to use your tab key, because it won't detect a change properly.

As you edit fields and click away from them, they will be highlighted in yellow and a ☑ ☒ will appear to the right. These are individual controls: Click the checkbox to submit that individual award, or click the X mark to reset that individual award's information. You can also highlight an award for deletion by clicking the ✗ next to it.

If working one-by-one isn't cutting it for you, explore the options in the bottom right. You can filter awards by username and by award name in the first row, and you can do a mass-replacement by award name, image URL, the 'given by' field, and the description in the second row.

When you're done editing, click the 'submit edits' button in the bottom left. If all the yellow fields go back to blue or white, you should be set - I'd recommend checking a few profiles to make sure the changes committed before exiting.

If you click 'Delete selected' all awards currently highlighted in red will be deleted - this is not reversible. If you make a mistake, you will need to either re-award them, or restore from a backup.

And that's about it! Let me know if you have a suggestion for functionality.

Installation:

Create a webpage using JC Ink's webpage maker. I highly recommend not including this webpage on other pages - the script is heavy and pretty slow, because I'm an awful scripter but you can't stop me nanner-nanner-boo-boo. Copy and paste the following into the webpage, and save it.

NOTE: This script must be installed and used on JC ink's domain. If you attempt to use it on your custom URL (ie: www.mycommunity.com instead of mycommunity.jcink.net) it will not function.

NOTE: Replace functions work by exact case, and replace the field entirely. Maybe later I'll add partial replacement in.

NOTE: John mentioned that if you have something over 10,000 awards, this may not work for you.

Install Note: Various hexadecimal codes get parsed into the symbols they represent. Line 300 is incorrectly parsed, and should instead appear as:


You may edit this line yourself, or you may download the file from Google Drive here:
parsetest.html

Addendum: Every time you edit the webpage that this utility is hosted on, you will need to re-replace this line as your browser will re-parse it when the webpage maker is opened.

CODE
<style>
  #curtain,
  #mass {
      border: 2px dashed #f3f3f3;
      width: 906px;
  }
 
  table {
      padding: 0;
      border-collapse: collapse;
      border-spacing: 0;
  }
 
  tr,
  th,
  td {
      border-collapse: collapse;
      padding: 0;
      border-spacing: 0;
      font-family: Century Gothic, Verdana;
      font-weight: 300;
  }
 
  th {
      border-left: 1px solid #cacaca;
      border-right: 1px solid #cacaca;
  }
 
  input {
      border: none;
      border-spacing: 0;
  }
 
  #mass tr:nth-of-type(2n+1) input {
      background: #ffffff none repeat scroll 0 0;
  }
 
  #mass tr:nth-of-type(2n) input {
      background: #e2ffff none repeat scroll 0 0;
  }
 
  tr.toupload input {
      background: #fbf6b3 none repeat scroll 0 0 !important;
  }
 
  tr.toremove input {
      background-color: rgba(256, 36, 21, .5)!important;
  }
 
  .rmicon {
      color: rgba(256, 36, 21, .8);
  }
 
  .rmrow,
  .controls {
      cursor: pointer;
  }
 
  .removed {
      opacity: .2;
      pointer-events: none!important;
  }
 
  tr {
      border-collapse: collapse;
      display: table-row-group;
      margin-left: 1px;
      padding: 0 !important;
  }
 
  .cell1 {
      text-align: center;
      width: 30px;
  }
 
  .cell3 {
      width: 170px;
  }
 
  .cell5 {
      width: 100px;
  }
 
  .cell6 {
      width: 264px;
  }
 
  .cell7 {
      width: 66px;
  }
 
  #pt_se,
  #acpid,
  #result,
  #sortphrase,
  #sortgo,
  #clearsort,
  #rmsel,
  #swapandgo,
  #findme,
  #replaceme {
      border: 1px solid #cacaca;
      background: initial!important;
      color: #000;
  }
 
  #logusn,
  #logpw,
  #logbtn {
      background: #f3f3f3;
      margin: 2px;
      color: #000;
  }
 
  select.cell7[default=undefined] {
      display: none;
  }
 
  .controls {
      display: table-cell;
      font-size: 16px;
      position: absolute;
      margin-top: -2px;
  }
 
  .uploadcan {
      margin-left: 14px;
  }
</style>
<div id="curtain">
  <div id="login">
      <input type="text" id="logusn" placeholder="Username...">
      <input type="password" id="logpw" placeholder="Password...">
      <input type="button" id="logbtn" value="Login">
      <input type="text" id="acpid" placeholder="No session found" autocomplete="off">
      <input type="button" id="getdata" value="Build Awards Table" style="display:none;">
  </div>
  <table id="mass">
      <tr>
          <th>#</th>
          <th>Awarded To</th>
          <th>Award Name</th>
          <th>Award Image</th>
          <th>Given By</th>
          <th>Award Description</th>
          <th>Display?</th>
      </tr>
      <tr>
          <td colspan=4>
              <input type="button" id="pt_se" value="Submit Edits">
              <input id="result" placeholder="Console" readonly type="text" style="font-style: italic;font-size:11px;padding:3px 10px;width:288px;" autocomplete="off">
          </td>
          <td align='right' colspan=3>
              <select id="sortmenu">
    <option value='2'>By Username..</option>
    <option value='3'>By Award Name..</option>
   </select>
              <input type="text" id="sortphrase" placeholder="Enter search phrase.." autocomplete="off">
              <input type="button" id="sortgo" value="Search">
              <input type="button" id="clearsort" value="⎌" alt="Reset search parameters">
          </td>
      </tr>
      <tr>
          <td colspan=2>
              <input type='button' id='rmsel' value='Delete Selected'>
          </td>
          <td align='right' colspan=5>
              Replace <select id='replacemenu'>
    <option value='3'>By Award Name..</option>
    <option value='4'>By Image..</option>
    <option value='5'>By 'Given By'..</option>
    <option value='6'>By Description..</option>
   </select>
              <input type='text' id='findme' placeholder='Replace this phrase..' autocomplete="off">
              <input type='text' id='replaceme' placeholder='.. With this phrase' autocomplete="off">
              <input type='button' id='swapandgo' value='Mark for Upload'>
          </td>
      </tr>
  </table>
</div>
<script type="text/javascript">
/* Award Editor version like.. -.09. Support Thread: http://forum.jcink.com/index.php?showtopic=26623 */
  $('#logbtn').click(function() {
      $.get("/admin.php?login=yes", {
          username: $('#logusn').val(),
          password: $('#logpw').val()
      }, function(data) {
          var fmark = data.search("adsess="),
              fin = data.substr(fmark + 7, 32);
          $("#acpid").val(fin);
          $("#logbtn").val('Signed In');
          $("#getdata").css('display', 'unset');
      })
  });
  $(document).on("click", "input#getdata", function _createdata() {
      $('#result').val('Requesting award table - Hang onto your butts!');
      _sleep(20);
      var ads = $('#acpid').val(),
          m = 'GET',
          um = '/admin.php?',
          dm = {
              act: 'mysql',
              adsess: ads,
              code: 'dump',
              line: '0',
              part: '8'
          },
          s = 'false',
          good = function() {
              $('#result').val('MySQL dump created, requesting MID table')
              _addMID(ads);
          },
          bad = $('#result').val('Creation failed');
      _asyncupload(m, um, dm, s, good, bad);
  });
  $(document).on("click", "span.uploadind", function _singleupload() {
      da = {};
      var count = 0,
          parent = $(this).parent('.toupload');
      $.each($(parent).find('input:not(.cell2)'), function() {
          count = count + 1;
          da[count] = ($(this).val());
      });
      da[6] = parent.find('select.cell7').val();
      da[7] = parent.find('input.evalme.cell2').attr('default');
      console.log(da);
      _upload(da);
      $('#result').val('Award #' + parent.attr('id') + ' - Sent');
      parent.removeClass('toupload').children('.controls').remove();
  });
  $(document).on("click", "span.uploadcan", function _cancelrow() {
      var parent = $(this).parent('.toupload');
      $.each($(parent).find('input:not(.cell2), select'), function() {
          var def = $(this).attr('default');
          $(this).attr('value', def);
      });
      parent.removeClass('toupload').children('.controls').remove();
      $('#result').val('Award #' + parent.attr('id') + ' - Reset');
  });
  $(document).on("click", "#pt_se", function _massup() {
      $.each($('.toupload'), function() {
          dm = {};
          var count = 0,
              t = $(this);
          $.each(t.find('input:not(.cell2)'), function _apply(count) {
              var count = count + 1;
              dm[count] = ($(this).val());
          });
          dm[6] = t.find('select.cell7').val();
          dm[7] = t.find('input.evalme.cell2').attr('default');
          console.log(dm);
          _upload(dm);
          t.find('.controls').remove();
          t.removeClass('toupload');
      });
  });
  $(document).on("click", ".rmrow", function _markfordeletion() {
      $(this).parent('td').parent('tr').toggleClass('toremove');
      $(this).toggleClass('rmicon');
  });
  $('#rmsel').click(function _deleteenmasse() {
      console.log('Running delete..');
      var ads = $('#acpid').val();
      $.each($('.toremove'), function() {
          $.get("/admin.php?adsess=" + ads + "&act=awards&code=awardsdelete", {
              id: $(this).find('.cell1').val()
          }, function() {
              $('#result').val('Awards deleted');
              $('.toremove').addClass('removed').removeClass('toremove');
          })
      });
  });
  $('#swapandgo').click(function _replace() {
      var type = $('#replacemenu').val(),
          controls = $('<span class="uploadind controls">☑</span> <span class="uploadcan controls">☒</span>'),
          find = $('#findme').val(),
          replace = $('#replaceme').val();
      $('.cell' + type + '[value="' + find + '"]').val(replace).parent('td').parent('tr').addClass('toupload').append(controls);
  });
  $('#sortgo').click(function _sortact() {
      var opt = [$('#sortmenu').val(), $('#sortphrase').val()]
      $('#mass tr').css({'position': 'unset', 'top':'unset'});
      console.log(opt);
      _sort(opt);
  });
  $('#clearsort').click(function _clearsearch() {
      $('#mass tr').css({'position': 'unset', 'top':'unset'});
  });

  function _addMID(ads) {
      var m = 'GET',
          um = '/admin.php?',
          dm = {
              act: 'mysql',
              adsess: ads,
              code: 'dump',
              line: '0',
              part: '40'
          },
          s = 'false',
          good = function() {
              $('#result').val('MID table dump created, downloading (4s delay)..');
              _getdata(ads);
          },
          bad = $('#result').val('Creation failed');
      _asyncupload(m, um, dm, s, good, bad);
  }

  function _getdata(ads) {
      console.log('Beginning download ')
      _sleep(4000);
      var m = 'GET',
          url = window.location.host,
          ind = url.indexOf('.'),
          split = url.substring(0, ind),
          um = '/boardservice/sqls/' + ads + '-' + split + '_.sql',
          dm = {},
          s = 'false',
          good = function(data) {
              _datasplit(data);
              $('#result').val('Downloaded data');
          },
          bad = $('#result').val('Download failed');
      _asyncupload(m, um, dm, s, good, bad);
  }

  function _datasplit(data) {
      var results = data.split(/\n/g),
          str = '_members` VALUES (';
      console.log(results);
      var supres = searchStringInArray(str, results);
      console.log(supres);
      var aid = results.slice(0, supres),
          mid = results.slice(supres);
      console.log(aid)
      console.log(mid)
      $('#result').val('Data split, sending block 1 to parser..');
      _parser(aid, mid)
  }

  function searchStringInArray(str, strArray) {
      for (var i = 0; i < strArray.length; i++) {
          if (strArray[i].indexOf(str) != -1) {
              break;
          }
      }
      return i;
  }

  function _parser(aid, mid) {
      $('#result').val('Block 1 received, parsing..');
      _sleep(1000);
      var count = 1;
      console.log(aid);
      if ($('table#mass tbody tr').attr('id') != 'undefined') {
          $(this).remove()
      }
      $.each(aid, function _tablebuilder() {
          var table = document.getElementById("mass").insertRow(1),
              t = this,
              arr = t.substring(t.indexOf('(') + 1, t.lastIndexOf(')')).match(/(".*?"|[^",\s]+)(?=\s*,|\s*$)/g),
              arr = arr || [];
          table.id = 't' + count++;
          var arrayLength = arr.length - 1;
          for (var i = 0; i < arrayLength; i++) {
              arr[i] = arr[i].replace(/^"/, '').replace(/"$/, '').replace(/'/g, ''').replace(/"/g, '"');
              table.insertCell(i).innerHTML = "<input type='text' class='evalme cell" + (i + 1) + "' default='" + arr[i] + "' value='" + arr[i] + "'>";
          }
          console.log(arr);
          if (arr[6] > 0) {
              table.insertCell(-1).innerHTML = "<select class='cell7' default='" + arr[6] + "'><option value='1' selected>Yes</option><option value='0'>No</option></select>";
          } else {
              table.insertCell(-1).innerHTML = "<select class='cell7' default='" + arr[6] + "'><option value='1'>Yes</option><option value='0' selected>No</option></select>";
          }
          table.insertCell(-1).innerHTML = "<div class='rmrow'>✗</div>";
      });
      $('.cell1, .cell2').attr('readonly', '');
      if ($("tr#t1").length > 0) {
          $('#result').val('Awards data tabulated');
      } else {
          $('#result').val('Error: Data not detected - Reload');
      }
      _midparse(mid)
      _markforupload();
  };

  function _midparse(mid) {
      $('#result').val('Block 2 received, parsing..');
      var supabig = {},
          idtable = $('input.evalme.cell2');
      $.each(mid, function() {
          var t = this,
              id = t.substring(t.indexOf('(') + 1, t.indexOf('", ')).split(', "'),
              id = id || [];
          supabig[id[0]] = id[1];
      });
      $.each(idtable, function() {
          var t = $(this),
              check = t.val();
          t.val($("<div>").html(supabig[check]).text());
      });
      $('#result').val('All data parsed');
  };

  function _markforupload() {
      $(".cell3, .cell4, .cell5, .cell6, .cell7").focusout(function() {
          var parenttr = $(this).parent("td").parent("tr").attr("id"),
              change = $(this).val(),
              controls = $('<span class="uploadind controls">☑</span> <span class="uploadcan controls">☒</span>'),
              def = $(this).attr("default");
          console.log('row ' + parenttr + ' has lost focus');
          if (change != '' && change != def) {
              $('#' + parenttr).addClass("toupload").append(controls);
              console.log('row ' + parenttr + ' marked for upload');
          } else {
              $('#' + parenttr).removeClass("toupload").children('.controls').remove();
              console.log('row ' + parenttr + ' unmarked for upload');
          }
      });
  };

  function _sort(opt) {
$('.cell' + opt[0] + ':not(.cell' + opt[0] + '[value="' + opt[1] + '"])').parent('td').parent('tr').css({'position': 'absolute', 'top':'-1000px'});
  }

  function _upload(data) {
      acpsess = $('#acpid').val();
      console.log('Uploading with dataset: ')
      console.log(data)
      $.ajax({
          method: "POST",
          url: '/admin.php?adsess=' + acpsess + '&code=do_awardsedit&act=awards',
          timeout: 8000,
          data: {
              id: data[1],
              mid: data[7],
              name: data[2],
              image: data[3],
              givenby: data[4],
              description: data[5],
              display: data[6]
          },
          success: function() {
              $('#result').val('Award #' + data[1] + ' - Sent');
              $('tr#t' + data[1] + '').removeClass('toupload').children('.controls').remove();

          },
          error: function(String, errorThrown) {
              $('#result').va('Award #' + data[1] + ': Upload failed!')
          }
      });
  };

  function _asyncupload(m, um, dm, s, good, bad) {
      var acpsess = $('#acpid').val();
      $.ajax({
          method: m,
          url: um,
          timeout: 8000,
          data: dm,
          async: s,
          success: good,
          error: bad,
          statusCode: {
              200: $('#result').val('200 OK - Sending'),
              404: $('#result').val('404 not found - Halted - Retrying if possible')
          }
      });
  }

  function _sleep(milliseconds) {
      var start = new Date().getTime();
      for (var i = 0; i < 1e7; i++) {
          if ((new Date().getTime() - start) > milliseconds) {
              break;
          }
      }
  }
</script>


How It Works:

Barely.

Nah, just kidding. The script makes three requests using your ACP session ID: The first and second are sent to the backup system and has it backup the awards information and member list to a file, and the third downloads this file (this file is also available to be downloaded under the 'Database Files' option in the ACP). The file is parsed and undergoes a number of regex and split functions to separate the awards from the member list, and then subsequently to separate each of the individual entries. The awards entries are parsed first, and entered into the table. The member list is parsed second, and replaces the second column of ID numbers with their corresponding name.

When an input field is clicked in, and subsequently clicked out of, the script checks the current value against the stored default. If it's changed, it adds the class .toupload to the corresponding table row. This is why using tab strokes does not fire correctly. The deletion marker works similarly, except using the class .toremove.

Sorting by phrase effectively filters fields by placing non-relevant awards at top:-1000px;.

Replacement by phrase searches the filtered cell via the [value=X] selector, and changes the value accordingly.

Clicking 'Submit Edits' or 'Deleted Selected' makes a request for each appearing .toupload, and uses those markers to scoop the data and formulate the request. Changing classes or IDs will very likely make the script malfunction.

For those aspiring programmers, feel free to make edits or suggestions to my scripts. I'm far from a professional, or even terribly knowledgeable with it at all. I've left most of my debugging console.log()s intact for that reason, so feel free to use them.
May 23 2016, 12:18 PM
Hi there,

Kinda a nitpicky request, but is it possible to fiddle with the member group group icon field? As it stands now, you're able to enter a direct URL, which gets put into a regular image tag as the source. Would it be possible to scrap that entirely and allow raw input? I've recently been swapping most of my board media over to sprite sheets and div tags, and right now if I drop in a div with class 'blah' it translates to '<img src="<div class="blah"></div>">'

If not, nooo biggy. It's a quick script to change it over on page load, but I figured I'd ask before I started.
Mar 9 2016, 07:23 PM
Hi there,

Recently I was tinkering with awards, and I got to wondering if it'd be possible to pull them from a spritesheet to reduce the amount of image requests as opposed to loading each one individually.

The only problem is, there's no simple way to target the awards separately in such a way to consistently show the correct pixels of a large spritesheet for the awards. Would it be possible to add a 'class' field in the ACP where you set and give awards?
Feb 14 2016, 10:31 PM
Old Board Names [SOLVED]
Hi there,

I googled around and didn't find any definitive rules, so I hoped to clear it up. There's a forum that's been inactive since October of 2013, has 2 members, and 10 posts. My friend wanted to register the name, but obviously it's in use. Is this something that could be cleared up, or is it just something uncomfortable you'd rather avoid? Either way is fine.

Thanks!
Last Visitors


Mar 20 2017, 09:18 PM




Mar 19 2017, 02:50 PM




Jan 24 2017, 04:04 AM



Comments
No comments posted.
Add Comment