satyr (owner)

Revisions

gist: 173735 Download_button fork
public
Description:
Opens Midori-san in a new tab.
Public Clone URL: git://gist.github.com/173735.git
Embed All Files: show embed
midorisan.ubiq.js #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
0,function(){{}
const URL = 'http://www.smbc.co.jp/midorisan/';
CmdUtils.CreateCommand({
  name: 'midorisan',
  description: 'Opens '+ 'Midori-san'.link(URL) +' in a new tab.',
  author: 'satyr', license: 'MIT',
  icon: 'http://www.smbc.co.jp/favicon.ico',
  arguments: {object: noun_type_number, goal: /^\d+/},
  execute: function({object: {data: from}, goal: {text: to}}){
    var me = this;
    if (to) me._open(from, +to);
    else $.get(URL, function(h){
      me._open(from, +/<div id="top">(\d+)/(h)[1]);
    });
  },
  _open: function(f, t){
    var page = ('data:text/html,<!--midorisan-->'+
                '<base href="'+ URL +'images/"/><center>');
    for(let i = f; i <= t; ++i)
      page += '<img src="'+ i +'_t.jpg"/><br/><img src="'+ i +'.jpg"/><hr/>';
    Application.activeWindow.open(Utils.uri(page));
  },
});
}();