code:
var postingMenu = {};

postingMenu.init = function() {

  postingMenu.banLabels = [ 'Regular ban', 'Range ban (1/2 octects)',
      'Range ban (3/4 octects)', 'ASN ban', 'Warning' ];
  postingMenu.deletionOptions = [ 'Do not delete', 'Delete post',
      'Delete post and media', 'Delete by ip' ];
  postingMenu.threadSettingsList = [ {
    label : 'Toggle Lock',
    field : 'locked',
    parameter : 'lock'
  }, {
    label : 'Toggle Pin',
    field : 'pinned',
    parameter : 'pin'
  }, {
    label : 'Toggle Cyclic',
    field : 'cyclic',
    parameter : 'cyclic'
  } ];

  document.body.addEventListener('click', function clicked() {

    if (postingMenu.shownPostingMenu) {
      postingMenu.shownPostingMenu.remove();
      delete postingMenu.shownPostingMenu;
    }

  }, true);

  api.formApiRequest('account', {}, function gotLoginData(status, data) {

    if (status !== 'ok') {
      return;
    }

    postingMenu.loggedIn = true;

    postingMenu.globalRole = data.globalRole;

    postingMenu.moddedBoards = [];

    for (var i = 0; i < data.ownedBoards.length; i++) {
      postingMenu.moddedBoards.push(data.ownedBoards[i]);
    }

    for (i = 0; i < data.volunteeredBoards.length; i++) {
      postingMenu.moddedBoards.push(data.volunteeredBoards[i]);
    }

  }, {}, true);

  var links = document.getElementsByClassName('linkSelf');

  for (var i = 0; i < links.length; i++) {
    postingMenu.setExtraMenu(links[i]);
  }

};

postingMenu.showReport = function(board, thread, post, global) {

  var outerPanel = captchaModal.getCaptchaModal(global ? 'Global report'
      : 'Report');

  var reasonField = document.createElement('input');
  reasonField.type = 'text';

  var okButton = outerPanel.getElementsByClassName('modalOkButton')[0];

  okButton.onclick = function() {

    var typedCaptcha = outerPanel.getElementsByClassName('modalAnswer')[0].value
        .trim();

    if (typedCaptcha.length !== 6 && typedCaptcha.length !== 24) {
      alert('Captchas are exactly 6 (24 if no cookies) characters long.');
      return;
    } else if (/\W/.test(typedCaptcha)) {
      alert('Invalid captcha.');
      return;
    }

    var params = {
      captcha : typedCaptcha,
      reason : reasonField.value.trim(),
      global : global,
      action : 'report'
    };

    var key = board + '-' + thread;

    if (post) {
      key += '-' + post;
    }

    params[key] = true;

    api.formApiRequest('contentActions', params, function requestComplete(
        status, data) {

      if (status === 'ok') {
        outerPanel.remove();
      } else {
        alert(status + ': ' + JSON.stringify(data));
      }

    });

  };

  captchaModal.addModalRow('Reason', reasonField, okButton.onclick);

};

postingMenu.deleteSinglePost = function(boardUri, threadId, post, fromIp,
    unlinkFiles, wipeMedia, innerPart, forcedPassword) {

  var key = boardUri + '/' + threadId

  if (post) {
    key += '/' + post;
  }

  var storedData = JSON.parse(localStorage.postingPasswords || '{}');

  var password = forcedPassword || storedData[key]
      || localStorage.deletionPassword
      || document.getElementById('deletionFieldPassword').value.trim()
      || Math.random().toString(36).substring(2, 10);

  var params = {
    confirmation : true,
    password : password,
    deleteUploads : unlinkFiles,
    deleteMedia : wipeMedia,
    action : fromIp ? 'ip-deletion' : 'delete'
  };

  var key = boardUri + '-' + threadId;

  if (post) {
    key += '-' + post;
  }

  params[key] = true;

  var deletionCb = function requestComplete(status, data) {

    if (status !== 'ok') {
      alert(status + ': ' + JSON.stringify(data));
      return;
    }

    var data = data || {};

    var removed = data.removedThreads || data.removedPosts;

    if (unlinkFiles && removed) {
      innerPart.getElementsByClassName('panelUploads')[0].remove();
    } else if (fromIp) {

      if (api.isBoard || !api.boardUri) {
        location.reload(true);
      } else {
        window.location.pathname = '/' + boardUri + '/';
      }

    } else if (api.threadId && data.removedThreads) {
      window.location.pathname = '/' + boardUri + '/';
    } else if (removed) {
      innerPart.parentNode.remove();
    } else if (!removed) {

      var newPass = prompt('Could not delete. Would you like to try another password?');

      if (newPass) {
        postingMenu.deleteSinglePost(boardUri, threadId, post, fromIp,
            unlinkFiles, wipeMedia, innerPart, newPass);
      }

    }

  };

  api.formApiRequest('contentActions', params, deletionCb);

};

postingMenu.applySingleBan = function(typedMessage, deletionOption,
    typedReason, typedCaptcha, banType, typedDuration, global, boardUri,
    thread, post, innerPart, outerPanel) {

  localStorage.setItem('autoDeletionOption', deletionOption);

  var params = {
    action : 'ban',
    reason : typedReason,
    captcha : typedCaptcha,
    banType : banType,
    duration : typedDuration,
    banMessage : typedMessage,
    global : global
  };

  var key = boardUri + '-' + thread;

  if (post) {
    key += '-' + post;
  }

  params[key] = true;

  api.formApiRequest('contentActions', params, function requestComplete(status,
      data) {

    if (status === 'ok') {

      var banMessageDiv = innerPart.getElementsByClassName('divBanMessage')[0];

      if (!banMessageDiv) {
        banMessageDiv = document.createElement('div');
        banMessageDiv.className = 'divBanMessage';
        innerPart.appendChild(banMessageDiv);
      }

      banMessageDiv.innerHTML = typedMessage
          || '(USER WAS BANNED FOR THIS POST)';

      outerPanel.remove();

      if (deletionOption) {
        postingMenu.deleteSinglePost(boardUri, thread, post,
            deletionOption === 3, false, deletionOption === 2, innerPart);
      }

    } else {
      alert(status + ': ' + JSON.stringify(data));
    }
  });

};

postingMenu.banSinglePost = function(innerPart, boardUri, thread, post, global) {

  var outerPanel = captchaModal.getCaptchaModal(global ? 'Global ban' : 'Ban');

  var decorationPanel = outerPanel
      .getElementsByClassName('modalDecorationPanel')[0];

  var okButton = outerPanel.getElementsByClassName('modalOkButton')[0];

  var reasonField = document.createElement('input');
  reasonField.type = 'text';

  var durationField = document.createElement('input');
  durationField.type = 'text';

  var messageField = document.createElement('input');
  messageField.type = 'text';

  var typeCombo = document.createElement('select');

  for (var i = 0; i < postingMenu.banLabels.length; i++) {

    var option = document.createElement('option');
    option.innerHTML = postingMenu.banLabels[i];
    typeCombo.appendChild(option);

  }

  var deletionCombo = document.createElement('select');

  for (var i = 0; i < postingMenu.deletionOptions.length; i++) {

    var option = document.createElement('option');
    option.innerHTML = postingMenu.deletionOptions[i];
    deletionCombo.appendChild(option);

  }

  deletionCombo.selectedIndex = +localStorage.autoDeletionOption;

  var captchaField = outerPanel.getElementsByClassName('modalAnswer')[0];
  captchaField.setAttribute('placeholder', 'only for board staff)');

  okButton.onclick = function() {
    postingMenu.applySingleBan(messageField.value.trim(),
        deletionCombo.selectedIndex, reasonField.value.trim(),
        captchaField.value.trim(), typeCombo.selectedIndex, durationField.value
            .trim(), global, boardUri, thread, post, innerPart, outerPanel);
  };

  captchaModal.addModalRow('Reason', reasonField, okButton.onclick);
  captchaModal.addModalRow('Duration', durationField, okButton.onclick);
  captchaModal.addModalRow('Message', messageField, okButton.onclick);
  captchaModal.addModalRow('Type', typeCombo);
  captchaModal.addModalRow('Deletion action', deletionCombo);

};

postingMenu.spoilSinglePost = function(innerPart, boardUri, thread, post) {

  var params = {
    action : 'spoil'
  };

  var key = boardUri + '-' + thread;

  if (post) {
    key += '-' + post;
  }

  params[key] = true;

  api.formApiRequest('contentActions', params, function requestComplete(status,
      data) {

    // style exception, too simple
    api.localRequest('/' + boardUri + '/res/' + thread + '.json', function(
        error, data) {

      if (error) {
        return;
      }

      var thumbs = innerPart.getElementsByClassName('imgLink');

      for (var i = 0; i < thumbs.length; i++) {
        var thumb = thumbs[i].childNodes[0].src = '/spoiler.png';
      }

    });
    // style exception, too simple

  });

};

postingMenu.transferThread = function(boardUri, thread) {

  var destination = prompt('Transfer to which board?',
      'Board uri without slashes');

  if (!destination) {
    return;
  }

  destination = destination.trim();

  api.formApiRequest('transferThread', {
    boardUri : boardUri,
    threadId : thread,
    boardUriDestination : destination
  }, function transferred(status, data) {

    if (status === 'ok') {
      window.location.pathname = '/' + destination + '/res/' + data + '.html';
    } else {
      alert(status + ': ' + JSON.stringify(data));
    }
  });

};

postingMenu.updateEditedPosting = function(board, thread, post, innerPart, data) {

  innerPart.getElementsByClassName('divMessage')[0].innerHTML = data.markdown;

  var subjectLabel = innerPart.getElementsByClassName('labelSubject')[0];

  if (!subjectLabel && data.subject) {

    var pivot = innerPart.getElementsByClassName('linkName')[0];

    subjectLabel = document.createElement('span');
    subjectLabel.className = 'labelSubject';
    pivot.parentNode.insertBefore(subjectLabel, pivot);

    pivot.parentNode.insertBefore(document.createTextNode(' '), pivot);

  } else if (subjectLabel && !data.subject) {
    subjectLabel.remove();
  }

  if (data.subject) {
    subjectLabel.innerHTML = data.subject;
  }

};

postingMenu.getNewEditData = function(board, thread, post, innerPart) {

  api.localRequest('/' + board + '/res/' + thread + '.json', function(error,
      data) {

    if (error) {
      return;
    }

    data = JSON.parse(data);

    if (post) {

      for (var i = 0; i < data.posts.length; i++) {
        if (data.posts[i].postId === +post) {
          data = data.posts[i];
          break;
        }
      }

    }

    postingMenu.updateEditedPosting(board, thread, post, innerPart, data);

  });

};

postingMenu.editPost = function(board, thread, post, innerPart) {

  var parameters = {
    boardUri : board,
    threadId : thread
  };

  if (post) {
    parameters.postId = post;
  }

  api.formApiRequest('edit', {}, function gotData(status, data) {

    if (status !== 'ok') {
      alert(status);
      return;
    }

    var outerPanel = captchaModal.getCaptchaModal('Edit', true);

    var okButton = outerPanel.getElementsByClassName('modalOkButton')[0];

    var subjectField = document.createElement('input');
    subjectField.type = 'text';
    subjectField.value = data.subject || '';

    var messageArea = document.createElement('textarea');
    messageArea.setAttribute('rows', '5');
    messageArea.setAttribute('cols', '35');
    messageArea.setAttribute('placeholder', 'message');
    messageArea.defaultValue = data.message || '';

    okButton.onclick = function() {

      var typedSubject = subjectField.value.trim();
      var typedMessage = messageArea.value.trim();

      if (typedSubject.length > 128) {
        alert('Subject too long, keep it under 128 characters.');
      } else if (!typedMessage.length) {
        alert('A message is mandatory.');
      } else {

        var parameters = {
          boardUri : board,
          message : typedMessage,
          subject : typedSubject
        };

        if (post) {
          parameters.postId = post;
        } else {
          parameters.threadId = thread;
        }

        // style exception, too simple
        api.formApiRequest('saveEdit', parameters, function requestComplete(
            status, data) {

          if (status === 'ok') {
            outerPanel.remove();
            postingMenu.getNewEditData(board, thread, post, innerPart);
          } else {
            alert(status + ': ' + JSON.stringify(data));
          }
        });
        // style exception, too simple

      }

    };

    captchaModal.addModalRow('Subject', subjectField, okButton.onclick);
    captchaModal.addModalRow('Message', messageArea);

  }, false, parameters);

};

postingMenu.toggleThreadSetting = function(boardUri, thread, settingIndex,
    innerPart) {

  api.localRequest('/' + boardUri + '/res/' + thread + '.json',
      function gotData(error, data) {

        if (error) {
          alert(error);
          return;
        }

        var data = JSON.parse(data);

        var parameters = {
          boardUri : boardUri,
          threadId : thread
        };

        for (var i = 0; i < postingMenu.threadSettingsList.length; i++) {

          var field = postingMenu.threadSettingsList[i];

          parameters[field.parameter] = settingIndex === i ? !data[field.field]
              : data[field.field];

        }

        api.formApiRequest('changeThreadSettings', parameters,
            function requestComplete(status, data) {

              if (status === 'ok') {
                api.resetIndicators({
                  locked : parameters.lock,
                  pinned : parameters.pin,
                  cyclic : parameters.cyclic,
                  archived : innerPart
                      .getElementsByClassName('archiveIndicator').length
                }, innerPart);
              } else {
                alert(status + ': ' + JSON.stringify(data));
              }
            });

      });

};

postingMenu.addToggleSettingButton = function(extraMenu, board, thread, index,
    innerPart) {

  extraMenu.appendChild(document.createElement('hr'));

  var toggleButton = document.createElement('div');
  toggleButton.innerHTML = postingMenu.threadSettingsList[index].label;
  toggleButton.onclick = function() {
    postingMenu.toggleThreadSetting(board, thread, index, innerPart);
  };

  extraMenu.appendChild(toggleButton);

};

postingMenu.sendArchiveRequest = function(board, thread, innerPart) {

  api.formApiRequest('archiveThread', {
    confirmation : true,
    boardUri : board,
    threadId : thread
  }, function(status, data) {

    if (status === 'ok') {

      if (!api.threadId) {
        innerPart.parentNode.remove();
        return;
      }

      var lock = innerPart.getElementsByClassName('lockIndicator').length;
      var pin = innerPart.getElementsByClassName('pinIndicator').length;
      var cyclic = innerPart.getElementsByClassName('cyclicIndicator').length;

      api.resetIndicators({
        locked : lock,
        pinned : pin,
        cyclic : cyclic,
        archived : true
      }, innerPart);

    } else {
      alert(status + ': ' + JSON.stringify(data));
    }

  });

};

postingMenu.setExtraMenuThread = function(extraMenu, board, thread, innerPart) {

  if (postingMenu.globalRole <= 1) {

    extraMenu.appendChild(document.createElement('hr'));

    var transferButton = document.createElement('div');
    transferButton.innerHTML = 'Transfer Thread';
    transferButton.onclick = function() {
      postingMenu.transferThread(board, thread);
    };
    extraMenu.appendChild(transferButton);

  }

  for (var i = 0; i < postingMenu.threadSettingsList.length; i++) {
    postingMenu.addToggleSettingButton(extraMenu, board, thread, i, innerPart);
  }

  if (!innerPart.getElementsByClassName('archiveIndicator').length) {

    extraMenu.appendChild(document.createElement('hr'));

    var archiveButton = document.createElement('div');
    archiveButton.innerHTML = 'Archive';
    archiveButton.onclick = function() {

      if (confirm("Are you sure you wish to lock and archive this thread?")) {
        postingMenu.sendArchiveRequest(board, thread, innerPart);
      }

    };
    extraMenu.appendChild(archiveButton);
  }

};

postingMenu.setModFileOptions = function(extraMenu, innerPart, board, thread,
    post) {

  extraMenu.appendChild(document.createElement('hr'));

  var spoilButton = document.createElement('div');
  spoilButton.innerHTML = 'Spoil Files';
  spoilButton.onclick = function() {
    postingMenu.spoilSinglePost(innerPart, board, thread, post);
  };
  extraMenu.appendChild(spoilButton);

  if (postingMenu.globalRole > 3) {
    return;
  }

  extraMenu.appendChild(document.createElement('hr'));

  var deleteMediaButton = document.createElement('div');
  deleteMediaButton.innerHTML = 'Delete Post And Media';
  extraMenu.appendChild(deleteMediaButton);
  deleteMediaButton.onclick = function() {
    postingMenu.deleteSinglePost(board, thread, post, false, false, true,
        innerPart);
  };

};

postingMenu.setExtraMenuMod = function(innerPart, extraMenu, board, thread,
    post, hasFiles) {

  if (hasFiles) {
    postingMenu.setModFileOptions(extraMenu, innerPart, board, thread, post);
  }

  extraMenu.appendChild(document.createElement('hr'));

  var deleteByIpButton = document.createElement('div');
  deleteByIpButton.innerHTML = 'Delete By Ip';
  deleteByIpButton.onclick = function() {

    if (confirm("Are you sure you wish to delete all posts on this board made by this ip?")) {
      postingMenu.deleteSinglePost(board, thread, post, true, null, null,
          innerPart);
    }

  };
  extraMenu.appendChild(deleteByIpButton);

  extraMenu.appendChild(document.createElement('hr'));

  var banButton = document.createElement('div');
  banButton.innerHTML = 'Ban';
  banButton.onclick = function() {
    postingMenu.banSinglePost(innerPart, board, thread, post);
  };
  extraMenu.appendChild(banButton);

  if (postingMenu.globalRole <= 2) {

    extraMenu.appendChild(document.createElement('hr'));

    var globalBanButton = document.createElement('div');
    globalBanButton.innerHTML = 'Global Ban';
    globalBanButton.onclick = function() {
      postingMenu.banSinglePost(innerPart, board, thread, post, true);
    };
    extraMenu.appendChild(globalBanButton);

  }

  extraMenu.appendChild(document.createElement('hr'));

  var editButton = document.createElement('div');
  editButton.innerHTML = 'Edit';
  editButton.onclick = function() {
    postingMenu.editPost(board, thread, post, innerPart);
  };
  extraMenu.appendChild(editButton);

  if (!post) {
    postingMenu.setExtraMenuThread(extraMenu, board, thread, innerPart);
  }

};

postingMenu.buildMenu = function(linkSelf, extraMenu) {

  var innerPart = linkSelf.parentNode.parentNode;

  var href = linkSelf.href;

  if (!api.mod) {

    var parts = href.split('/');

    var board = parts[3];

    var finalParts = parts[5].split('.');

    var thread = finalParts[0];

  } else {

    var urlParams = new URLSearchParams(href.split('?')[1]);

    board = urlParams.get('boardUri');
    thread = urlParams.get('threadId').split('#')[0];

  }

  var post = href.split('#')[1];

  if (post === thread) {
    post = undefined;
  }

  var reportButton = document.createElement('div');
  reportButton.innerHTML = 'Report';
  reportButton.onclick = function() {
    postingMenu.showReport(board, thread, post);
  };
  extraMenu.appendChild(reportButton);

  extraMenu.appendChild(document.createElement('hr'));

  var globalReportButton = document.createElement('div');
  globalReportButton.innerHTML = 'Global Report';
  globalReportButton.onclick = function() {
    postingMenu.showReport(board, thread, post, true);
  };
  extraMenu.appendChild(globalReportButton);

  extraMenu.appendChild(document.createElement('hr'));

  var deleteButton = document.createElement('div');
  deleteButton.innerHTML = 'Delete Post';
  extraMenu.appendChild(deleteButton);
  deleteButton.onclick = function() {
    postingMenu.deleteSinglePost(board, thread, post, null, null, null,
        innerPart);
  };

  var hasFiles = linkSelf.parentNode.parentNode
      .getElementsByClassName('panelUploads')[0];

  hasFiles = hasFiles && hasFiles.children.length > 0;

  if (hasFiles) {

    extraMenu.appendChild(document.createElement('hr'));

    var unlinkButton = document.createElement('div');
    unlinkButton.innerHTML = 'Unlink Files';
    extraMenu.appendChild(unlinkButton);
    unlinkButton.onclick = function() {
      postingMenu.deleteSinglePost(board, thread, post, false, true, null,
          innerPart);
    };

  }

  if (postingMenu.loggedIn
      && (postingMenu.globalRole < 4 || postingMenu.moddedBoards.indexOf(board) >= 0)) {
    postingMenu.setExtraMenuMod(innerPart, extraMenu, board, thread, post,
        hasFiles);
  }

};

postingMenu.setExtraMenu = function(linkSelf) {

  var extraMenuButton = document.createElement('span');
  extraMenuButton.className = 'extraMenuButton glowOnHover coloredIcon';
  extraMenuButton.title = 'Post Menu';

  var parentNode = linkSelf.parentNode;

  var checkbox = parentNode.getElementsByClassName('deletionCheckBox')[0];

  parentNode.insertBefore(extraMenuButton, checkbox ? checkbox.nextSibling
      : parentNode.childNodes[0]);

  extraMenuButton.onclick = function() {

    var extraMenu = document.createElement('div');
    extraMenu.className = 'floatingMenu extraMenu';

    extraMenuButton.appendChild(extraMenu);

    postingMenu.shownPostingMenu = extraMenu;

    postingMenu.buildMenu(linkSelf, extraMenu);

  };

};

postingMenu.init();


code:
var qr = {};

qr.init = function() {

  qr.setQr();

  var hash = window.location.hash.substring(1);

  if (hash.indexOf('q') === 0 && hash.length > 1) {

    hash = hash.substring(1);

    var post = document.getElementById(hash);

    if (post) {

      post.scrollIntoView();
      qr.showQr(hash);

      thread.markPost(hash);
    }

  } else if (hash.length > 0) {
    thread.markPost(hash);
  }

};

qr.removeQr = function() {
  qr.qrPanel.style.display = 'none';
};

qr.showQr = function(quote) {

  qr.qrPanel.style.display = 'block';

  if (qr.qrPanel.getBoundingClientRect().top < 0) {
    qr.qrPanel.style.top = '25px';
  }

  document.getElementById('qrbody').value += '>>' + quote + '\n';

  var selectedText = window.getSelection();
  if (selectedText != '') {
    document.getElementById('qrbody').value += '>' + selectedText + '\n';
  }

  document.getElementById('fieldMessage').value = document
      .getElementById('qrbody').value;

  postCommon.updateCurrentChar();

};

qr.registerSync = function(source, destination, field, event) {

  var sourceElement = document.getElementById(source);
  var destinationElement = document.getElementById(destination);

  destinationElement[field] = sourceElement[field];

  sourceElement.addEventListener(event, function() {
    if (destinationElement) {
      destinationElement[field] = sourceElement[field];
    }
  });

  destinationElement.addEventListener(event, function() {
    sourceElement[field] = destinationElement[field];
  });

};

qr.setQr = function() {

  var flags = document.getElementById('flagsDiv') ? true : false;

  var QRshowname = document.getElementById('fieldName') ? true : false;

  var textBoard = !document.getElementById('divUpload');

  var qrhtml = '
';
  qrhtml += '
';
  qrhtml += '

';
  qrhtml += '';
  qrhtml += '';
  qrhtml += 'Quick Reply
';

  if (QRshowname) {
    qrhtml += '
<input id="qrname" type="text"';
    qrhtml += ' maxlength="35" autocomplete="off" placeholder="Name">
';
  }

  qrhtml += '
';
  qrhtml += '<input id="qrsubject" type="text" maxlength="100"';
  qrhtml += 'autocomplete="off" placeholder="Subject ">';
  qrhtml += '	';
  qrhtml += '
';

  qrhtml += '
<textarea id="qrbody" rows="5" placeholder="Comment">';
  qrhtml += '</textarea>
 ';

  if (!textBoard) {

    if (api.mobile) {
      qrhtml += '
Files
';
      qrhtml += '

';
    }

    qrhtml += '

';
    qrhtml += 'Drag files to upload or
 click here to select them
';
    qrhtml += '

';

    qrhtml += '
<input type="checkbox" ';
    qrhtml += 'id="qrcheckboxSpoiler" class="postingCheckbox">';
    qrhtml += 'Spoiler
';

    if (api.mobile) {
      qrhtml += '

'
    }

  }

  if (!api.hiddenCaptcha) {

    if (api.mobile) {
      qrhtml += '
Captcha
';
      qrhtml += '

'
    }

    var parts = document.getElementById('captchaImage').src.split('/');

    var lastPart = '/' + parts[parts.length - 1];

    qrhtml += '

';

    qrhtml += '
<input type="button" onClick="captchaUtils.reloadCaptcha()"';
    qrhtml += ' value="Reload">
';

    qrhtml += '
<input type="text" class="captchaField" ';
    qrhtml += 'id="QRfieldCaptcha" placeholder="Answer">	';
    qrhtml += 'No cookies?
';

    if (api.mobile) {
      qrhtml += '

'
    }
  }

  qrhtml += '
Extra
';

  qrhtml += '

';

  qrhtml += '
';
  qrhtml += '<input id="qremail" type="text" maxlength="40" ';
  qrhtml += 'autocomplete="off" placeholder="Email">';
  qrhtml += '
 ';

  qrhtml += '
';
  qrhtml += '<input id="qrpassword" type="password" placeholder="Password">
';

  if (flags) {
    qrhtml += '

';
  }

  var noFlagDiv = document.getElementById('noFlagDiv');

  if (noFlagDiv) {
    qrhtml += '
<input type="checkbox" ';
    qrhtml += 'id="qrcheckboxNoFlag" class="postingCheckbox">';
    qrhtml += '';
    qrhtml += 'Don\'t show location
';
  }

  qrhtml += '
<input type="checkbox" ';
  qrhtml += 'id="qralwaysUseBypassCheckBox" class="postingCheckbox">';
  qrhtml += '';
  qrhtml += 'Make sure I have a block bypass
';

  qrhtml += '

 ';
  qrhtml += '<button accesskey="s" id="qrbutton" type="button" onclick="thread.postReply()">Reply';
  qrhtml += '
';

  qrhtml += '

';

  qr.qrPanel = document.createElement('div');
  qr.qrPanel.innerHTML = qrhtml;
  qr.qrPanel = qr.qrPanel.children[0];

  draggable.setDraggable(qr.qrPanel, qr.qrPanel
      .getElementsByClassName('handle')[0]);

  document.body.appendChild(qr.qrPanel);

  var extra = document.getElementById('qrExtra');
  document.getElementById('qrFormMore').onclick = function() {
    extra.classList.toggle('hidden');
  };

  qr.registerSync('fieldEmail', 'qremail', 'value', 'input');
  qr.registerSync('fieldSubject', 'qrsubject', 'value', 'input');
  qr.registerSync('fieldMessage', 'qrbody', 'value', 'input');
  document.getElementById('qrbody').addEventListener('input',
      postCommon.updateCurrentChar);
  qr.registerSync('fieldPostingPassword', 'qrpassword', 'value', 'input');
  qr.registerSync('alwaysUseBypassCheckBox', 'qralwaysUseBypassCheckBox',
      'checked', 'change');

  if (noFlagDiv) {
    qr.registerSync('checkboxNoFlag', 'qrcheckboxNoFlag', 'checked', 'change');
  }

  if (!textBoard) {

    if (api.mobile) {
      var fileBodyBody = document.getElementById('filesBody');
      document.getElementById('qrFilesButton').onclick = function() {
        fileBodyBody.classList.toggle('hidden');
      };

    }

    qr
        .registerSync('checkboxSpoiler', 'qrcheckboxSpoiler', 'checked',
            'change');
    postCommon.setDragAndDrop(true);

    for (var i = 0; i < selectedDiv.childNodes.length; i++) {
      var originalCell = selectedDiv.childNodes[i];
      var clonedCell = originalCell.cloneNode(true);

      clonedCell.getElementsByClassName('removeButton')[0].onclick = originalCell
          .getElementsByClassName('removeButton')[0].onclick;

      selectedDivQr.appendChild(clonedCell);
    }
  }

  if (flags) {

    document.getElementById('qrFlagsDiv').innerHTML = document
        .getElementById('flagsDiv').innerHTML.replace('flagCombobox',
        'qrFlagCombobox');

    qrFlagCombo = document.getElementById('qrFlagCombobox');

    postCommon.setFlagPreviews(qrFlagCombo)

    qr.registerSync('flagCombobox', 'qrFlagCombobox', 'value', 'change');

  }

  if (QRshowname) {
    qr.registerSync('fieldName', 'qrname', 'value', 'input');
  }

  if (!api.hiddenCaptcha) {

    if (api.mobile) {
      var captchaBody = document.getElementById('captchaBody');
      document.getElementById('qrCaptchaButton').onclick = function() {
        captchaBody.classList.toggle('hidden');
      };
    }

    qr.registerSync('fieldCaptcha', 'QRfieldCaptcha', 'value', 'input');
  }

};

qr.setQRReplyText = function(text) {

  var qrReplyButton = document.getElementById('qrbutton');

  if (qrReplyButton) {
    qrReplyButton.innerHTML = text;
  }

};

qr.clearQRAfterPosting = function() {

  var qrMessageField = document.getElementById('qrbody');

  if (!qrMessageField) {
    return;
  }

  document.getElementById('qrsubject').value = '';
  qrMessageField.value = '';

};

qr.setQRReplyEnabled = function(enabled) {

  var qrReplyButton = document.getElementById('qrbutton');

  if (qrReplyButton) {
    qrReplyButton.disabled = !enabled;
  }

};

qr.init();

repo_name: milk/PenumbraLynx

license: mit


code:
var rangeBans = {};

rangeBans.init = function() {

  var boardIdentifier = document.getElementById('boardIdentifier');

  if (boardIdentifier) {
    api.boardUri = boardIdentifier.value;
  }

  api.convertButton('createFormButton', rangeBans.placeRangeBan,
      'rangeBanField');

  var rangeBanCells = document.getElementsByClassName('rangeBanCell');

  for (var j = 0; j < rangeBanCells.length; j++) {
    rangeBans.processRangeBanCell(rangeBanCells[j]);
  }

  rangeBans.bansDiv = document.getElementById('rangeBansDiv');

};

rangeBans.processRangeBanCell = function(cell) {

  var button = cell.getElementsByClassName('liftFormButton')[0];

  api.convertButton(button, function() {
    rangeBans.liftBan(cell);
  });

};

rangeBans.liftBan = function(cell) {

  api.formApiRequest('liftBan', {
    banId : cell.getElementsByClassName('idIdentifier')[0].value
  }, function requestComplete(status, data) {

    if (status === 'ok') {
      cell.remove();
    } else {
      alert(status + ': ' + JSON.stringify(data));
    }
  });

};

rangeBans.showNewRangeBan = function(typedRange, id) {

  var form = document.createElement('form');
  form.className = 'rangeBanCell';
  form.action = '/liftBan.js';
  form.method = 'post';
  form.enctype = 'multipart/form-data';
  rangeBans.bansDiv.appendChild(form);

  form.appendChild(document.createElement('hr'));

  var rangePara = document.createElement('p');
  rangePara.innerHTML = 'Range: ';
  form.appendChild(rangePara);

  var rangeLabel = document.createElement('span');
  rangeLabel.innerHTML = typedRange;
  rangeLabel.className = 'rangeLabel';
  rangePara.appendChild(rangeLabel);

  var idIdentifier = document.createElement('input');
  idIdentifier.className = 'idIdentifier';
  idIdentifier.type = 'hidden';
  form.appendChild(idIdentifier);
  idIdentifier.value = id;

  var liftButton = document.createElement('button');
  liftButton.type = 'submit';
  liftButton.innerHTML = 'Lift ban';
  liftButton.className = 'liftFormButton';
  form.appendChild(liftButton);

  rangeBans.processRangeBanCell(form);

};

rangeBans.placeRangeBan = function() {

  var typedRange = document.getElementById('rangeField').value.trim();
  var typedDuration = document.getElementById('durationField').value.trim();
  var typedReason = document.getElementById('reasonField').value.trim();

  var parameters = {
    range : typedRange,
    boardUri : api.boardUri,
    duration : typedDuration,
    reason : typedReason
  };

  api.formApiRequest('placeRangeBan', parameters, function requestComplete(
      status, data) {

    if (status === 'ok') {

      document.getElementById('rangeField').value = '';
      rangeBans.showNewRangeBan(typedRange, data);

    } else {
      alert(status + ': ' + JSON.stringify(data));
    }
  });

};

rangeBans.init();


code:
var reports = {};

reports.closeReports = function() {

  var reportDiv = document.getElementById('reportDiv');

  var cells = [];

  var params = {
    duration : document.getElementById('fieldBanDuration').value,
    banReason : document.getElementById('fieldBanReason').value,
    banReporter : document.getElementById('banReporterCheckbox').checked,
    deleteContent : document.getElementById('deleteContentCheckbox').checked
  };

  for (var i = 0; i < reportDiv.childNodes.length; i++) {

    var checkbox = reportDiv.childNodes[i]
        .getElementsByClassName('closureCheckbox')[0];

    if (checkbox.checked) {
      cells.push(reportDiv.childNodes[i]);
      params[checkbox.name] = true;
    }

  }

  api.formApiRequest('closeReports', params, function requestComplete(status,
      data) {

    if (status === 'ok') {

      for (i = 0; i < cells.length; i++) {
        reportDiv.removeChild(cells[i]);
      }

    } else {
      alert(status + ': ' + JSON.stringify(data));
    }
  });

};


code:
var ruleManagement = {};

ruleManagement.init = function() {

  api.convertButton('addFormButton', ruleManagement.addRule,
      'ruleManagementField');

  api.boardUri = document.getElementById('boardIdentifier').value;

  var rules = document.getElementsByClassName('ruleManagementCell');

  for (var i = 0; i < rules.length; i++) {
    ruleManagement.processRuleCell(rules[i]);
  }

  ruleManagement.ruleDiv = document.getElementById('divRules');

};

ruleManagement.processRuleCell = function(cell) {

  var button = cell.getElementsByClassName('deleteFormButton')[0];

  api.convertButton(button, function() {

    var index = cell.getElementsByClassName('indexIdentifier')[0].value;

    api.formApiRequest('deleteRule', {
      boardUri : api.boardUri,
      ruleIndex : index,
    }, function requestComplete(status, data) {
      if (status === 'ok') {
        cell.remove();

        var identifiers = document.getElementsByClassName('indexIdentifier');

        for (var i = 0; i < identifiers.length; i++) {
          identifiers[i].value = i.toString();
        }

      } else {
        alert(status + ': ' + JSON.stringify(data));
      }
    });

  });

};

ruleManagement.showNewRule = function(typedRule) {

  var form = document.createElement('form');
  form.className = 'ruleManagementCell';
  form.action = '/deleteRule.js';
  form.method = 'post';
  form.enctype = 'multipart/form-data';
  ruleManagement.ruleDiv.appendChild(form);

  var rulePara = document.createElement('p');
  form.appendChild(rulePara);

  var ruleLabel = document.createElement('span');
  ruleLabel.className = 'textLabel';
  ruleLabel.innerHTML = typedRule;
  rulePara.appendChild(ruleLabel);

  var indexIdentifier = document.createElement('input');
  indexIdentifier.className = 'indexIdentifier';
  indexIdentifier.type = 'hidden';
  indexIdentifier.name = 'ruleIndex';
  indexIdentifier.value = document.getElementsByClassName('indexIdentifier').length;
  form.appendChild(indexIdentifier);

  var boardIdentifier = document.createElement('input');
  boardIdentifier.type = 'hidden';
  boardIdentifier.name = 'boardUri';
  boardIdentifier.className = 'boardIdentifier';
  boardIdentifier.value = api.boardUri;
  form.appendChild(boardIdentifier);

  var deleteButton = document.createElement('button');
  deleteButton.type = 'button';
  deleteButton.innerHTML = 'Delete rule';
  deleteButton.className = 'deleteFormButton';
  form.appendChild(deleteButton);

  form.appendChild(document.createElement('hr'));

  ruleManagement.processRuleCell(form);

};

ruleManagement.addRule = function() {

  var typedRule = document.getElementById('fieldRule').value.trim();

  if (!typedRule.length) {
    alert('You can\'t inform a blank rule.');

  } else if (typedRule.length > 512) {
    alert('Rule too long, keep in under 512 characters.');
  } else {

    api.formApiRequest('createRule', {
      boardUri : api.boardUri,
      rule : typedRule,
    }, function requestComplete(status, data) {
      if (status === 'ok') {

        document.getElementById('fieldRule').value = '';
        ruleManagement.showNewRule(typedRule);

      } else {
        alert(status + ': ' + JSON.stringify(data));
      }
    });

  }

};

ruleManagement.init();


code:
var settingsMenu = {};

settingsMenu.init = function() {

  settingsMenu.loadedFilters = JSON.parse(localStorage.filterData || '[]');
  settingsMenu.filterTypes = [ 'Name', 'Tripcode', 'Subject', 'Message', 'Id' ];

  var settingsMenuDiv = document.createElement('div');

  settingsMenu.placeNavBarButton(settingsMenuDiv);

  var settingsMenuHeader = document.createElement('div');
  settingsMenuHeader.className = 'header';
  settingsMenuDiv.appendChild(settingsMenuHeader);

  var settingsMenuLabel = document.createElement('label');
  settingsMenuLabel.innerHTML = 'Settings';
  settingsMenuLabel.className = 'headerLabel';

  settingsMenuHeader.appendChild(settingsMenuLabel);

  settingsMenu.showingSettings = false;

  var closeSettingsMenuButton = document.createElement('span');
  closeSettingsMenuButton.id = 'closeSettingsMenuButton';
  closeSettingsMenuButton.className = 'coloredIcon glowOnHover';
  closeSettingsMenuButton.onclick = function() {

    if (!settingsMenu.showingSettings) {
      return;
    }

    settingsMenu.showingSettings = false;
    settingsMenuDiv.style.display = 'none';

  };

  settingsMenuHeader.appendChild(closeSettingsMenuButton);

  settingsMenuDiv.appendChild(document.createElement('hr'));

  settingsMenuDiv.id = 'settingsMenu';
  settingsMenuDiv.className = 'floatingMenu';
  settingsMenuDiv.style.display = 'none';

  document.body.appendChild(settingsMenuDiv);

  draggable.setDraggable(settingsMenuDiv, settingsMenuHeader);

  settingsMenu.tabsDiv = document.createElement('div');
  settingsMenuDiv.appendChild(settingsMenu.tabsDiv);

  settingsMenu.menuContentPanel = document.createElement('div');
  settingsMenuDiv.appendChild(settingsMenu.menuContentPanel);

  settingsMenu.registerTab('Filters', settingsMenu.getFiltersContent(), true);
  settingsMenu.registerTab('CSS', settingsMenu.getCSSContent());
  settingsMenu.registerTab('JS', settingsMenu.getJSContent());
  settingsMenu.registerTab('Other', settingsMenu.getOtherContent());

};

settingsMenu.selectSettingsPanel = function(tab, panel) {

  if (tab === settingsMenu.currentSettingsTab) {
    return;
  }

  if (settingsMenu.currentSettingsTab) {
    settingsMenu.currentSettingsTab.id = '';
    settingsMenu.currentSettingsPanel.remove();
  }

  settingsMenu.menuContentPanel.appendChild(panel);
  tab.id = 'selectedTab';

  settingsMenu.currentSettingsPanel = panel;
  settingsMenu.currentSettingsTab = tab;

};

settingsMenu.registerTab = function(text, content, select) {

  var newTab = document.createElement('span');
  newTab.innerHTML = text;
  newTab.className = 'settingsTab';
  newTab.onclick = function() {
    settingsMenu.selectSettingsPanel(newTab, content);
  };
  settingsMenu.tabsDiv.appendChild(newTab);

  if (select) {
    newTab.onclick();
  }

};

settingsMenu.placeNavBarButton = function(settingsMenuDiv) {

  var postingLink = document.getElementById('navPosting');
  var referenceNode = postingLink.nextSibling;

  postingLink.parentNode.insertBefore(document.createTextNode(' '),
      referenceNode);

  var divider = document.createElement('span');
  divider.innerHTML = '/';
  postingLink.parentNode.insertBefore(divider, referenceNode);

  postingLink.parentNode.insertBefore(document.createTextNode(' '),
      referenceNode);

  var settingsButton = document.createElement('a');
  settingsButton.id = 'settingsButton';
  settingsButton.className = 'coloredIcon';
  postingLink.parentNode.insertBefore(settingsButton, referenceNode);

  settingsButton.onclick = function() {

    if (settingsMenu.showingSettings) {
      return;
    }

    settingsMenu.showingSettings = true;
    settingsMenuDiv.style.display = 'block';

  }

};

settingsMenu.addFilterDisplay = function(filter) {

  var filterCell = document.createElement('div');

  var cellWrapper = document.createElement('div');
  settingsMenu.existingFiltersDiv.appendChild(cellWrapper);

  var filterTypeLabel = document.createElement('span');
  filterTypeLabel.innerHTML = settingsMenu.filterTypes[filter.type];
  filterTypeLabel.className = 'existingFilterTypeLabel';
  filterCell.appendChild(filterTypeLabel);

  var filterContentLabel = document.createElement('span');
  var contentToDisplay = filter.filter;
  if (filter.regex) {
    contentToDisplay = '/' + contentToDisplay + '/';
  }
  filterContentLabel.innerHTML = contentToDisplay;
  filterContentLabel.className = 'existingFilterContentLabel';
  filterCell.appendChild(filterContentLabel);

  var button = document.createElement('span');
  button.className = 'filterDeleteButton glowOnHover coloredIcon';
  filterCell.appendChild(button);

  button.onclick = function() {

    settingsMenu.loadedFilters.splice(settingsMenu.loadedFilters
        .indexOf(filter), 1);

    localStorage.filterData = JSON.stringify(settingsMenu.loadedFilters);

    hiding.checkFilters();

    cellWrapper.remove();

  };

  cellWrapper.appendChild(document.createElement('hr'));
  cellWrapper.appendChild(filterCell);

};

settingsMenu.createFilter = function(content, regex, type) {

  var newFilterData = {
    filter : content,
    regex : regex,
    type : type
  };

  settingsMenu.addFilterDisplay(newFilterData);

  settingsMenu.loadedFilters.push(newFilterData);

  localStorage
      .setItem('filterData', JSON.stringify(settingsMenu.loadedFilters));

  hiding.checkFilters();

};

settingsMenu.getFiltersContent = function() {

  var filtersPanel = document.createElement('div');

  var newFilterPanel = document.createElement('span');
  newFilterPanel.id = 'newFilterPanel';

  filtersPanel.appendChild(newFilterPanel);

  var newFilterTypeCombo = document.createElement('select');

  for (var i = 0; i < 4; i++) {

    var option = document.createElement('option');
    option.innerHTML = settingsMenu.filterTypes[i];
    newFilterTypeCombo.appendChild(option);
  }

  newFilterPanel.appendChild(newFilterTypeCombo);

  var newFilterField = document.createElement('input');
  newFilterField.type = 'text';
  newFilterField.placeholder = 'filter';
  newFilterPanel.appendChild(newFilterField);

  var regexLabel = document.createElement('label');
  regexLabel.innerHTML = 'Regex';
  regexLabel.className = 'settingsLabel';
  newFilterPanel.appendChild(regexLabel);

  var newFilterRegex = document.createElement('input');
  newFilterRegex.type = 'checkbox';
  newFilterPanel.appendChild(newFilterRegex);

  var newFilterButton = document.createElement('button');
  newFilterButton.innerHTML = 'Add filter';
  newFilterButton.onclick = function() {

    var filterContent = newFilterField.value.trim();

    if (!filterContent) {
      return;
    }

    settingsMenu.createFilter(filterContent, newFilterRegex.checked,
        newFilterTypeCombo.selectedIndex);

  };
  newFilterPanel.appendChild(newFilterButton);

  var existingFiltersLabelsPanel = document.createElement('div');
  filtersPanel.appendChild(existingFiltersLabelsPanel);

  var labelType = document.createElement('label');
  labelType.innerHTML = 'Type';
  labelType.id = 'labelExistingFilfterType';
  existingFiltersLabelsPanel.appendChild(labelType);

  var labelContent = document.createElement('label');
  labelContent.innerHTML = 'Content';
  labelContent.id = 'labelExistingFilfterContent';
  existingFiltersLabelsPanel.appendChild(labelContent);

  settingsMenu.existingFiltersDiv = document.createElement('div');
  settingsMenu.existingFiltersDiv.id = 'existingFiltersPanel';
  filtersPanel.appendChild(settingsMenu.existingFiltersDiv);

  for (var i = 0; i < settingsMenu.loadedFilters.length; i++) {
    settingsMenu.addFilterDisplay(settingsMenu.loadedFilters[i]);
  }

  return filtersPanel;

};

settingsMenu.getCSSContent = function() {

  var savedCSS = localStorage.customCSS;

  var head = document.getElementsByTagName('head')[0];

  var newCSS = document.createElement('style');

  head.appendChild(newCSS);

  if (savedCSS) {
    newCSS.innerHTML = savedCSS;
  }

  var cssPanel = document.createElement('div');

  var cssArea = document.createElement('textarea');
  cssPanel.appendChild(cssArea);
  if (savedCSS) {
    cssArea.value = savedCSS;
  }
  cssArea.id = 'cssInput';

  var bottomDiv = document.createElement('div');
  cssPanel.appendChild(bottomDiv);

  var saveButton = document.createElement('button');
  saveButton.innerHTML = 'Save';
  bottomDiv.appendChild(saveButton);

  saveButton.onclick = function() {
    newCSS.innerHTML = cssArea.value.trim();
    localStorage.customCSS = newCSS.innerHTML;
  };

  return cssPanel;

};

settingsMenu.getOtherContent = function() {

  var otherPanel = document.createElement('div');

  var localDiv = document.createElement('div');
  otherPanel.appendChild(localDiv);

  var localCheckBox = document.createElement('input');
  localCheckBox.type = 'checkbox';
  localDiv.appendChild(localCheckBox);
  localCheckBox.checked = JSON.parse(localStorage.localTime || 'false');

  var localLabel = document.createElement('label');
  localLabel.className = 'small';
  localLabel.innerHTML = 'Local Times';
  localDiv.appendChild(localLabel);

  var relativeDiv = document.createElement('div');
  otherPanel.appendChild(relativeDiv);

  var relativeCheckBox = document.createElement('input');
  relativeCheckBox.type = 'checkbox';
  relativeDiv.appendChild(relativeCheckBox);
  relativeCheckBox.checked = JSON.parse(localStorage.relativeTime || 'false');

  var relativeLabel = document.createElement('label');
  relativeLabel.className = 'small';
  relativeLabel.innerHTML = 'Relative Times';
  relativeDiv.appendChild(relativeLabel);

  var noAutoLoopiv = document.createElement('div');
  otherPanel.appendChild(noAutoLoopiv);

  var noAutoLoopCheckBox = document.createElement('input');
  noAutoLoopCheckBox.type = 'checkbox';
  noAutoLoopiv.appendChild(noAutoLoopCheckBox);
  noAutoLoopCheckBox.checked = JSON.parse(localStorage.noAutoLoop || 'false');

  var noAutoLoopLabel = document.createElement('label');
  noAutoLoopLabel.className = 'small';
  noAutoLoopLabel.innerHTML = 'No Autoloop';
  noAutoLoopiv.appendChild(noAutoLoopLabel);

  var saveButton = document.createElement('button');
  otherPanel.appendChild(saveButton);
  saveButton.innerHTML = 'Save';

  saveButton.onclick = function() {
    localStorage.setItem('localTime', localCheckBox.checked);
    localStorage.setItem('relativeTime', relativeCheckBox.checked);
    localStorage.setItem('noAutoLoop', noAutoLoopCheckBox.checked);
  }

  return otherPanel;

};

settingsMenu.getJSContent = function() {

  var savedJS = localStorage.customJS;

  if (savedJS) {
    var head = document.getElementsByTagName('head')[0];

    var newJS = document.createElement('script');

    head.appendChild(newJS);
    newJS.innerHTML = savedJS;
  }

  var jsPanel = document.createElement('div');

  var jsArea = document.createElement('textarea');
  jsPanel.appendChild(jsArea);
  if (savedJS) {
    jsArea.value = savedJS;
  }
  jsArea.id = 'jsInput';

  var bottomDiv = document.createElement('div');
  jsPanel.appendChild(bottomDiv);

  var saveButton = document.createElement('button');
  saveButton.innerHTML = 'Save';
  bottomDiv.appendChild(saveButton);

  saveButton.onclick = function() {
    localStorage.customJS = jsArea.value.trim();
  };

  return jsPanel;

};

settingsMenu.init();


code:
var sideCatalog = {};

sideCatalog.init = function() {

  sideCatalog.sideCatalogBody = document.getElementById('sideCatalogBody');

  sideCatalog.sideCatalogDiv = document.getElementById('sideCatalogDiv');

  if (!localStorage.hideSideCatalog) {
    sideCatalog.sideCatalogDiv.style.display = 'block';
  }

  sideCatalog.refreshSideCatalog();

  document.getElementById('closeSideCatalogButton').onclick = function() {
    sideCatalog.sideCatalogDiv.style.display = 'none';
    localStorage.setItem('hideSideCatalog', true);
  }

  var catalogButton = document.getElementById('navCatalog');

  var sideCatalogButton = document.createElement('a');
  sideCatalogButton.className = 'coloredIcon';
  sideCatalogButton.id = 'navSideCatalog';
  sideCatalogButton.onclick = function() {
    sideCatalog.sideCatalogDiv.style.display = 'block';
    localStorage.removeItem('hideSideCatalog');
  };

  catalogButton.parentNode.insertBefore(sideCatalogButton,
      catalogButton.nextSibling);

  catalogButton.parentNode.insertBefore(document.createTextNode(' '),
      catalogButton.nextSibling);

  var divider = document.createElement('span');
  divider.innerHTML = '/';
  catalogButton.parentNode.insertBefore(divider, catalogButton.nextSibling);

  catalogButton.parentNode.insertBefore(document.createTextNode(' '),
      catalogButton.nextSibling);

};

sideCatalog.removeAllFromClass = function(className) {

  var elements = document.getElementsByClassName(className);

  while (elements.length) {
    elements[0].remove();
  }

};

sideCatalog.handleReceivedData = function(data, cell, threadData) {

  sideCatalog.loadingThread = false;

  if (thread.autoRefresh) {
    thread.currentRefresh = 5;
  }

  sideCatalog.transitionThread(cell, threadData, data);

  tooltips.cacheData(data);

};

sideCatalog.loadThread = function(cell, threadData) {

  sideCatalog.loadingThread = true;

  if (api.mod) {

    api.formApiRequest('mod', {}, function(status, data) {

      if (status !== 'ok') {
        return;
      }

      sideCatalog.handleReceivedData(data, cell, threadData);

    }, false, {
      boardUri : api.boardUri,
      threadId : threadData.threadId
    });

  } else {

    api.localRequest('/' + api.boardUri + '/res/' + threadData.threadId
        + '.json', function(error, data) {

      if (error) {
        alert(error);
      }

      sideCatalog.handleReceivedData(JSON.parse(data), cell, threadData);

    });
  }

};

sideCatalog.getRangePanel = function() {

  var rangePanel = document.createElement('span');
  rangePanel.className = 'panelRange';
  rangePanel.innerHTML = 'Broad range(1/2 octets): '

  var broadRangeLabel = document.createElement('span');
  broadRangeLabel.className = 'labelBroadRange';

  rangePanel.appendChild(broadRangeLabel);

  rangePanel.appendChild(document.createElement('br'));

  rangePanel.appendChild(document.createTextNode('Narrow range(3/4 octets):'));

  var narrowRangeLabel = document.createElement('span');
  narrowRangeLabel.className = 'labelNarrowRange';

  rangePanel.appendChild(narrowRangeLabel);

  rangePanel.appendChild(document.createElement('br'));

  return rangePanel;

};

sideCatalog.createHistoryLinks = function(cell) {

  var referenceElement = cell.getElementsByClassName('panelBacklinks')[0];

  var historyLink = document.createElement('a');
  historyLink.innerHTML = '[History]';
  historyLink.className = 'linkHistory';

  var fileHistoryLink = document.createElement('a');
  fileHistoryLink.innerHTML = ' [File history]';
  fileHistoryLink.className = 'linkFileHistory';

  referenceElement.parentNode.insertBefore(historyLink, referenceElement);
  referenceElement.parentNode.insertBefore(document.createTextNode(' '),
      referenceElement);
  referenceElement.parentNode.insertBefore(fileHistoryLink, referenceElement);
  referenceElement.parentNode.insertBefore(document.createTextNode(' '),
      referenceElement);

};

sideCatalog.transitionThread = function(cell, threadData, data) {

  if (sideCatalog.selectedThreadCell) {
    sideCatalog.selectedThreadCell.className = 'sideCatalogCell';
  }

  sideCatalog.selectedThreadCell = cell;

  sideCatalog.selectedThreadCell.className = 'sideCatalogMarkedCell';

  tooltips.knownPosts = {};
  window.history.pushState('', '',
      document.getElementById('divMod') ? '/mod.js?boardUri=' + api.boardUri
          + '&threadId=' + threadData.threadId : '/' + api.boardUri + '/res/'
          + threadData.threadId + '.html');

  document.getElementById('threadIdentifier').value = threadData.threadId;

  if (document.getElementById('divMod')) {

    document.getElementById('controlThreadIdentifier').value = threadData.threadId;

    if (postingMenu.globalRole <= 3) {
      document.getElementById('transferThreadIdentifier').value = threadData.threadId;
    }

    document.getElementById('checkboxLock').checked = threadData.locked;
    document.getElementById('checkboxPin').checked = threadData.pinned;
    document.getElementById('checkboxCyclic').checked = threadData.cyclic;

  }

  document.title = '/' + api.boardUri + '/ - '
      + (threadData.subject || threadData.message);

  var opCell = document.getElementsByClassName('opCell')[0];

  opCell.scrollIntoView();

  document.getElementsByClassName('divPosts')[0].innerHTML = '';

  opCell.id = threadData.threadId;
  opCell.className = 'opCell';

  if (!opCell.getElementsByClassName('labelSubject').length) {

    var newSubjectLabel = document.createElement('span');
    newSubjectLabel.className = 'labelSubject';

    var watchButton = document.getElementsByClassName('watchButton')[0];
    watchButton.parentNode.insertBefore(newSubjectLabel,
        watchButton.nextSibling);
    watchButton.parentNode.insertBefore(document.createTextNode(' '),
        watchButton.nextSibling);

  }

  var divMessage = document.getElementsByClassName('divMessage')[0];

  if (!opCell.getElementsByClassName('labelLastEdit').length) {

    var newBanMessageLabel = document.createElement('div');
    newBanMessageLabel.className = 'labelLastEdit';

    divMessage.parentNode.insertBefore(newBanMessageLabel,
        divMessage.nextSibling);

  }

  if (!opCell.getElementsByClassName('linkHistory')[0]) {
    sideCatalog.createHistoryLinks(opCell);
  }

  var panelIp = opCell.getElementsByClassName('panelIp')[0];

  if (!panelIp) {

    var emptyPanel = document.getElementsByClassName('opHead')[0].nextSibling.nextSibling;

    panelIp = document.createElement('span');
    panelIp.className = 'panelIp';

    panelIp.appendChild(sideCatalog.getRangePanel());

    panelIp.appendChild(document.createTextNode('Ip:'));

    var newIpLabel = document.createElement('span');
    newIpLabel.className = 'labelIp';
    panelIp.appendChild(newIpLabel);

    emptyPanel.appendChild(panelIp);

  } else if (!opCell.getElementsByClassName('panelRange').length) {
    panelIp.insertBefore(sideCatalog.getRangePanel(), panelIp.childNodes[0]);
  }

  var panelASN = opCell.getElementsByClassName('panelASN')[0];

  if (!panelASN) {

    panelASN = document.createElement('div');
    panelASN.className = 'panelASN';

    var labelASN = document.createElement('span');
    labelASN.className = 'labelASN';

    panelASN.appendChild(document.createTextNode('ASN: '));
    panelASN.appendChild(labelASN);

    panelIp.parentNode.insertBefore(panelASN, panelIp);

  }

  if (!opCell.getElementsByClassName('imgFlag').length) {

    var newFlagImage = document.createElement('img');
    newFlagImage.className = 'imgFlag';

    var linkName = document.getElementsByClassName('linkName')[0];
    linkName.parentNode.insertBefore(newFlagImage, linkName.nextSibling);
    linkName.parentNode.insertBefore(document.createTextNode(' '),
        linkName.nextSibling);

  }

  if (!opCell.getElementsByClassName('labelRole').length) {

    var newLabelRole = document.createElement('span');
    newLabelRole.className = 'labelRole';

    var flagImage = document.getElementsByClassName('imgFlag')[0];
    flagImage.parentNode.insertBefore(newLabelRole, flagImage.nextSibling);
    flagImage.parentNode.insertBefore(document.createTextNode(' '),
        flagImage.nextSibling);

  }

  if (!opCell.getElementsByClassName('divBanMessage').length) {

    var newBanMessageLabel = document.createElement('div');
    newBanMessageLabel.className = 'divBanMessage';

    divMessage.parentNode.insertBefore(newBanMessageLabel,
        divMessage.nextSibling);

  }

  if (!opCell.getElementsByClassName('spanId').length) {

    var newSpanId = document.createElement('span');
    newSpanId.className = 'spanId';

    newSpanId.innerHTML = 'Id:';

    var newLabelId = document.createElement('span');
    newLabelId.className = 'labelId';
    newSpanId.appendChild(newLabelId);

    var labelCreated = document.getElementsByClassName('labelCreated')[0];
    labelCreated.parentNode.insertBefore(newSpanId, labelCreated.nextSibling);
    labelCreated.parentNode.insertBefore(document.createTextNode(' '),
        labelCreated.nextSibling);

  }

  if (!opCell.getElementsByClassName('opUploadPanel').length) {

    var newOpUploadPanel = document.createElement('div');
    newOpUploadPanel.className = 'panelUploads opUploadPanel';

    var innerOP = opCell.getElementsByClassName('innerOP')[0];
    innerOP.insertBefore(newOpUploadPanel, innerOP.children[0]);

  }

  document.getElementsByClassName('opUploadPanel')[0].innerHTML = '';

  document.getElementsByClassName('opHead')[0]
      .getElementsByClassName('deletionCheckBox')[0].value = api.boardUri + '-'
      + threadData.threadId;

  sideCatalog.removeAllFromClass('extraMenuButton');
  sideCatalog.removeAllFromClass('hideMenu');
  sideCatalog.removeAllFromClass('quoteTooltip');
  sideCatalog.removeAllFromClass('extraMenu');
  sideCatalog.removeAllFromClass('hideButton');
  sideCatalog.removeAllFromClass('watchButton');
  sideCatalog.removeAllFromClass('relativeTime');
  sideCatalog.removeAllFromClass('unhideButton');

  api.resetIndicators(data);

  document.getElementsByClassName('panelBacklinks')[0].innerHTML = '';

  thread.fullRefresh = true;

  thread.initThread();

  gallery.galleryFiles = [];
  gallery.currentIndex = 0;

  posting.setPostInnerElements(api.boardUri, api.threadId, data, opCell);

  watcher.processOP(document.getElementsByClassName('innerOP')[0]);

  if (data.posts && data.posts.length) {

    thread.lastReplyId = data.posts[data.posts.length - 1].postId;

    for (var i = 0; i < data.posts.length; i++) {
      thread.divPosts.appendChild(posting.addPost(data.posts[i], api.boardUri,
          api.threadId));
    }

  }

  hiding.checkFilters();

};

sideCatalog.addSideCatalogThread = function(thread) {

  var cell = document.createElement('a');

  cell.onclick = function() {

    if (sideCatalog.loadingThread || thread.threadId === api.threadId
        || sideCatalog.waitingForRefreshData) {
      return;
    } else if (thread.refreshingThread) {
      sideCatalog.waitingForRefreshData = {
        cell : cell,
        thread : thread
      };

      return;
    }

    sideCatalog.loadThread(cell, thread);

  };

  if (thread.thumb) {

    var img = document.createElement('img');

    img.src = thread.thumb;

    cell.appendChild(img);
  }

  var linkContent = document.createElement('span');
  linkContent.className = 'sideCatalogCellText';
  cell.appendChild(linkContent);

  var upperText = document.createElement('span');
  var lowerText = document.createElement('span');

  linkContent.appendChild(upperText);
  linkContent.appendChild(lowerText);

  upperText.innerHTML = (thread.subject || (thread.message.replace(/[<>'"]/g,
      function(match) {
        return api.htmlReplaceTable[match];
      }).substring(0, 128) || thread.threadId));

  lowerText.innerHTML = 'R: ' + (thread.postCount || 0) + ' / F: '
      + (thread.fileCount || 0);

  sideCatalog.sideCatalogBody.appendChild(cell);

  if (api.threadId === thread.threadId) {
    cell.className = 'sideCatalogMarkedCell';
    cell.scrollIntoView();
    sideCatalog.selectedThreadCell = cell;
  } else {
    cell.className = 'sideCatalogCell';
  }

};

sideCatalog.processCatalogData = function(data) {

  sideCatalog.sideCatalogBody.innerHTML = '';

  var boardData = hiding.storedHidingData[api.boardUri];

  for (var i = 0; i < data.length; i++) {

    var thread = data[i];

    if ((boardData && boardData.threads.indexOf(thread.threadId.toString()) > -1)) {
      continue;
    }

    sideCatalog.addSideCatalogThread(thread);
  }

};

sideCatalog.refreshSideCatalog = function() {

  if (sideCatalog.refreshingSideCatalog) {
    return;
  }

  sideCatalog.refreshingSideCatalog = true;

  api.localRequest('/' + api.boardUri + '/catalog.json', function(error, data) {

    sideCatalog.refreshingSideCatalog = false;

    if (error) {
      return;
    }

    sideCatalog.processCatalogData(JSON.parse(data));

  });

};

if (!api.mobile) {
  sideCatalog.init();
}


code:
var socketControl = {};

socketControl.init = function() {
  api.convertButton('restartFormButton', socketControl.restartSocket);
};

socketControl.restartSocket = function() {

  api.formApiRequest('restartSocket', {}, function restarted(status, data) {

    if (status === 'ok') {
      window.location = '/socketControl.js';
    } else {
      alert(status + ': ' + JSON.stringify(data));
    }

  });

};

socketControl.init();


code:
var themeLoader = {};

themeLoader.load = function(init) {

  if (init && !localStorage.selectedTheme) {
    return;
  }

  var body = document.getElementsByTagName('body')[0];

  if (localStorage.selectedTheme) {
    if (themeLoader.customCss && themeLoader.customCss.parentNode) {
      themeLoader.customCss.remove();
    }
    body.className = 'theme_' + localStorage.selectedTheme;
  } else {
    if (themeLoader.customCss && !themeLoader.customCss.parentNode) {
      document.head.appendChild(themeLoader.customCss);
    }
    body.removeAttribute('class');
  }

};

var linkedCss = document.getElementsByTagName('link');

for (var i = 0; i < linkedCss.length; i++) {

  var ending = '/custom.css';

  if (linkedCss[i].href.indexOf(ending) === linkedCss[i].href.length
      - ending.length) {
    themeLoader.customCss = linkedCss[i];
    break;
  }
}

themeLoader.load(true);


code:
var themes = {};

themes.init = function() {

  themes.themes = [ {
    label : 'Clear',
    id : 'clear'
  } ];

  var postingLink = document.getElementById('navPosting');

  if (postingLink) {

    var referenceNode = postingLink.nextSibling;

    postingLink.parentNode.insertBefore(document.createTextNode(' '),
        referenceNode);

    var divider = document.createElement('span');
    divider.innerHTML = '/';
    postingLink.parentNode.insertBefore(divider, referenceNode);

    postingLink.parentNode.insertBefore(document.createTextNode(' '),
        referenceNode);

    var themeSelector = document.createElement('select');
    themeSelector.id = 'themeSelector';

    var vanillaOption = document.createElement('option');
    vanillaOption.innerHTML = 'Default';
    themeSelector.appendChild(vanillaOption);

    for (var i = 0; i < themes.themes.length; i++) {

      var theme = themes.themes[i];

      var themeOption = document.createElement('option');
      themeOption.innerHTML = theme.label;

      if (theme.id === localStorage.selectedTheme) {
        themeOption.selected = true;
      }

      themeSelector.appendChild(themeOption);

    }

    themeSelector.onchange = function() {

      if (!themeSelector.selectedIndex) {

        if (localStorage.selectedTheme) {
          delete localStorage.selectedTheme;
          themeLoader.load();
        }

        return;
      }

      var selectedTheme = themes.themes[themeSelector.selectedIndex - 1];

      if (selectedTheme.id === localStorage.selectedTheme) {
        return;
      }

      localStorage.selectedTheme = selectedTheme.id;

      themeLoader.load();

    };

    postingLink.parentNode.insertBefore(themeSelector, referenceNode);

  }

};

themes.init();


code:
var thread = {};

thread.init = function() {

  api.mod = !!document.getElementById('divMod');

  api.hiddenCaptcha = !document.getElementById('captchaDiv');

  document.getElementById('mainPanel').onscroll = function() {

    if (!thread.unreadPosts) {
      return;
    }

    var rect = thread.lastPost.getBoundingClientRect();

    if (rect.bottom < window.innerHeight) {
      thread.unreadPosts = 0;

      document.title = thread.originalTitle;
    }

  };

  api.boardUri = document.getElementById('boardIdentifier').value;
  thread.divPosts = document.getElementsByClassName('divPosts')[0];

  thread.initThread();

  document.getElementsByClassName('divRefresh')[0].style.display = 'block';

  thread.messageLimit = +document.getElementById('labelMessageLength').innerHTML;
  thread.refreshLabel = document.getElementById('labelRefresh');

  thread.refreshButton = document.getElementById('refreshButton');

  if (document.getElementById('divArchive')) {
    api.convertButton('archiveFormButon', thread.archiveThread, 'archiveField');
  }

  if (document.getElementById('controlThreadIdentifier')) {

    api.convertButton('settingsFormButon', thread.saveThreadSettings,
        'threadSettingsField');

    if (document.getElementById('ipDeletionForm')) {
      api.convertButton('deleteFromIpFormButton', thread.deleteFromIp,
          'ipDeletionField');
    }

    if (document.getElementById('formTransfer')) {
      api.convertButton('transferFormButton', thread.transfer, 'transferField');
    }

    api.convertButton('inputBan', posting.banPosts, 'banField');
    api.convertButton('inputIpDelete', posting.deleteFromIpOnBoard);
    api.convertButton('inputSpoil', posting.spoilFiles);

  }

  thread.replyButton = document.getElementById('formButton');
  thread.replyButton.disabled = false;

  api.convertButton(thread.replyButton, thread.postReply);

  var replies = document.getElementsByClassName('postCell');

  if (replies && replies.length) {
    thread.lastReplyId = replies[replies.length - 1].id;
  }

  thread.changeRefresh();

  var postingQuotes = document.getElementsByClassName('linkQuote');

  for (var i = 0; i < postingQuotes.length; i++) {
    thread.processPostingQuote(postingQuotes[i]);
  }

};

thread.initThread = function() {

  thread.lastReplyId = 0;
  thread.originalTitle = document.title;
  posting.highLightedIds = [];
  posting.idsRelation = {};

  var ids = document.getElementsByClassName('labelId');

  for (i = 0; i < ids.length; i++) {
    posting.processIdLabel(ids[i]);
  }

  thread.unreadPosts = 0;
  api.threadId = +document.getElementsByClassName('opCell')[0].id;
  thread.refreshURL = '/' + api.boardUri + '/res/' + api.threadId + '.json';
  thread.refreshParameters = {
    boardUri : api.boardUri,
    threadId : api.threadId
  };

};

thread.transfer = function() {

  var informedBoard = document.getElementById("fieldDestinationBoard").value
      .trim();

  var originThread = document.getElementById("transferThreadIdentifier").value;
  var originBoard = document.getElementById("transferBoardIdentifier").value;

  api.formApiRequest('transferThread', {
    boardUri : api.boardUri,
    threadId : api.threadId,
    boardUriDestination : informedBoard
  },
      function setLock(status, data) {

        if (status === 'ok') {
          window.location.pathname = '/' + informedBoard + '/res/' + data
              + '.html';
        } else {
          alert(status + ': ' + JSON.stringify(data));
        }
      });

};

thread.markPost = function(id) {

  if (isNaN(id)) {
    return;
  }

  if (thread.markedPosting && thread.markedPosting.className === 'markedPost') {
    thread.markedPosting.className = 'innerPost';
  }

  var container = document.getElementById(id);

  if (!container || container.className !== 'postCell') {
    return;
  }

  thread.markedPosting = container.getElementsByClassName('innerPost')[0];

  if (thread.markedPosting) {
    thread.markedPosting.className = 'markedPost';
  }

};

thread.processPostingQuote = function(link) {

  link.onclick = function() {
    qr.showQr(link.href.match(/#q(\d+)/)[1]);
  };

};

thread.archiveThread = function() {

  if (!document.getElementById('checkboxArchive').checked) {
    alert('You must confirm that you wish to archive this thread.');
    return;
  }

  api.formApiRequest('archiveThread', {
    confirmation : true,
    boardUri : api.boardUri,
    threadId : api.threadId
  }, function archived(status, data) {

    if (status === 'ok') {

      api.resetIndicators({
        locked : document.getElementsByClassName('lockIndicator').length,
        pinned : document.getElementsByClassName('pinIndicator').length,
        cyclic : document.getElementsByClassName('cyclicIndicator').length,
        archived : true
      });

    } else {
      alert(status + ': ' + JSON.stringify(data));
    }

  });

};

thread.saveThreadSettings = function() {

  var pinned = document.getElementById('checkboxPin').checked;
  var locked = document.getElementById('checkboxLock').checked;
  var cyclic = document.getElementById('checkboxCyclic').checked;

  api.formApiRequest('changeThreadSettings', {
    boardUri : api.boardUri,
    threadId : api.threadId,
    pin : pinned,
    lock : locked,
    cyclic : cyclic
  }, function setLock(status, data) {

    if (status === 'ok') {

      api.resetIndicators({
        locked : locked,
        pinned : pinned,
        cyclic : cyclic,
        archived : document.getElementsByClassName('archiveIndicator').length
      });

    } else {
      alert(status + ': ' + JSON.stringify(data));
    }
  });

};

thread.replyCallback = function(status, data) {

  if (status === 'ok') {

    postCommon.storeUsedPostingPassword(api.boardUri, api.threadId, data);

    document.getElementById('fieldMessage').value = '';
    document.getElementById('fieldSubject').value = '';
    qr.clearQRAfterPosting();
    postCommon.clearSelectedFiles();

    thread.refreshPosts(true);

  } else {
    alert(status + ': ' + JSON.stringify(data));
  }

};

thread.replyCallback.stop = function() {

  thread.replyButton.innerHTML = thread.originalButtonText;

  qr.setQRReplyText(thread.originalButtonText);

  thread.replyButton.disabled = false;
  qr.setQRReplyEnabled(true);

};

thread.replyCallback.progress = function(info) {

  if (info.lengthComputable) {
    var newText = 'Uploading ' + Math.floor((info.loaded / info.total) * 100)
        + '%';
    thread.replyButton.innerHTML = newText;

    qr.setQRReplyText(newText);
  }

};

thread.refreshCallback = function(error, receivedData) {

  if ((api.mod && (error !== 'ok')) || (!api.mod && error)) {
    return;
  }

  if (!api.mod) {
    receivedData = JSON.parse(receivedData);
  }

  if (receivedData.threadId !== api.threadId) {

    window.location.href = '/' + receivedData.boardUri + '/res/'
        + receivedData.threadId + '.html';

    return;
  }

  if (thread.fullRefresh) {
    thread.lastReplyId = 0;
    thread.unreadPosts = 0;
    while (thread.divPosts.firstChild) {
      thread.divPosts.removeChild(thread.divPosts.firstChild);
    }

    document.title = thread.originalTitle;

  }

  tooltips.cacheData(receivedData);

  var posts = receivedData.posts;

  var foundPosts = false;

  if (posts && posts.length) {
    var lastReceivedPost = posts[posts.length - 1];

    if (lastReceivedPost.postId > thread.lastReplyId) {
      foundPosts = true;

      for (var i = 0; i < posts.length; i++) {

        var post = posts[i];

        if (post.postId > thread.lastReplyId) {
          thread.unreadPosts++;

          var postCell = posting.addPost(post, api.boardUri, api.threadId);

          thread.divPosts.appendChild(postCell);

          thread.lastPost = postCell;

          thread.lastReplyId = post.postId;
        }

      }

      if (!thread.fullRefresh) {
        document.title = '(' + thread.unreadPosts + ') ' + thread.originalTitle;
      }

    }
  }

  if (thread.autoRefresh) {
    thread.startTimer(thread.manualRefresh || foundPosts ? 5
        : thread.lastRefresh * 2);
  }

};

thread.refreshCallback.stop = function() {

  thread.refreshButton.disabled = false;

  thread.refreshingThread = false;

  if (sideCatalog.waitingForRefreshData) {
    sideCatalog.loadThread(sideCatalog.waitingForRefreshData.cell,
        sideCatalog.waitingForRefreshData.thread);
    delete sideCatalog.waitingForRefreshData;
  }

};

thread.refreshPosts = function(manual, full) {

  if (manual && sideCatalog.loadingThread) {
    return;
  }

  thread.manualRefresh = manual;
  thread.fullRefresh = full;

  if (thread.autoRefresh && manual) {
    clearInterval(thread.refreshTimer);
  }

  thread.refreshButton.disabled = true;

  thread.refreshingThread = true;

  if (api.mod) {
    api.formApiRequest('mod', {}, thread.refreshCallback, true,
        thread.refreshParameters);
  } else {
    api.localRequest(thread.refreshURL, thread.refreshCallback);
  }

};

thread.sendReplyData = function(files, captchaId) {

  var forcedAnon = !document.getElementById('fieldName');
  var hiddenFlags = !document.getElementById('flagsDiv');

  if (!hiddenFlags) {
    var combo = document.getElementById('flagCombobox');

    var selectedFlag = combo.options[combo.selectedIndex].value;

    postCommon.savedSelectedFlag(selectedFlag);

  }

  if (!forcedAnon) {
    var typedName = document.getElementById('fieldName').value.trim();
    localStorage.setItem('name', typedName);
  }

  var typedEmail = document.getElementById('fieldEmail').value.trim();
  var typedMessage = document.getElementById('fieldMessage').value.trim();
  var typedSubject = document.getElementById('fieldSubject').value.trim();
  var typedPassword = document.getElementById('fieldPostingPassword').value
      .trim();

  if (!typedMessage.length && !files.length) {
    alert('A message or a file is mandatory.');
    return;
  } else if (!forcedAnon && typedName.length > 32) {
    alert('Name is too long, keep it under 32 characters.');
    return;
  } else if (typedMessage.length > thread.messageLimit) {
    alert('Message is too long, keep it under ' + thread.messageLimit
        + ' characters.');
    return;
  } else if (typedEmail.length > 64) {
    alert('E-mail is too long, keep it under 64 characters.');
    return;
  } else if (typedSubject.length > 128) {
    alert('Subject is too long, keep it under 128 characters.');
    return;
  } else if (typedPassword.length > 8) {
    alert('Password is too long, keep it under 8 characters.');
    return;
  }

  if (!typedPassword) {
    typedPassword = Math.random().toString(36).substring(2, 10);
  }

  localStorage.setItem('deletionPassword', typedPassword);

  var spoilerCheckBox = document.getElementById('checkboxSpoiler');

  var noFlagCheckBox = document.getElementById('checkboxNoFlag');

  thread.originalButtonText = thread.replyButton.innerHTML;
  thread.replyButton.innerHTML = 'Uploading 0%';
  qr.setQRReplyText(thread.replyButton.innerHTML);
  thread.replyButton.disabled = true;
  qr.setQRReplyEnabled(false);

  api.formApiRequest('replyThread', {
    name : forcedAnon ? null : typedName,
    flag : hiddenFlags ? null : selectedFlag,
    captcha : captchaId,
    subject : typedSubject,
    noFlag : noFlagCheckBox ? noFlagCheckBox.checked : false,
    spoiler : spoilerCheckBox ? spoilerCheckBox.checked : false,
    password : typedPassword,
    message : typedMessage,
    email : typedEmail,
    files : files,
    boardUri : api.boardUri,
    threadId : api.threadId
  }, thread.replyCallback);

};

thread.processFilesToPost = function(captchaId) {

  postCommon.newGetFilesToUpload(function gotFiles(files) {
    thread.sendReplyData(files, captchaId);
  });

};

thread.processReplyRequest = function() {

  if (api.hiddenCaptcha) {
    thread.processFilesToPost();
  } else {
    var typedCaptcha = document.getElementById('fieldCaptcha').value.trim();

    if (typedCaptcha.length !== 6 && typedCaptcha.length !== 24) {
      alert('Captchas are exactly 6 (24 if no cookies) characters long.');
      return;
    } else if (/\W/.test(typedCaptcha)) {
      alert('Invalid captcha.');
      return;
    }

    if (typedCaptcha.length == 24) {
      thread.processFilesToPost(typedCaptcha);
    } else {
      var parsedCookies = api.getCookies();

      api.formApiRequest('solveCaptcha', {

        captchaId : parsedCookies.captchaid,
        answer : typedCaptcha
      }, function solvedCaptcha(status, data) {

        if (status !== 'ok') {
          alert(status);
          return;
        }

        thread.processFilesToPost(parsedCookies.captchaid);
      });
    }

  }

};

thread.postReply = function() {

  api.formApiRequest('blockBypass', {},
      function checked(status, data) {

        if (status !== 'ok') {
          alert(data);
          return;
        }

        var alwaysUseBypass = document
            .getElementById('alwaysUseBypassCheckBox').checked;

        if (!data.valid
            && (data.mode == 2 || (data.mode == 1 && alwaysUseBypass))) {

          postCommon.displayBlockBypassPrompt(function() {
            thread.processReplyRequest();
          });

        } else {
          thread.processReplyRequest();
        }

      });

};

thread.startTimer = function(time) {

  if (time > 600) {
    time = 600;
  }

  thread.currentRefresh = time;
  thread.lastRefresh = time;
  thread.refreshLabel.innerHTML = thread.currentRefresh;
  thread.refreshTimer = setInterval(function checkTimer() {

    if (sideCatalog.loadingThread) {
      return;
    }

    thread.currentRefresh--;

    if (!thread.currentRefresh) {
      clearInterval(thread.refreshTimer);
      thread.refreshPosts();
      thread.refreshLabel.innerHTML = '';
    } else {
      thread.refreshLabel.innerHTML = thread.currentRefresh;
    }

  }, 1000);
};

thread.changeRefresh = function() {

  thread.autoRefresh = document.getElementById('checkboxChangeRefresh').checked;

  if (!thread.autoRefresh) {
    thread.refreshLabel.innerHTML = '';
    clearInterval(thread.refreshTimer);
  } else {
    thread.startTimer(5);
  }

};

thread.deleteFromIp = function() {

  var typedIp = document.getElementById('ipField').value.trim();
  var typedBoards = document.getElementById('fieldBoards').value.trim();

  if (!typedIp.length) {
    alert('An ip is mandatory');
    return;
  }

  api.formApiRequest('deleteFromIp', {
    ip : typedIp,
    boards : typedBoards
  }, function requestComplete(status, data) {

    if (status === 'ok') {

      document.getElementById('ipField').value = '';
      document.getElementById('fieldBoards').value = '';

      alert('Postings deleted.');

    } else {
      alert(status + ': ' + JSON.stringify(data));
    }
  });

};

thread.init();


code:
var thumbs = {};

thumbs.init = function() {

  thumbs.playableTypes = [ 'video/webm', 'audio/mpeg', 'video/mp4',
      'video/ogg', 'audio/ogg', 'audio/webm' ];

  thumbs.videoTypes = [ 'video/webm', 'video/mp4', 'video/ogg' ];

  var imageLinks = document.getElementsByClassName('imgLink');

  var temporaryImageLinks = [];

  for (var i = 0; i < imageLinks.length; i++) {
    temporaryImageLinks.push(imageLinks[i]);
  }

  for (i = 0; i < temporaryImageLinks.length; i++) {
    thumbs.processImageLink(temporaryImageLinks[i]);
  }
};

thumbs.expandImage = function(mouseEvent, link, mime) {

  if (mouseEvent.which === 2 || mouseEvent.ctrlKey) {
    return true;
  }

  link.parentNode.classList.toggle('expandedCell');

  var thumb = link.getElementsByTagName('img')[0];

  if (thumb.style.display === 'none') {
    link.getElementsByClassName('imgExpanded')[0].style.display = 'none';
    thumb.style.display = '';

    if (thumb.getBoundingClientRect().top < 0) {
      thumb.scrollIntoView();
    }

    return false;
  }

  var expanded = link.getElementsByClassName('imgExpanded')[0];

  if (expanded) {
    thumb.style.display = 'none';
    expanded.style.display = '';
  } else {
    var expandedSrc = link.href;

    if (thumb.src === expandedSrc && mime !== 'image/svg+xml') {
      return false;
    }

    expanded = document.createElement('img');
    expanded.setAttribute('src', expandedSrc);
    expanded.className = 'imgExpanded';

    thumb.style.display = 'none';
    link.appendChild(expanded);
  }

  return false;

};

thumbs.setPlayer = function(link, mime) {

  var path = link.href;
  var parent = link.parentNode;

  var src = document.createElement('source');
  src.setAttribute('src', link.href);
  src.setAttribute('type', mime);

  var isVideo = thumbs.videoTypes.indexOf(mime) > -1;

  var video = document.createElement(isVideo ? 'video' : 'audio');
  if (isVideo) {
    video.loop = !JSON.parse(localStorage.noAutoLoop || 'false');
  }

  video.setAttribute('controls', true);
  video.style.display = 'none';

  var videoContainer = document.createElement('span');

  var hideLink = document.createElement('a');
  hideLink.innerHTML = '[ - ]';
  hideLink.style.cursor = 'pointer';
  hideLink.style.display = 'none';
  hideLink.className = 'hideLink';
  hideLink.onclick = function() {
    videoContainer.parentNode.classList.toggle('expandedCell');
    newThumbLink.style.display = 'inline';
    video.style.display = 'none';
    hideLink.style.display = 'none';
    video.pause();
  };

  var newThumbLink = document.createElement('a');
  newThumbLink.href = link.href;

  var newThumb = document.createElement('img');
  newThumbLink.appendChild(newThumb);
  newThumb.className = 'imgLink';
  newThumb.src = link.childNodes[0].src;
  newThumbLink.onclick = function(mouseEvent) {

    if (mouseEvent.which === 2 || mouseEvent.ctrlKey) {
      return true;
    }

    videoContainer.parentNode.classList.toggle('expandedCell');

    if (!video.childNodes.count) {
      video.appendChild(src);
    }

    newThumbLink.style.display = 'none';
    video.style.display = 'inline';
    hideLink.style.display = 'inline';
    video.play();

    return false;
  };
  newThumb.style.cursor = 'pointer';

  videoContainer.appendChild(hideLink);
  videoContainer.appendChild(video);
  videoContainer.appendChild(newThumbLink);

  parent.replaceChild(videoContainer, link);

};

thumbs.processImageLink = function(link) {

  var mime = link.dataset.filemime;

  if (mime.indexOf('image/') > -1) {

    link.onclick = function(mouseEvent) {
      return thumbs.expandImage(mouseEvent, link, mime);
    };

  } else if (thumbs.playableTypes.indexOf(mime) > -1) {
    thumbs.setPlayer(link, mime);
  }
};

thumbs.init();


code:
var tooltips = {};

tooltips.init = function() {

  tooltips.bottomMargin = 25;
  tooltips.loadingPreviews = {};
  tooltips.loadedContent = {};
  tooltips.quoteReference = {};
  tooltips.knownPosts = {};
  tooltips.knownData = {};

  var posts = document.getElementsByClassName('postCell');

  for (var i = 0; i < posts.length; i++) {
    tooltips.addToKnownPostsForBackLinks(posts[i])
  }

  var threads = document.getElementsByClassName('opCell');

  for (i = 0; i < threads.length; i++) {
    tooltips.addToKnownPostsForBackLinks(threads[i])
  }

  tooltips.cacheExistingHTML('innerOP');
  tooltips.cacheExistingHTML('innerPost');

  var quotes = document.getElementsByClassName('quoteLink');

  for (i = 0; i < quotes.length; i++) {
    tooltips.processQuote(quotes[i]);
  }

};

tooltips.cacheExistingHTML = function(className) {

  var innerContent = document.getElementsByClassName(className);

  for (var i = 0; i < innerContent.length; i++) {

    var inner = innerContent[i];

    var temp = document.createElement('div');
    temp.className = 'innerPost';
    temp.innerHTML = inner.innerHTML;

    var deletionCheckBox = temp.getElementsByClassName('deletionCheckBox')[0];

    if (deletionCheckBox) {
      deletionCheckBox.remove();
    }

    var quoteLink = temp.getElementsByClassName('linkSelf')[0];
    tooltips.loadedContent[quoteLink.href] = temp.outerHTML;
  }

};

tooltips.addToKnownPostsForBackLinks = function(posting) {

  var postBoard = posting.dataset.boarduri;

  var list = tooltips.knownPosts[postBoard] || {};
  tooltips.knownPosts[postBoard] = list;

  list[posting.id] = {
    added : [],
    container : posting.getElementsByClassName('panelBacklinks')[0]
  };

};

tooltips.addBackLink = function(quoteUrl, quote) {

  var matches = quoteUrl.match(/\/(\w+)\/res\/(\d+)\.html\#(\d+)/);

  var board = matches[1];
  var thread = matches[2];
  var post = matches[3];

  var knownBoard = tooltips.knownPosts[board];

  if (knownBoard) {

    var knownBackLink = knownBoard[post];

    if (knownBackLink) {

      var containerPost = quote.parentNode.parentNode;

      while (!containerPost.classList.contains('postCell')
          && !containerPost.classList.contains('opCell')) {
        containerPost = containerPost.parentNode;
      }

      var sourceBoard = containerPost.dataset.boarduri;
      var sourcePost = containerPost.id;

      var sourceId = sourceBoard + '_' + sourcePost;

      if (knownBackLink.added.indexOf(sourceId) > -1) {
        return;
      } else {
        knownBackLink.added.push(sourceId);
      }

      var innerHTML = '>>';

      if (sourceBoard != board) {
        innerHTML += '/' + containerPost.dataset.boarduri + '/';
      }

      innerHTML += sourcePost;

      var backLink = document.createElement('a');
      backLink.innerHTML = innerHTML;

      var backLinkUrl = '/' + sourceBoard + '/res/' + thread + '.html#'
          + sourcePost;

      backLink.href = backLinkUrl;

      knownBackLink.container.appendChild(backLink);

      knownBackLink.container.appendChild(document.createTextNode(' '));

      tooltips.processQuote(backLink, true);

    }

  }

};

tooltips.checkHeight = function(tooltip) {

  var windowHeight = document.documentElement.clientHeight + window.scrollY;

  if (tooltip.offsetHeight + tooltip.offsetTop + tooltips.bottomMargin > windowHeight) {
    tooltip.style.top = (windowHeight - tooltip.offsetHeight - tooltips.bottomMargin)
        + 'px';
  }

}

tooltips.processQuote = function(quote, backLink) {

  var tooltip;

  var quoteUrl = quote.href;

  if (!backLink) {
    tooltips.addBackLink(quoteUrl, quote);
  }

  quote.onmouseenter = function() {

    tooltip = document.createElement('div');
    tooltip.className = 'quoteTooltip';

    document.body.appendChild(tooltip);

    var rect = quote.getBoundingClientRect();

    var previewOrigin = {
      x : rect.right + 10 + window.scrollX,
      y : rect.top + window.scrollY
    };

    tooltip.style.left = previewOrigin.x + 'px';
    tooltip.style.top = previewOrigin.y + 'px';
    tooltip.style.display = 'inline';

    if (tooltips.loadedContent[quoteUrl]) {
      tooltip.innerHTML = tooltips.loadedContent[quoteUrl];

      tooltips.checkHeight(tooltip);

    } else {
      tooltip.innerHTML = 'Loading';
    }

    if (!tooltips.loadedContent[quoteUrl]
        && !tooltips.loadingPreviews[quoteUrl]) {
      tooltips.loadQuote(tooltip, quoteUrl);
    }

    if (!api.isBoard) {
      var matches = quote.href.match(/\#(\d+)/);

      quote.onclick = function() {
        thread.markPost(matches[1]);
      };
    }

  };

  quote.onmouseout = function() {
    if (tooltip) {
      tooltip.remove();
      tooltip = null;
    }
  };

};

tooltips.generateHTMLFromData = function(postingData, tooltip, quoteUrl) {

  if (!postingData) {
    tooltip.innerHTML = 'Not found';
    return;
  }

  var tempDiv = posting.addPost(postingData, postingData.boardUri,
      postingData.threadId, true).getElementsByClassName('innerPost')[0];

  tempDiv.getElementsByClassName('deletionCheckBox')[0].remove();

  tooltip.innerHTML = tempDiv.outerHTML;

  tooltips.checkHeight(tooltip);

  tooltips.loadedContent[quoteUrl] = tempDiv.outerHTML;

};

tooltips.cacheData = function(threadData) {

  for (var i = 0; i < threadData.posts.length; i++) {
    var postData = threadData.posts[i];
    tooltips.knownData[threadData.boardUri + '/' + postData.postId] = postData;
  }

  tooltips.knownData[threadData.boardUri + '/' + threadData.threadId] = threadData;

};

tooltips.loadQuote = function(tooltip, quoteUrl) {

  var matches = quoteUrl.match(/\/(\w+)\/res\/(\d+)\.html\#(\d+)/);

  var board = matches[1];
  var thread = +matches[2];
  var post = +matches[3];

  var postingData = tooltips.knownData[board + '/' + post];

  if (postingData) {
    tooltips.generateHTMLFromData(postingData, tooltip, quoteUrl);
    return;
  }

  var threadUrl = '/' + board + '/res/' + thread + '.json';

  tooltips.loadingPreviews[quoteUrl] = true;

  api.localRequest(threadUrl, function receivedData(error, data) {

    delete tooltips.loadingPreviews[quoteUrl];

    if (error) {
      tooltip.innerHTML = 'Not found';
      return;
    }

    tooltips.cacheData(JSON.parse(data));

    tooltips.generateHTMLFromData(tooltips.knownData[board + '/' + post],
        tooltip, quoteUrl);

  });

};

tooltips.init();


code:
var watcher = {};

watcher.init = function() {

  watcher.isInThread = document.getElementById('threadIdentifier') ? true
      : false;
  watcher.watcherAlertCounter = 0;
  watcher.elementRelation = {};

  var postingLink = document.getElementById('navPosting');
  var referenceNode = postingLink.nextSibling;

  postingLink.parentNode.insertBefore(document.createTextNode(' '),
      referenceNode);

  var divider = document.createElement('span');
  divider.innerHTML = '/';
  postingLink.parentNode.insertBefore(divider, referenceNode);

  postingLink.parentNode.insertBefore(document.createTextNode(' '),
      referenceNode);

  var watcherButton = document.createElement('a');
  watcherButton.id = 'watcherButton';
  watcherButton.className = 'coloredIcon';

  watcher.watcherCounter = document.createElement('span');

  watcherButton.appendChild(watcher.watcherCounter);

  postingLink.parentNode.insertBefore(watcherButton, referenceNode);

  watcher.watchedMenu = document.createElement('div');

  var watchedMenuLabel = document.createElement('label');
  watchedMenuLabel.innerHTML = 'Watched threads';

  watcher.watchedMenu.appendChild(watchedMenuLabel);

  var showingWatched = false;

  var closeWatcherMenuButton = document.createElement('span');
  closeWatcherMenuButton.id = 'closeWatcherMenuButton';
  closeWatcherMenuButton.className = 'coloredIcon glowOnHover';
  closeWatcherMenuButton.onclick = function() {

    if (!showingWatched) {
      return;
    }

    showingWatched = false;
    watcher.watchedMenu.style.display = 'none';

  };

  watcher.watchedMenu.appendChild(closeWatcherMenuButton);

  watcher.watchedMenu.appendChild(document.createElement('hr'));

  watcher.watchedMenu.id = 'watchedMenu';
  watcher.watchedMenu.className = 'floatingMenu';
  watcher.watchedMenu.style.display = 'none';

  document.body.appendChild(watcher.watchedMenu);

  watcherButton.onclick = function() {

    if (showingWatched) {
      return;
    }

    showingWatched = true;
    watcher.watchedMenu.style.display = 'block';

  }

  var ops = document.getElementsByClassName('innerOP');

  for (var i = 0; i < ops.length; i++) {
    watcher.processOP(ops[i]);
  }

  var storedWatchedData = watcher.getStoredWatchedData();

  for ( var currentBoard in storedWatchedData) {

    if (storedWatchedData.hasOwnProperty(currentBoard)) {

      var threads = storedWatchedData[currentBoard];

      for ( var thread in threads) {
        if (threads.hasOwnProperty(thread)) {

          if (watcher.isInThread && currentBoard == api.boardUri
              && thread == api.threadId) {
            threads[thread].lastSeen = new Date().getTime();
            localStorage.watchedData = JSON.stringify(storedWatchedData);
          }

          watcher.addWatchedCell(currentBoard, thread, threads[thread]);
        }
      }
    }

  }

  watcher.updateWatcherCounter();

  watcher.scheduleWatchedThreadsCheck();

  draggable.setDraggable(watcher.watchedMenu, watchedMenuLabel);

};

watcher.updateWatcherCounter = function() {

  var classList = watcherButton.classList;

  if (watcher.watcherAlertCounter) {
    classList.add('mobileAlert');
  } else {
    classList.remove('mobileAlert');
  }

  watcher.watcherCounter.innerHTML = watcher.watcherAlertCounter ? '('
      + watcher.watcherAlertCounter + ')' : '';
};

watcher.getStoredWatchedData = function() {

  var storedWatchedData = localStorage.watchedData;

  if (storedWatchedData) {
    storedWatchedData = JSON.parse(storedWatchedData);
  } else {
    storedWatchedData = {};
  }

  return storedWatchedData;

};

watcher.processThread = function(urls, index, data) {

  data = JSON.parse(data);
  var url = urls[index];

  var posts = data.posts;

  if (posts && posts.length) {

    var lastPost = posts[posts.length - 1];

    var parsedCreation = new Date(lastPost.creation);

    var storedWatchedData = watcher.getStoredWatchedData();

    var watchData = storedWatchedData[url.board][url.thread];

    if (parsedCreation.getTime() > watchData.lastReplied) {
      watchData.lastReplied = parsedCreation.getTime();
      localStorage.watchedData = JSON.stringify(storedWatchedData);
    }

    if (!watcher.elementRelation[url.board]
        || !watcher.elementRelation[url.board][url.thread]) {
      watcher.addWatchedCell(url.board, url.thread, watchData);
    } else if (watchData.lastSeen >= watchData.lastReplied) {
      watcher.elementRelation[url.board][url.thread].style.display = 'none';
    } else {
      watcher.watcherAlertCounter++;
      watcher.elementRelation[url.board][url.thread].style.display = 'inline';
    }

  }

  watcher.iterateWatchedThreads(urls, ++index);

};

watcher.iterateWatchedThreads = function(urls, index) {

  index = index || 0;

  if (index >= urls.length) {
    watcher.updateWatcherCounter();
    watcher.scheduleWatchedThreadsCheck();
    return;
  }

  var url = urls[index];

  api.localRequest('/' + url.board + '/res/' + url.thread + '.json',
      function gotThreadInfo(error, data) {

        if (error) {
          watcher.iterateWatchedThreads(urls, ++index);
        } else {
          watcher.processThread(urls, index, data);
        }

      });

};

watcher.runWatchedThreadsCheck = function() {

  watcher.watcherAlertCounter = 0;

  localStorage.lastWatchCheck = new Date().getTime();

  var urls = [];

  var storedWatchedData = watcher.getStoredWatchedData();

  for ( var board in storedWatchedData) {

    if (storedWatchedData.hasOwnProperty(board)) {

      var threads = storedWatchedData[board];

      for ( var thread in threads) {
        if (threads.hasOwnProperty(thread)) {

          if (watcher.isInThread && board == api.boardUri
              && thread == api.threadId) {
            threads[thread].lastSeen = new Date().getTime();
            localStorage.watchedData = JSON.stringify(storedWatchedData);
          }

          urls.push({
            board : board,
            thread : thread
          });
        }
      }
    }

  }

  watcher.iterateWatchedThreads(urls);

};

watcher.scheduleWatchedThreadsCheck = function() {

  var lastCheck = localStorage.lastWatchCheck;

  if (!lastCheck) {
    watcher.runWatchedThreadsCheck();
    return;
  }

  lastCheck = new Date(+lastCheck);

  // lastCheck.setUTCMinutes(lastCheck.getUTCMinutes() + 5);
  lastCheck.setUTCSeconds(lastCheck.getUTCSeconds() + 10);

  setTimeout(function() {
    watcher.runWatchedThreadsCheck();
  }, lastCheck.getTime() - new Date().getTime());

}

watcher.addWatchedCell = function(board, thread, watchData) {

  var cellWrapper = document.createElement('div');

  var cell = document.createElement('div');
  cell.className = 'watchedCell';

  var labelWrapper = document.createElement('label');
  labelWrapper.className = 'watchedCellLabel';

  var label = document.createElement('a');

  label.innerHTML = watchData.label || (board + '/' + thread);
  label.href = '/' + board + '/res/' + thread + '.html';
  labelWrapper.appendChild(label);

  var notification = document.createElement('span');
  notification.className = 'watchedNotification';

  if (!watcher.elementRelation[board]) {
    watcher.elementRelation[board] = {};
  }

  watcher.elementRelation[board][thread] = notification;

  if (watchData.lastSeen >= watchData.lastReplied) {
    notification.style.display = 'none';
  } else {
    watcher.watcherAlertCounter++;
  }

  labelWrapper.appendChild(notification);

  cell.appendChild(labelWrapper);

  var button = document.createElement('span');
  button.className = 'watchedCellCloseButton glowOnHover coloredIcon';
  cell.appendChild(button);

  button.onclick = function() {

    watcher.watchedMenu.removeChild(cellWrapper);

    var storedWatchedData = watcher.getStoredWatchedData();

    var boardThreads = storedWatchedData[board];

    if (!boardThreads || !boardThreads[thread]) {
      return;
    }

    delete boardThreads[thread];

    localStorage.watchedData = JSON.stringify(storedWatchedData);

  }

  cellWrapper.appendChild(cell);
  cellWrapper.appendChild(document.createElement('hr'));
  watcher.watchedMenu.appendChild(cellWrapper);

};

watcher.processOP = function(op) {

  var checkBox = op.getElementsByClassName('deletionCheckBox')[0];

  var nameParts = checkBox.name.split('-');

  var board = nameParts[0];
  var thread = nameParts[1];

  var watchButton = document.createElement('span');
  watchButton.className = 'watchButton glowOnHover coloredIcon';
  watchButton.title = "Watch Thread";

  checkBox.parentNode.insertBefore(watchButton,
      checkBox.nextSibling.nextSibling.nextSibling);

  watchButton.onclick = function() {

    var storedWatchedData = watcher.getStoredWatchedData();

    var boardThreads = storedWatchedData[board] || {};

    if (boardThreads[thread]) {
      return;
    }

    var subject = op.getElementsByClassName('labelSubject');
    var message = op.getElementsByClassName('divMessage')[0];

    var label = (subject.length ? subject[0].innerHTML : null)
        || message.innerHTML.replace(/(<([^>]+)>)/ig, "").substr(0, 16).trim();

    if (!label.length) {
      label = null;
    } else {
      label = label.replace(/[<>"']/g, function(match) {
        return api.htmlReplaceTable[match]
      });
    }

    boardThreads[thread] = {
      lastSeen : new Date().getTime(),
      lastReplied : new Date().getTime(),
      label : label
    };

    storedWatchedData[board] = boardThreads;

    localStorage.watchedData = JSON.stringify(storedWatchedData);

    watcher.addWatchedCell(board, thread, boardThreads[thread]);

  };

};

watcher.init();


code:
<!DOCTYPE html>

<title>About</title>
<meta charset="UTF-8" />
<meta
  name="viewport"
  content="width=device-width, initial-scale=1.0">
<link
  href="/.static/css/global.css"
  type="text/css"
  rel="stylesheet" />

    <fieldset id="settingsFieldset">
      <legend>About</legend>

Title goes here

Text goes here.

    </fieldset>


code:
<!DOCTYPE html>

<title>Contact</title>
<meta charset="UTF-8" />
<meta
  name="viewport"
  content="width=device-width, initial-scale=1.0">
<link
  href="/.static/css/global.css"
  type="text/css"
  rel="stylesheet" />

    <fieldset id="settingsFieldset">
      <legend>Contact</legend>

Your contact

    </fieldset>


code:
<!DOCTYPE html>

<title>Global Rules</title>
<meta charset="UTF-8">
<meta
  name="viewport"
  content="width=device-width, initial-scale=1.0">
<link
  rel="stylesheet"
  type="text/css"
  href="/.static/css/global.css">

    <fieldset id="settingsFieldset">
      <legend>Global Rules</legend>

Title goes here

Insert rules here.

    </fieldset>


code:
<!DOCTYPE html>

<title>Links</title>
<meta charset="UTF-8" />
<meta
  name="viewport"
  content="width=device-width, initial-scale=1.0">
<link
  href="/.static/css/global.css"
  type="text/css"
  rel="stylesheet" />

    <fieldset id="settingsFieldset">
      <legend>Links</legend>

Here are some links to other sites that you may
        enjoy.

Penumbra
            Lynx, the repository for this front-end.

LynxChan, the
          repository for LynxChan.

    </fieldset>