PDA

Просмотр полной версии : кто разбирается в user.js?


Godfather Bulan
08.11.2009, 02:35
Короче говоря есть такой код

<FORM name="text"><textarea name=post cols="43" rows="7" id="message"></textarea>

<input type="button" name="mybutton" value="Rus">


<script language="VBscript">
<!--
Sub mybutton_onclick
a=document.text.post.value
for i=1 to len(a)
status=i&" из"&len(a)
s=mid(a,i,1)

if s="q" then s="й"
if s="w" then s="ц"
if s="e" then s="у"
if s="r" then s="к"
if s="t" then s="е"
if s="y" then s="н"
if s="u" then s="г"
if s="i" then s="ш"
if s="o" then s="щ"
if s="p" then s="з"
if s="[" then s="х"
if s="]" then s="ъ"
if s="a" then s="ф"
if s="s" then s="ы"
if s="d" then s="в"
if s="f" then s="а"
if s="g" then s="п"
if s="h" then s="р"
if s="j" then s="о"
if s="k" then s="л"
if s="l" then s="д"
if s=";" then s="ж"
if s="'" then s="э"
if s="z" then s="я"
if s="x" then s="ч"
if s="c" then s="с"
if s="v" then s="м"
if s="b" then s="и"
if s="n" then s="т"
if s="m" then s="ь"
if s="," then s="б"
if s="." then s="ю"
if s="/" then s="ё"


if s="Q" then s="Й"
if s="W" then s="Ц"
if s="E" then s="У"
if s="R" then s="К"
if s="T" then s="Е"
if s="Y" then s="Н"
if s="U" then s="Г"
if s="I" then s="Ш"
if s="O" then s="Щ"
if s="P" then s="З"
if s="A" then s="Ф"
if s="S" then s="Ы"
if s="D" then s="В"
if s="F" then s="А"
if s="G" then s="П"
if s="H" then s="Р"
if s="J" then s="О"
if s="K" then s="Л"
if s="L" then s="Д"
if s="Z" then s="Я"
if s="X" then s="Ч"
if s="C" then s="С"
if s="V" then s="М"
if s="B" then s="И"
if s="N" then s="Т"
if s="M" then s="Ь"

newtext=newtext+s
next
document.text.post.value = newtext
end sub
-->
</script>

</form>


Его нужно перегнать в userjs
Сделал так, не пашет:

var table = document.getElementsByClassName('text_main_2')[0].rows[2].cells[1];
table.innerHTML =
'<FORM name="text"><textarea name=post cols="43" rows="7" id="message"></textarea>'+
'<input type="button" name="mybutton" value="2Rus">'+
'<script language="VBscript">'+
'<!-- Sub mybutton_onclick'+
' a=document.text.post.value'+
'for i=1 to len(a)'+
'status=i&" из"&len(a)'+
's=mid(a,i,1)'+
'if s="q" then s="й"'+
'if s="w" then s="ц"'+
'if s="e" then s="у"'+
'if s="r" then s="к"'+
'if s="t" then s="е"'+
'if s="y" then s="н"'+
'if s="u" then s="г"'+
'if s="i" then s="ш"'+
'if s="o" then s="щ"'+
'if s="p" then s="з"'+
'if s="[" then s="х"'+
'if s="]" then s="ъ"'+
'if s="a" then s="ф"'+
'if s="s" then s="ы"'+
'if s="d" then s="в"'+
'if s="f" then s="а"'+
'if s="g" then s="п"'+
'if s="h" then s="р"'+
'if s="j" then s="о"'+
'if s="k" then s="л"'+
'if s="l" then s="д"'+
'if s=";" then s="ж"'+
'if s="'" then s="э"'+
'if s="z" then s="я"'+
'if s="x" then s="ч"'+
'if s="c" then s="с"'+
'if s="v" then s="м"'+
'if s="b" then s="и"'+
'if s="n" then s="т"'+
'if s="m" then s="ь"'+
'if s="," then s="б"'+
'if s="." then s="ю"'+
'if s="/" then s="ё"'+
'if s="Q" then s="Й"'+
'if s="W" then s="Ц"'+
'if s="E" then s="У"'+
'if s="R" then s="К"'+
'if s="T" then s="Е"'+
'if s="Y" then s="Н"'+
'if s="U" then s="Г"'+
'if s="I" then s="Ш"'+
'if s="O" then s="Щ"'+
'if s="P" then s="З"'+
'if s="A" then s="Ф"'+
'if s="S" then s="Ы"'+
'if s="D" then s="В"'+
'if s="F" then s="А"'+
'if s="G" then s="П"'+
'if s="H" then s="Р"'+
'if s="J" then s="О"'+
'if s="K" then s="Л"'+
'if s="L" then s="Д"'+
'if s="Z" then s="Я"'+
'if s="X" then s="Ч"'+
'if s="C" then s="С"'+
'if s="V" then s="М"'+
'if s="B" then s="И"'+
'if s="N" then s="Т"'+
'if s="M" then s="Ь"'+
' newtext=newtext+s'+
' next'+
'document.text.post.value = newtext'+
'end sub'+
'-->'+
'</script>'+
'</form>';

Подскажите по сабжу :(

Godfather Bulan
08.11.2009, 11:43
хацкеры ^_^

Forcer
08.11.2009, 16:49
user.js это что? Пользовательские скрипты Оперы? Почему VBScript? Вообще, такому коду место на govnokod.ru. Делаешь мапу: key - eng chars, value - ru chars. Потом просто достаешь по ключу значение. В итоге 0 условий, а не это безобразие.

Godfather Bulan
08.11.2009, 17:02
код не я писал) это из чата какого-то.

Поробней можно?

Godfather Bulan
08.11.2009, 17:05
Dukchat вроде

Forcer
08.11.2009, 17:23
map = {'q' : 'й', 'w' : 'ц'};
value = map['q'];

Godfather Bulan
08.11.2009, 17:30
не) эт тож самое

Forcer
08.11.2009, 18:03
Вовсе не тоже самое: бесконечное число if-ов и обычная мапа. В первом случае это говнокод. Во втором - нормальное решение.

Godfather Bulan
08.11.2009, 18:04
ине похер на вид кода. мне нужен рабочий код

razb
08.11.2009, 18:06
нда, такого я еще не видел ))

Godfather Bulan
08.11.2009, 18:25
другой вопрос, вы хоть код тестили?