12 posts tagged “gm”
I fixed one of the two annoyances that have been bugging me for a while now (rev. 18 is available with the fix). The one I fixed is that when you do an 'edit entry' in LJ, you can't just leave the security settings out and hope that they will remain unchanged - instead their absence causes reset of them settings to some unimaginably silly default. The fix is rather ugly, but it works - I keep the security settings inside the body of the entry, together with the itemid.
The other grievance I was unable to fix involves embedded content (such as video, audio etc.). I'm too dumb now to figure out how to make it appear properly in LJ.
Crossposted to LJ, itemid = 2517, security = usemask, mask = 8192.
До меня тут дошли слухи, что некоторые российские сайты сказали свое новое слово в области интернет-рекламы, а именно - продали букву "К". Ну, какую именно букву продали - не так важно. В общем, я написал скриптик, который эти линки убирает. Так что если у вас файрфокс (и поставлен GreaseMonkey) - прошу любить и жаловать (вот здесь можно смотреть на сорсы скрипта, и все такое). Если появятся еще сайты, помимо коммерсанта и состав.ру, которые увлекаются подобной хренью - сообщите, я и их добавлю в списочег.
Crossposted to LJ, itemid = 2475
P.S. Впрочем, я наверняка изобретаю велосипед, и какой-нибудь Adblock давно уже подобные вещи умеет резать.
I've fixed the bug in the Vox to LJ crosspost script, that kinda prevented it from functioning. The bug originated in the recent GreaseMonkey update, that
<technical jargon>
introduced double checking of the call stack of its protected functions to make sure the calls are only allowed from a valid context
</technical jargon>.
You can redownload the script here. In general, even though I know the approximate number of people using this script (20), I would really like some feedback on it, since this one is, to be frank, the only script of the bunch that solves a real problem, and is non-trivial enough to justify some modest maintenance effort (but only if that effort is called for by the audience).
Crossposted to LJ, itemid = 2449
I've updated the Vox to LJ script with the following new features:
- It now crossposts edits in addition to new posts (but only for posts initially created with this new version!)
- It fixes a bug with submitting entries for friends only (that were erroneously interpreted as private)
- It unescapes some Vox's escaping so that the lj user tag transferres to LJ unbroken.
Crossposted to LJ, itemid = 2437
I'm rereleasing the Vox to LJ script. It now handles correctly non-Latin characters in its dealings with LJ. Still, a major limitation remains: it doesn't handle well embedded content, such as images, video and so on (which is also true of the original Vox's crosspost feature, so I don't feel too bad about it). Yet it seems to be working ok for the text only posts. Let me know if any other problems pop up.
Whoever has installed the previous version, is strongly advised to upgrade to the new one.
Как могли догадаться читатели этого журнала, я написал очередной скрипт (ТМ). Этот скрипт позволяет делать кросспост из Вокса в ЖЖ, при этом, в отличие от обычного воксовского кросспоста:
- Сохраняются тэги
- Устанавливаются security settings (public/private/friends/group) для кросспоста (причем независимо от выбранных вами установок для воксовской копии поста)
- Отсутствует раздражающая надпись "On Vox".
Скрипт расположен здесь, прошу любить и жаловать.
Здравствуйте, уважаемые!
Я написал скрипт для гризманки, который позволяет с легкостью вставлять в посты в Воксе фотографии с сервиса fotki.com, аналогично тому, как ранее можно было вставлять фотографии с фликра и фотобакета. После установки скрипта, при нажатии в окне редактирования поста на кнопку "photos", в появляющемся окне появится новая закладка - Fotki. Нажав на нее, вы получаете список своих альбомов на фотки.ком. Кликнув на название альбома, получите список фотографий в этом альбоме. Теперь достаточно дабл-кликнуть на фотографию, и она будет вставлена в пост. К сожалению, вокс устроен так, что увидете вы ее только после отправки поста - в процессе редактирования фотография видна не будет (вместо нее будет только серый квадрат).
Установить скрипт можно, нажав на этот линк.
Несколько замечаний:
- При первом использовании (т.е. после первой загрузки странички составления поста) скрипт попросит вас сообщить ваш юзернейм на фотки.ком - смотрите, не ошибитесь!
- Для того, чтобы скрипт работал, надо быть залогиненным в фотки.ком (например, в другом табе)
- Разумеется, скрипт будет работать только в тех браузерах, в которых есть поддержка GreasMonkey (т.е., в файрфоксе и, по некоторым данным, сафари).
- Если вы знаете javascript, то можете, при желании, почитать исходники скрипта здесь.
- Баг репорты и пожелания о дополнительных возможностях принимаются в комментах.
Я написал еще один скрипт для грязеобезьяны, который позволяет с легкостью постить фотографии, выложенные на фотки.ком, в вокс. В этой связи, хотел бы задать уважаемой аудитории пару вопросов:
1. Пользуетесь ли вы сервисом фотки.ком?
2. Если пользуетесь, поможет ли вам этот скрипт?
3. Как удобнее: чтобы скрипт при первом запуске спросил ваши юзернейм и пассворд на фотки.ком, и потом сохранял их у себя и логинился с ними, или чтобы скрипту пассворда не давать, но прежде чем начинать работать с ним, залогиниться в фотки.ком (скажем, из другого таба)?
Apparently, I'm not the only one trying to hack Vox with bits and pieces of GreaseMonkey. Here's someone who've been there long before me: cho45. Here's a script that adds an ability to insert preformatted blocks of text. And here's another one that allows one to alternate between WYSIWYG and HTML editing. Strangely, he doesn't seem to release his stuff to userscripts.org, so it all goes unnoticed.
An excellent article by the author of GreaseMonkey, explaining many pitfalls one is likely to fall into while hacking a GM script (I surely have fallen into a great many of those). An absolute must for everyone contemplating authoring a GM script (<lj user=ilya_dogolazky>, and I do mean you).
With the help of this article, I finally managed to get at the App object defined by the Vox code. Here's how I did it:
var win = window.wrappedJSObject;
var app = win.App;
Once I had the app object, I could access the built in editor, and the code that adds a current track to the post's window would now look as follows (except that I still don't understand, how to APPEND the HTML rather than insert it at the cursor, so I'm leaving it as is for now):
var s = app.singleton;
var editor = s.editor;
editor.insertHTML("<b>Current track: " + track + "</b>", true, 0, true);
Maybe it's not that much shorter than the original code, but it is surely much more correct and resilient against changes by Vox people.