hzlzh / Alfred-Workflows

Make your Alfred more powerful. (include Workflows, Extensions and Themes)
http://AlfredWorkflow.com/
1.04k stars 96 forks source link

add https://0cn.de to short url list #17

Open ryanthara opened 8 years ago

ryanthara commented 8 years ago

Hello

is it possible to add the service https://0cn.de to shorten url?

The service provides privacy...

hzlzh commented 8 years ago

A API is needed if you want to use this service with workflow.

ryanthara commented 8 years ago

I'll ask the author for an api, but he hasn't answered yet.

0cn.de has the ability to save the service as bookmarks, and you will see the code behind.

javascript:(function()%7Bvar%20d=false;%20var%20n_u=navigator.userAgent;%20if(location.protocol=='https:'%20&&%20(n_u.indexOf('Chrome')!=-1%20%7C%7C%20n_u.indexOf('Opera')!=-1))%7Bwindow.open('https://0cn.de/?url='+encodeURIComponent(document.URL)+'&noref=1',%20'_blank');%20d=true;%7D%20if(!d)%7Bvar%20d=document,s=d.createElement('script');s.charset='UTF-8';s.type='text/javascript';s.src='https://0cn.de/js/bookmark.php?s=0.2&noref=1&url='+encodeURIComponent(d.URL);d.body.appendChild(s);%7D%7D)();

Is this helpful?

hzlzh commented 8 years ago

Yes, this should be a kind of API:

https://0cn.de/js/bookmark.php?s=0.2&noref=1&url=google.com

and you can get the final short link this.

var nr='&noref=1';if (null==prompt("Hier die gewünschte Kurz-URL. Kopiere sie und klicke 'OK', wenn du zufrieden bist. Klicke auf 'Abbrechen', um weitere Einstellungen auf 0cn.de vorzunehmen (falls nichts passiert: Pop-Up zulassen).", "http://0cn.de/qfzu")){ window.open('https://0cn.de/?url='+encodeURIComponent(document.URL)+nr, '_blank'); }
ryanthara commented 6 years ago

Looks good. But my skills are so bad, I failed with an implementation. :-(