📜 ⬆️ ⬇️

Bookmarklet to create multi-line status VKontakte

Recent articles on Habré devoted to the creation of bookmarklets and small hacks on VKontakte (I can’t find something ... I read it in the PCS) made me make a bookmarklet that would allow to enter multi-line statuses - I always wanted to put a couple of three lines from the song :)

As a result, the code was pretty simple:

document.getElementById('edit_activity_text').parentNode.innerHTML = '<a id="edit_activity_toggle" href="#" onmousedown="return activity_editor.toggle_menu(event);" onclick="return false;">&nbsp;</a><textarea style="height: 100px" class="inputtext" id="edit_activity_text" name="edit_activity_text" maxlength="160" onblur="return activity_editor.blur();"/>';

That is, we take the status text field, go to its parent node and replace the contents with textarea (with the same attributes that the input had, but removing the processing of keystrokes so that it does not post the status to the enter), while leaving the tag A (VKontakte scripts are turning to it, so let it be), only it had to be moved forward, otherwise the firefox does not find it by id for some reason.

We make this code in javascript: (function () {}) (), change double quotes to & quot; and the bookmarklet is ready.
')
That's all, load your page, click the bookmarklet and click on change status or edit - we have a multi-line field, enjoy :)

The bookmarklet itself can be taken here: status vkontakte hack .

Bookmarklets are cool stuff)

Source: https://habr.com/ru/post/52439/


All Articles