You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-15Lines changed: 18 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,14 +20,12 @@ Example:
20
20
```
21
21
<script>
22
22
var yourMOTD = "§d§lnerd.nu§8: §6§oCreative Rev 28";
23
-
replaceColorCodes(yourMOTD, "outputDiv");
23
+
var newMOTD = yourMOTD.replaceColorCodes();
24
+
console.log(newMOTD);
24
25
<script>
25
-
<div id="outputDiv"></div>
26
26
```
27
-
Simple enough. Put the string you want in the function ```replaceColorCodes()```, and place the ID or class of the output element, and voila! You can then do whatever you like with it!
28
-
When using a class, the script will find the first match.
27
+
Simple enough. Get your string, attach the function at the end (Don't forget the brackets, they are essential) and voila! You can then do whatever you like with it!
29
28
30
-
Do note that the script will probably overwrite anything inside the element. I would suggest you use a ```span``` element with the class or id of your choice.
31
29
32
30
##Extras
33
31
You might want to get your server's MOTD, but you don't know how to access the server from your website?
document.getElementById("myDiv").innerHTML = "Server is offline...";
40
+
console.log("Server is offline...");
42
41
}
43
42
});
44
43
})
@@ -48,15 +47,17 @@ https://mcapi.us provides JSON responses from the server provided in the URL. By
48
47
49
48
##Bugs / ToDo
50
49
51
-
-#1 §k does not work.
52
-
-#2 Having multiple formatting codes does not work.
53
-
-#3 The spaces disappear, and the output is a whole big chunk of letters.
54
-
-#4 Color Codes should reset previous occuring formatting codes, yet they seem to keep the formatting.
50
+
-#1 §k does not work. (FIXED IN VERSION 3.0)
51
+
-#2 Having multiple formatting codes does not work. (FIXED IN VERSION 2.0)
52
+
-#3 The spaces disappear, and the output is a whole big chunk of letters. (FIXED IN VERSION 3.5)
53
+
-#4 Color Codes should reset previous occuring formatting codes, yet they seem to keep the formatting. (FIXED IN VERSION 3.7)
55
54
56
-
If you find one, please submit a ticket.
55
+
If you find one, please submit a ticket or a pull request.
57
56
58
-
- Add Class support (DONE!)
59
-
- Add Support for custom class, like first match, second match, etc... (Coming Soon)
57
+
- Add Class support (DROPPED!)
58
+
- Add Support for custom class, like first match, second match, etc... (DROPPED!)
59
+
- Put everything in a huge String.prototype function. (DONE!)
60
+
- Fix Bugs (DONE FOR ALL LISTED)
60
61
61
62
##Updates
62
63
v1.0 - Created this file, added replacements for color codes
@@ -73,7 +74,9 @@ v3.0 - Added §k, §r, and \n support. Now also requires the output element ID.
73
74
74
75
v3.1 - Finally! Support for class names too!
75
76
76
-
v3.5 - Fixed Bug #3, 'Spaces dissappear', by adding a CSS property to the output element.
77
+
v3.5 - Fixed Bug #3, 'Spaces dissappear', by adding a CSS property to the output element.'
78
+
79
+
v3.7 - Fixed Bug #4, put everything in a huge ```String.prototype``` function, so now you can't input your output element ID/Class. I mean come on, what if you just wanted to output to the console? I also changed a few tweaks here and there.
77
80
78
81
##Legal
79
82
You can modify this file in any way, but if you want, create a pull request so I can have a look. Also, try not sell this file/work for a price. I mean come on, if you really want money, go get a proper job. Thirdly and lastly, you can not give away this file/work without giving credit to me, and possibly giving the URL to this Github page. Due to the informality of this piece of text, you could ignore this if you want to.
0 commit comments