// sarcasm.js
// Automatically transform boring, bland text to properly convey sarcasm
// there options:
// OpTiOn OnE
// π OPTION π TWO π
// O P T I O N T H R E E
var sarcasm = (function(){
var sample_text = "The quick brown fox jumps over the lazy dog";
var hand_emoji = "π";
document.oncontextmenu = (i) => {
launch_convert_menu(window.getSelection().toString())
};
function launch_convert_menu(){}
function close_convert_menu(){}
console.log( convert_to_option_one(sample_text) );
console.log( convert_to_option_two(sample_text) );
console.log( convert_to_option_three(sample_text) );
function convert_to_option_one(text){
var stream = text.split('');
stream.forEach((l,i) => {
if(i % 2 > 0){
stream[i] = l.toUpperCase();
} else{
stream[i] = l.toLowerCase();
}
});
return stream.join('');
}
function convert_to_option_two(text){
var stream = text.split(' ');
return hand_emoji + stream.join(hand_emoji) + hand_emoji;
}
function convert_to_option_three(text){
var stream = text.split('');
stream = stream.join(' ').toUpperCase();
stream = stream.split(' ');
return stream.join(' ');
}
return {}
})();
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features β
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.