Sisu Decoder

Translate Internet slang into normal language.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name           Sisu Decoder
// @description    Translate Internet slang into normal language.
// @include        http://harddrop.com/*
// @version 0.0.1.20140804044426
// @namespace https://greasyfork.org/users/2233
// ==/UserScript==

var wnd = window
var doc = wnd.document
var loc = location
var href = loc.href

// https://www.vodacommessaging.co.za/dictionary.asp?t=1
var slang_dict = {}
slang_dict['adn'] = 'Any Day Now'
slang_dict['afaik']= 'As far as I know'
slang_dict['asap'] = 'As soon as possible'
slang_dict['atm'] = 'At the moment'
slang_dict['b2b'] = 'business to business'
slang_dict['ceo'] = 'Chief Executive'
slang_dict['fyi'] = 'For your information'
slang_dict['hth'] = 'Hope this helps'
slang_dict['imo'] = 'In my opinion'
slang_dict['iu2u'] = "It's up to you"
slang_dict['lmk'] = 'Let me know'
slang_dict['lch'] = 'lunch'
slang_dict['md'] = 'managing director'
slang_dict['mtng'] = 'meeting'
slang_dict['msg'] = 'message'
slang_dict['mob'] = 'mobile'
slang_dict['nagi'] = 'Not a good idea'
slang_dict['rgds'] = 'regards'
slang_dict['thx'] = 'thanks'
slang_dict['tia'] = 'Thanks in advance'
slang_dict['wottm']= 'What time'

addEventListener('keydown', function(evt) {
    if(evt.keyCode == 68) // d
    {
        var q = '' + (wnd.getSelection?wnd.getSelection():doc.getSelection?doc.getSelection():doc.selection.createRange().text)
        wnd.getSelection().removeAllRanges()
        q = q.replace(/^\s+|\s+$/g,'').replace(/\s\s+/g,' ')
        if(q.length == 0) { return }
        var translated = ''
        var words = q.split(' '), len = words.length
        for(var i=0; i<len; i++)
        {
            if(words[i].toLowerCase() in slang_dict)
            {
                translated = translated + ' ' + slang_dict[words[i].toLowerCase()]
            }
            else
            {
                translated = translated + ' ' + words[i]
            }
        }
        alert(translated)
    }
}, false)