09-16-2018, 01:56 PM
Prism.js is a useful utility for adding code snippets to web pages with syntax highlighting. While it's not something many people would use, it would be rather nice to have. I looked into it and I think I know how to integrate it with MyBB. Sorry if this is wrong.
Prism.JS download
I would suggest for implementation to add a new style sheet in the ACP called PrismJS and copy the CSS in there. Then create a new js file in the jscripts directory of MyBB, and add a link to it in the headerinclude template.
I hate web development.
Prism.JS download
I would suggest for implementation to add a new style sheet in the ACP called PrismJS and copy the CSS in there. Then create a new js file in the jscripts directory of MyBB, and add a link to it in the headerinclude template.
Regular expression:
Disclaimer: I have extremely minimal experience with Regex, and this could be really insecure for all I know. If it is let me know so I can try and make it more secure.
Replacement:
Code:
\[prism=([a-z])\](?|\s(.*?)\s|\s(.*?)|(.*?)\s|(.*?))\[\/prism\]
Replacement:
Code:
<pre class="line-numbers show-language line-highlight code-toolbar toolbar"><code class="language-$1">$2</code></pre>
If you were to click the "copy" word it would copy the contents of the above block to the clipboard.
(Click for full res)
(Click for full res)
Code:
[prism=js]let names = ["Kinky Kenshin", "Phallic Phil", "Daddy Dan", "Lewd Laz", "Naughty Nekro", "Sexy Sombra"];
let luckyPerson = Math.floor(Math.random() * names.length);
console.log(luckyPerson); [/prism]
[prism=cpp]struct BOUNTYINFO
{
wstring character; // Who is the bounty against?
wstring issuer; // Who issued it in the first place?
uint bountyAmount; // How much for?
uint claimAmount; // How many times may it be claimed?
uint claimedAmount; // How many times has it been claimed?
uint timeUntilDecay; // How many days until this bounty runs it's course?
string reason; // Make sure an inRP reason is provided for the bounty.
bool operator == (const BOUNTYINFO& rm) const // This allows us to compare structs
{
return (rm.character == character
&& rm.issuer == issuer
&& rm.bountyAmount == bountyAmount
&& rm.claimAmount == claimAmount
&& rm.claimedAmount == claimedAmount
&& rm.timeUntilDecay == timeUntilDecay
&& rm.reason == reason
);
}
}; [/prism]
[prism=ini] [Config]
; Is plugin enabled?
enabled = yes
announceClaim = yes
announceBounty = yes
announceHunters = yes
announceNewBounties = yes
minBounty = 5000000; Min amount of cash that can be placed on a single bounty
maxBounty = 50000000; Max amount of cash that can be placed on a single bounty
bountyLifespan = 30; How many days will each bounty be active for?
; By default no files are exported.
; If you do not uncomment and change the below files it will attempt to save them in a folder called 'Exports' inside of the EXE folder of the disco dir running the plugin
; It will fail if there are directories in the filepath (like the above one) that don't exist yet.
export = 2
html = C:\Discovery Freelancer\EXPORTS\BountyExports.html
json = C:\Discovery Freelancer\EXPORTS\BountyExports.json [/prism]