Wowhead Items TSM

Easy TSM Import from Wowhead Item Lists, edited by boail. Original: https://gist.github.com/BobuSumisu/d5a3fccbd4f6ddbc2817

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Wowhead Items TSM
// @namespace    boail
// @version      1.0a
// @description  Easy TSM Import from Wowhead Item Lists, edited by boail. Original: https://gist.github.com/BobuSumisu/d5a3fccbd4f6ddbc2817
// @author       Øyvind Ingvaldsen <[email protected]>
// @match        http://*.wowhead.com/*
// @match        https://*.wowhead.com/*
// @grant        none
// ==/UserScript==

function getIds(getAll) {
  var ids = [];
  for (var x = 0, item; item = g_listviews.items.data[x]; x++) {
  	if (getAll || (item.hasOwnProperty('__tr') && item.__tr.className.indexOf('checked') >= 0)) {
  	  ids.push('i:' + item.id);
  	}
  }
  
  return ids;
}

function main() {
  var $btnSelected = $('<input type="button" value="TSMI Selected" style="background-color:#628a2c !important;">').on('click', function () {    
    $outTxt.text(getIds(false));
    $outDiv.show();
  });
  
  var $btnAll = $('<input type="button" value="TSMI All" style="background-color:#628a2c !important;">').on('click', function () {
    $outTxt.text(getIds(true));
    $outDiv.show();
  });
  
  var $nav = $('div.listview-band-top > div.listview-withselected');
  $nav.append($btnSelected);
  $nav.append($btnAll);
  
  var $outDiv = $('<div style="display:none; margin: 20px;"></div>');
  var $outTxt = $('<textarea style="box-sizing: border-box; height:100px; width:100%;"></textarea>').appendTo($outDiv);
  var $refresh = $('<div style="float:left">Click the button again to refresh</div>').appendTo($outDiv);
  var $closeOut = $('<input type="button" value="Close TSMI" style="float:right; background-color:#628a2c; margin:5px;">').appendTo($outDiv).on('click', function () {
    $outDiv.hide();
  });
  
  $outDiv.appendTo('#lv-items > div.listview-band-top');
  $outDiv.appendTo('#tab-items > div.listview-band-top');
}

setTimeout(main, 250);