Geeklist Tweaks

Various tweaks to improve BGG.

目前為 2016-09-01 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name       Geeklist Tweaks
// @namespace  tequila_j-script
// @version    0.0.16
// @description  Various tweaks to improve BGG. 
// @match      https://boardgamegeek.com/*
// @match      https://www.boardgamegeek.com/*
// @match      https://rpggeek.com/*
// @match      https://www.rpggeek.com/*
// @match      https://videogamegeek.com/*
// @match      https://www.videogamegeek.com/*

// @match      http://boardgamegeek.com/*
// @match      http://www.boardgamegeek.com/*
// @match      http://rpggeek.com/*
// @match      http://www.rpggeek.com/*
// @match      http://videogamegeek.com/*
// @match      http://www.videogamegeek.com/*
// @require	http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @resource	fa http://cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css
// @grant    GM_addStyle
// @grant    GM_getResourceText
// ==/UserScript==





  
GM_addStyle("\
 div.t-nav-container {\
	position: absolute;\
	top: 0px;\
	right: 0px;\
}\
div.t-nav-container i.fa {\
	font-size: 20px;\
	margin: 0px 4px;\
	cursor: pointer;\
}\
\
");
            
$(document).ready(function() {
   'use strict';
    /*jshint multistr: true */
  
  $("head").append (
    '<link href="//cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css">'
  );

  var newItems = $('div.subbed_selected,div.subbed');
  console.log("Size: " + newItems.length);
  
  var iconUp = $('<i class="fa fa-caret-square-o-up" aria-hidden="true"></i>');
  var iconDown = $('<i class="fa fa-caret-square-o-down" aria-hidden="true"></i>');
  var iconBox = $('<div class="t-nav-container"></div>');
  
  newItems.each(function(index) {
    
    var thisItem = $(this);
    
    thisItem.css('position','relative');

    var iconContainer = iconBox.clone();
    thisItem.append(iconContainer);
    
    
    
    //go up
    if (index != 0) {
      	var upI = iconUp.clone();
    	upI.click(function () {
      		$("html, body").animate({ scrollTop: $(newItems[index - 1]).offset().top }, "fast");
			return false;
    	});
      	iconContainer.append(upI);
      	
    } else {
      iconContainer.append(iconDown.clone().css('visibility','hidden'));
    }
    
    //go down
    if (index != newItems.length - 1) {
      	var downI = iconDown.clone();
    	downI.click(function () {
      		$("html, body").animate({ scrollTop: $(newItems[index + 1]).offset().top }, "fast");
			return false;
    	});
        
      	iconContainer.append(downI);
    }
  
  });
    
  
});