Welcome to mirror list, hosted at ThFree Co, Russian Federation.

single-text-align.js « js « static - github.com/djuelg/Shapez-Theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bdcc15ed3d94aa70e07ca0c411ca24d3f6dec88b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Wait for the page to load first
window.onload = function() {

  //Get a reference to the link on the page
  var aLeft = document.getElementById("alignLeft");
  var aJustify = document.getElementById("alignJustify");

  //Set code to run when the link is clicked
  aJustify.onclick = function() {
  	if (document.getElementById("article-body").className.match(/(?:^|\s)article-body-left(?!\S)/) ) {
        document.getElementById("article-body").className = document.getElementById("article-body").className.replace( /(?:^|\s)article-body-left(?!\S)/g , '' )
    }
  }
  aLeft.onclick = function() {
  	if (!document.getElementById("article-body").className.match(/(?:^|\s)article-body-left(?!\S)/) ) {
        document.getElementById("article-body").className += "article-body-left";
    }
  }
}