Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Shuffle Text BB Code (Randomizes text) (BBCode) Details »»
Shuffle Text BB Code (Randomizes text) (BBCode)
Version: 1.00, by BirdOPrey5 (Senior Member) BirdOPrey5 is offline
Developer Last Online: Aug 2023 Show Printable Version Email this Page

Category: BB Code Enhancements - Version: 4.0.x Rating:
Released: 08-07-2010 Last Update: Never Installs: 12
Supported
Re-useable 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: here.

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.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 08-08-2010, 05:51 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Note- this will randomize the letters each time you load the page... If you want to keep the same persistent order each time the page is loaded change the line in the replacement code:

Code:
 return Math.floor(Math.random() * (max + 1));
Replace Math.random() with a number between zero and 1, DO NOT MAKE IT = 1!!!

An example is:

Code:
 return Math.floor(0.5 * (max + 1));
Reply With Quote
  #3  
Old 08-10-2010, 02:36 AM
Dr.osamA's Avatar
Dr.osamA Dr.osamA is offline
 
Join Date: Aug 2004
Location: Syrie
Posts: 979
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Excellent

installed + 5 stars

keep it up man !
Reply With Quote
  #4  
Old 08-18-2010, 05:53 PM
ProFifaLeagues's Avatar
ProFifaLeagues ProFifaLeagues is offline
 
Join Date: Aug 2009
Location: Uk
Posts: 1,191
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Gonna give this a try out for a little fun in the threads!
Great work thanks
Reply With Quote
  #5  
Old 08-18-2010, 08:12 PM
Ahmet Turan Ahmet Turan is offline
 
Join Date: Dec 2006
Location: Mersin
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

your site have a trojen
Reply With Quote
  #6  
Old 08-18-2010, 08:24 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by pramid View Post
your site have a trojen
If you mean my demo site it definitely does not have a trojan... another BB Code on that page activates your adobe PDF reader to embed a PDF file, you may have a virus connected to that. What type of message/error are you getting?
Reply With Quote
  #7  
Old 08-23-2010, 01:58 PM
Da-Vinci Da-Vinci is offline
 
Join Date: Mar 2010
Posts: 249
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I declined the Adobe pop up thing as I'm using a brand new Lap Top and have not yet used Adobe reader and couldn't be bothered to go through accepting the licenses ect, and I got locked out of Firefox untill I restarted.

This is litterally been switched on in the past half hour.
Reply With Quote
  #8  
Old 08-23-2010, 02:20 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't know what to tell you, my site is clean... new laptops sometimes have really bad anti-viruses pre-installed- they're always the first thing I change.
Reply With Quote
  #9  
Old 08-26-2010, 06:26 PM
Da-Vinci Da-Vinci is offline
 
Join Date: Mar 2010
Posts: 249
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah mine did have a really bad av installed lol, it's been swapped now.

I don't think your site is infected, it was just a pain that the Acrobat reader crahsed my laptop when it tried to run the first use process or whatever it was trying to do, it was only because I declined to accept the TOS of Adobe, but I couldn't get my head round why it crashed Firefox as a result.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:33 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04264 seconds
  • Memory Usage 2,299KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete