NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @author Abdullah Akay // @name jetsozluk // @namespace http://abdullahakay.blogspot.com/2012/07/jetsozluk.html // @version 1.85 // @description English - Turkish sozluk // @match *://*/* // @run-at document-end // @copyright 2012+, Abdullah Akay, akayabd@gmail.com // @grant GM_xmlhttpRequest // Last Update: 2016-10-28 // Since 2011 // ==/UserScript== // Dikkat,, veriler tureng.com dan cekilmektedir.. var mouseX = 0, mouseY = 0; var all_response = 'bos'; var myDiv = document.createElement('div'); var divIdName = 'div1'; myDiv.setAttribute('id', divIdName); myDiv.style.width = "300px"; myDiv.style.height = "1000px"; myDiv.style.left = "100px"; myDiv.style.top = "100px"; myDiv.style.position = "absolute"; myDiv.style.background = "#CCFFFF"; myDiv.style.border = "1px solid #000000"; myDiv.style.color = "#000000"; myDiv.innerHTML = all_response; myDiv.style.visibility = 'hidden'; myDiv.style.opacity = 0.9; myDiv.style.zIndex = 99999; myDiv.style.fontSize = 'medium'; myDiv.style.fontFamily = 'sans-serif'; myDiv.style.fontWeight = 'normal'; function init(){ document.body.appendChild(myDiv); } function terminate(){ // document.body.removeChild(myDiv); } myDiv.addEventListener('mousedown', function(event) { myDiv.style.visibility = 'hidden'; if ( null !== document.getElementById(divIdName) ) terminate(); }, false); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //get mouse pos document.addEventListener('mousemove', function(event) { mouseX = event.pageX; mouseY = event.pageY; }, false); /* //Add listener for mouse clicks document.addEventListener('dblclick', function(event) { if (event.button == 0) { if ( null != document.getElementById(divIdName) ) terminate(); init(); var text = document.getSelection(); query(text, mouseX, mouseY); } }, false); */ //Add listener for mouse clicks document.addEventListener('mouseup', function(event) { if (event.button === 0) { var text = document.getSelection(); if( '' === text ){ return; } terminate(); init(); query(text, mouseX, mouseY); } }, false); function query(text, mouseX, mouseY) { GM_xmlhttpRequest({ method: 'GET', url: 'http://tureng.com/tr/turkce-ingilizce/' + text, headers: { "User-Agent":"monkeyagent", "Accept":"text/monkey,text/xml", }, onload: function(responseDetails) { myDiv.innerHTML = 'Request for Atom feed returned ' + responseDetails.status + ' ' + responseDetails.statusText + '\n\n' + 'Feed data:\n' + responseDetails.responseText; var table = document.getElementById('englishResultsTable'); if (table === null) { myDiv.innerHTML = "no result"; return; } var results = table.innerHTML; var str_text = String(text); text = str_text; //alert(typeof text + ' ' + typeof str_text); //alert( text ); var lastChar = text.charAt(text.length - 1); if (lastChar == ' ') text = text.slice(0, text.length - 1); //discard unnecesary info results = results.replace(new RegExp("</tr>", "gi"), "<br/ >"); results = results.replace(new RegExp(">", "gi"), " "); results = results.replace(new RegExp(text, "gi"), "  "); results = results.replace(new RegExp('/search/', "gi"), "http://tureng.com/search/"); results = results.replace(new RegExp('<a href', "gi"), "<a style='color: #0000FF;font-weight: normal; font-variant: normal; font-size: medium; font-family: sans-serif;' href"); myDiv.innerHTML = '<strong>' + text + '</strong> <br />' + results; myDiv.innerHTML += '<strong><br/><br/><br/><br/><br/>JetSozluk 2014, Abdullah Akay<br/> ' + 'web page: http://abdullahakay.blogspot.com/2012/07/jetsozluk.html<br/>' + 'email: akayabd@gmail.com<br/>' + 'veriler tureng.com dan cekilmektedir</strong>'; myDiv.style.left = mouseX + 20 + "px"; myDiv.style.top = mouseY + 20 + "px"; myDiv.style.visibility = 'visible'; }, onerror: function(reponse) { console.log("JETSOZLUK error: ", reponse); } });} ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////