pl = { name: 'xplugin_NicoAnimeSP', label: 'Nico Anime SP', author: 'tomato111', onStartUp: function () { // 最初に一度だけ呼び出される this.menuitem.Flag = MF_DISABLED; var _this = this; this.prop = { x: 15, y: 0, width: 10, height: 10, Color: { Ellipse_normal: setAlpha(prop.Style.Color.Text, 40), Ellipse_hover: setAlpha(prop.Style.Color.PlayingText, 96) } }; //============================================ //== Nico Anime SP Object ==================== //============================================ this.NAS = new function () { var _menu, _item_list; this.onPaint = function (gr) { gr.FillEllipse(_this.prop.x, _this.prop.y, _this.prop.width, _this.prop.height, this.hover ? _this.prop.Color.Ellipse_hover : _this.prop.Color.Ellipse_normal); }; this.repaint = function () { window.RepaintRect(_this.prop.x - 1, _this.prop.y - 1, _this.prop.width + 2, _this.prop.height + 2); }; this.refresh = function (x, y) { var menu_items = [ // header { Flag: MF_STRING, Caption: '(Refresh)', Func: function () { _this.NAS.refresh(x, y); } }, { Flag: MF_SEPARATOR } ]; var requestHeader = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0', 'If-Modified-Since': 'Thu, 01 Jun 1970 00:00:00 GMT' // キャッシュが邪魔をするので、強制的に最新データを取りに行く } // 放送中 getHTML(null, 'GET', 'https://live.nicovideo.jp/search?keyword=%E3%83%8B%E3%82%B3%E3%83%8B%E3%82%B3%E3%82%A2%E3%83%8B%E3%83%A1%E3%82%B9%E3%83%9A%E3%82%B7%E3%83%A3%E3%83%AB&status=onair&sortOrder=recentDesc&providerTypes=official&providerTypes=channel', !ASYNC, 0, extractLiveInfo, requestHeader); // 放送予定 getHTML(null, 'GET', 'https://live.nicovideo.jp/search?keyword=%E3%83%8B%E3%82%B3%E3%83%8B%E3%82%B3%E3%82%A2%E3%83%8B%E3%83%A1%E3%82%B9%E3%83%9A%E3%82%B7%E3%83%A3%E3%83%AB&status=reserved&sortOrder=recentDesc&providerTypes=official&providerTypes=channel', !ASYNC, 0, extractLiveInfo, requestHeader); // タイムシフト getHTML(null, 'GET', 'https://live.nicovideo.jp/search?keyword=%E3%83%8B%E3%82%B3%E3%83%8B%E3%82%B3%E3%82%A2%E3%83%8B%E3%83%A1%E3%82%B9%E3%83%9A%E3%82%B7%E3%83%A3%E3%83%AB&status=past&sortOrder=recentDesc&providerTypes=official&providerTypes=channel', !ASYNC, 0, extractLiveInfo, requestHeader); menu_items.push( // footer { Flag: MF_SEPARATOR }, { Flag: MF_STRING, Caption: 'ニコニコアニメスペシャル', Func: function () { FuncCommand('https://live.nicovideo.jp/search?keyword=%E3%83%8B%E3%82%B3%E3%83%8B%E3%82%B3%E3%82%A2%E3%83%8B%E3%83%A1%E3%82%B9%E3%83%9A%E3%82%B7%E3%83%A3%E3%83%AB&status=onair&sortOrder=recentDesc&providerTypes=official&providerTypes=channel'); } } ); _menu = buildMenu(menu_items); _item_list = buildMenu.item_list; _this.NAS.popup(x, y); function extractLiveInfo(request, depth, file) { var mode = file.match(/status=(\w+)/)[1].replace('onair', 'live').replace('reserved', 'future').replace('past', 'timeshift'); var res = request.responseText; //console2(res); res = res.replace(/[\t ]*(?:\r\n|\r|\n)[\t ]*/g, ''); var CutoutRE = new RegExp('