Back to vBulletin 4.x Add-ons

Shuffle Text BB Code (Randomizes text) (BBCode)
Mod Version: 1.00, by BirdOPrey5

vB Version: 4.0.x Rating: (3 votes - 5.00 average) Installs: 12
Released: 08 Aug 2010 Last Update: Never Downloads: 0
Not Supported Re-usable Code Translations  

This BB Code uses Javascript to shuffle the alpha-numeric and some special characters in a block of text. This can be used to create 'puzzles' for your members or perhaps provide answers to questions that aren't immediately apparent should someone accidentally glance at them. The use is of course up to you.

I found this Javascrpt already created on the web and have left the copyright info in tact. I made minor changes to adapt it to a BB Code.

Demo: http://www.juot.net/forums/showthread.php?p=845515#post845515

Add a new BBCode

Title: Random (Shuffle) Text
BB Code Tag Name: ran
Replacement:
Code:
<script type="text/javascript">
function str_shuffle (str) {
    // Shuffles string. One permutation of all possible is created  
    // 
    // version: 1006.1915
    // discuss at: http://phpjs.org/functions/str_shuffle
    // +   original by: Brett Zamir (http://brett-zamir.me)
    // *     example 1: shuffled = str_shuffle("abcdef");
    // *     results 1: shuffled.length == 6
    if (str == undefined) {
        throw 'Wrong parameter count for str_shuffle()';
    }
    var getRandomInt = function (max) {
        return Math.floor(Math.random() * (max + 1));
    }
    var newStr = '', rand = 0;
    while (str.length) {
        rand = getRandomInt(str.length-1);
        newStr += str.charAt(rand);
        str = str.substring(0, rand)+str.substr(rand+1);
    }
    return newStr;
}
</script> 
<script>
document.write(str_shuffle("{param}"));
</script>
Example: [ran]This is a random test[/ran].
Description: This code shuffles text. Do not use the following characters: " {}[]<>&
Use Option: No
Button Image: (optional)
Remove Tag If Empty: Yes
All Disable Options: Yes

The following special characters do not work: " {}[]<>& (There may be others)
The following special characters do work: .,!?$()

Please mark as installed if you use this.
View My Profile for more BB Code Enhancements- they work on all versions.

Example:
[b][ran]A bold example[/ran].[/b] =
ex adlmopbl eA.

Download

No files for download.

Similar Mods

BB Code Enhancements Highlight BBCode - Highlights text with a yellow box (BB Code) vBulletin 4.x Add-ons
BB Code Enhancements Text Fade (Rainbow Faded Text) BBCode Modification Graveyard
BB Code Enhancements Text Fade (Rainbow Faded Text) BBCode Modification Graveyard
BB Code Enhancements Shuffle Text BB Code (Randomizes text) (BBCode) vBulletin 3.8 Add-ons
BB Code Enhancements Highlight BBCode - Highlights text with a yellow box (BB Code) vBulletin 3.8 Add-ons

vblts.ru supports vBulletin®, 2022-2024