Show
Ignore:
Timestamp:
07/30/08 17:42:39 (4 months ago)
Author:
kotas
Message:

Added "Move to Playlist" feature.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/userscripts/niconicofavlist.user.js

    r16423 r16870  
    1111 
    1212        var NicoNicoFavlist = { 
    13                 version: "1.14", 
     13                version: "1.15", 
    1414                getUserAgent: function () { 
    1515                        return "NicoNicoFavlist/" + NicoNicoFavlist.version + " Greasemonkey"; 
     
    688688                        if (changed) favlist.save(); 
    689689                }, 
     690                addToPlaylist: function () { 
     691                        if (typeof w.gm_playlistController == "undefined") return; 
     692 
     693                        var addVideos = []; 
     694                        for (var k in this.list) { 
     695                                var mylist = this.list[k], videos = mylist.newVideos; 
     696                                for (var i = 0, len = videos.length; i < len; i++) { 
     697                                        addVideos.push(videos[i]); 
     698                                } 
     699                                mylist.clearAll(); 
     700                        } 
     701 
     702                        if (addVideos.length > 0) { 
     703                                w.gm_playlistController.pushVideos(addVideos); 
     704                        } 
     705                }, 
    690706                show: function (elem) { 
    691707                        var div = document.createElement("div"); 
     
    779795                        var self = this; 
    780796                        this.updateAllButton = this.addButton(buttons, "いますぐ更新", function () { self.updateAll(); }); 
     797 
     798                        var checkPlaylist = function () { 
     799                                if (typeof w.gm_playlistController != "undefined") { 
     800                                        var b = self.addButton(buttons, "プレイリストに移動", function () { self.addToPlaylist(); }); 
     801                                        b.style.marginLeft = "5px"; 
     802                                        return true; 
     803                                } 
     804                        } 
     805                        checkPlaylist() || setTimeout(checkPlaylist, 1); 
    781806 
    782807                        this.container.appendChild(buttons);