Sisu Decoder

Translate SMS language into normal language

Από την 30/06/2014. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name           Sisu Decoder
// @description    Translate SMS language into normal language
// @include        http://harddrop.com/*
// @version 0.0.1.20140630071016
// @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 sms_dict = {}
sms_dict['adn'] = 'Any Day Now'
sms_dict['afaik']= 'As far as I know'
sms_dict['asap'] = 'As soon as possible'
sms_dict['atm'] = 'At the moment'
sms_dict['b2b'] = 'business to business'
sms_dict['ceo'] = 'Chief Executive'
sms_dict['fyi'] = 'For your information'
sms_dict['hth'] = 'Hope this helps'
sms_dict['imo'] = 'In my opinion'
sms_dict['iu2u'] = "It's up to you"
sms_dict['lmk'] = 'Let me know'
sms_dict['lch'] = 'lunch'
sms_dict['md'] = 'managing director'
sms_dict['mtng'] = 'meeting'
sms_dict['msg'] = 'message'
sms_dict['mob'] = 'mobile'
sms_dict['nagi'] = 'Not a good idea'
sms_dict['rgds'] = 'regards'
sms_dict['thx'] = 'thanks'
sms_dict['tia'] = 'Thanks in advance'
sms_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 sms_dict)
            {
                translated = translated + ' ' + sms_dict[words[i].toLowerCase()]
            }
            else
            {
                translated = translated + ' ' + words[i]
            }
        }
        alert(translated)
    }
}, false)