8472 / TSR Edit thread

// ==UserScript==
// @name         TSR  Edit thread
// @namespace    TSR  Edit thread
// @description  Adds buttons to the top of pages to edit thread/opening posts
// @include      https://www.thestudentroom.co.uk/showthread*
// @version      0.0.1
// @author       8472
// @run-at       document-start
// @updateURL    https://openuserjs.org/install/8472/TSR_Edit_thread.user.js
// @license       MIT
// ==/UserScript==

window.onload = function (EditThread) {

  //id="pos
  var PostID = "0"
  var sanity = document.getElementById("postsContent").innerHTML
  var flag = sanity.search("post-content")

  if (flag > "0") {
    PostID = (document.getElementById("postsContainer").innerHTML.substring(68, 76));
  }
  else {
    PostID = "0";
  }
  var editpost = " <a href='https://www.thestudentroom.co.uk/editpost.php?p=" + PostID + "'" + "> <span itemprop='name'>Edit Opening Post</span></a> <meta itemprop='position' > </li>"
  var extracom = " <a href='https://www.thestudentroom.co.uk/postings.php?do=editthread&t=" + THREAD_ID + "'" + "> <span itemprop='name'>Edit Thread (For fixing titles)</span></a> <meta itemprop='position' > </li>" + "<p></p>" + editpost + "<p></p>"

  var breadcrumb = document.getElementById("breadcrumb").outerHTML + extracom
  document.getElementById("breadcrumb").outerHTML = breadcrumb

}