• Home
  • Index
  • Search
  • Download
  • Server Rules
  • House Roleplay Laws
  • Player Utilities
  • Player Help
  • Forum Utilities
  • Returning Player?
  • Toggle Sidebar
Interactive Nav-Map
Tutorials
New Wiki
ID reference
Restart reference
Players Online
Player Activity
Faction Activity
Player Base Status
Discord Help Channel
DarkStat
Server public configs
POB Administration
Missing Powerplant
Stuck in Connecticut
Account Banned
Lost Ship/Account
POB Restoration
Disconnected
Member List
Forum Stats
Show Team
View New Posts
View Today's Posts
Calendar
Help
Archive Mode




Hi there Guest,  
Existing user?   Sign in    Create account
Login
Username:
Password: Lost Password?
 
  Discovery Gaming Community Rules & Requests Site & Forum Feedback
« Previous 1 2 3 4 5 … 49 Next »
Forum Prism.js Support

Server Time (24h)

Players Online

Active Events - Scoreboard

Latest activity

Forum Prism.js Support
Offline Laz
09-16-2018, 01:56 PM, (This post was last modified: 09-16-2018, 02:44 PM by Laz.)
#1
(Sorta) Retired Code Monkey
Posts: 1,904
Threads: 106
Joined: Jan 2014

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.

[+]MyCode
Regular expression:
Code:
\[prism=([a-z])\](?|\s(.*?)\s|\s(.*?)|(.*?)\s|(.*?))\[\/prism\]
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:
<pre class="line-numbers show-language line-highlight code-toolbar toolbar"><code class="language-$1">$2</code></pre>
[+]Usage and Result
If you were to click the "copy" word it would copy the contents of the above block to the clipboard.

(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]
I hate web development.

Reply  


  • View a Printable Version
  • Subscribe to this thread


Users browsing this thread:
1 Guest(s)



Powered By MyBB, © 2002-2025 MyBB Group. Theme © 2014 iAndrew & DiscoveryGC
  • Contact Us
  •  Lite mode
Linear Mode
Threaded Mode