BGG Language dependence on game info panel.

Shows language dependence in BGG gameplay bar.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name BGG Language dependence on game info panel.
// @namespace tequila_j-script
// @version    1.3.0
// @description  Shows language dependence in BGG gameplay bar.
// @match      http://*.boardgamegeek.com/*
// @match      http://boardgamegeek.com/*
// @match      https://*.boardgamegeek.com/*
// @match      https://boardgamegeek.com/*
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @grant    GM_addStyle
// @run-at document-end
// ==/UserScript==


//waitForKeyElements ("ul.gameplay", XX);

angular.element(document).ready(function () {

  var gameplayBar = $('ul.gameplay');

  //var featuresBar = $('div.game-description-secondary').find('ul.features > li.feature:first').find(":contains('ADDITIONAL SUGGESTIONS'");
  var featuresBar = $('ul.features').find("div.feature-title:contains('Language Dependence')").parent();
  
  var ldTextNode = angular.copy($(featuresBar).find('.feature-title'));
  
  var ldValueNode = angular.copy($(featuresBar).find('.feature-description'));
  
  var clickEventForwarderDest = $(featuresBar).find('.feature-description').children('span');
  
  var ldButton = ldValueNode.find("button").removeClass("feature-action-icon");
  
  var ldHelp = ldTextNode.find("a").addClass("c-icon fs-xs");
  var ldValue = ldValueNode.find("span:first").text();
    
  var newGamePlayItem = gameplayBar.children('li:first').clone();
  
  ldButton.append(ldTextNode.text());
  ldButton.removeClass().addClass('btn btn-xs btn-link');
  ldButton.children('span').addClass('c-icon hidden-xs');
  
  var ldSubNewContainer = ldValueNode.children('span').first().empty().append(ldButton);
  
  //bind click event to original source (they source is changed)
  ldSubNewContainer.on('click', function() {
	clickEventForwarderDest.trigger('click');
  })  
  
  newGamePlayItem.children('.gameplay-item-primary').empty().text(ldValue);
  newGamePlayItem.children('.gameplay-item-secondary').empty().append(ldSubNewContainer).append(ldHelp);
  
  angular.bootstrap(newGamePlayItem, ['ui.bootstrap']);
  
  gameplayBar.append(newGamePlayItem);


});