eNameX

易名价格醒目脚本,防大佬标错价,防米农秒错米。坑同行的木有小JJ!

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         eNameX
// @namespace    http://xiami.im/
// @version      0.1
// @description  易名价格醒目脚本,防大佬标错价,防米农秒错米。坑同行的木有小JJ!
// @author       xiami.im
// @require      http://cdn.staticfile.org/jquery/1.8.3/jquery.min.js
// @include      http://*.ename.com/*
// @exclude      http://*.ename.com/*inquiry*
// @exclude      http://*.ename.com/book/expired*
// @grant        none
// ==/UserScript==
//Sell domains
$(document).ready(function () {
  //Add commas to the prices
  function addComma(num) {
    num = num.toString().split('').reverse().join('').replace(/(\d{3})/g, '$1,').replace(/\,$/, '').split('').reverse().join('');
    return num;
  }
  //Farmatting the prices

  function formatPrice(priceNum) {
    var priceLen = priceNum.toString().length;
    if (priceLen > 4) {
      var tt = parseInt(priceNum) / 10000;
      var t3 = tt.toPrecision(3);
      var t4 = tt.toPrecision(4);
      if (priceLen > 8) {
        tip = (parseInt(priceNum.substr(3, priceLen - 3)) ? '~' : '') + parseFloat((tt / 10000).toPrecision(3)) + ' 亿';
      } else {
        tip = (parseInt(priceNum.substr(3, priceLen - 3)) ? '~' : '') + ((priceLen == 8) ? addComma(t4)  : parseFloat(t3)) + ' 万';
      }
    } else {
      tip = addComma(priceNum);
    }
    return tip;
  }
  //Replace default character with price dom

  $('table.site_com_table tr:gt(0)').each(function () {
    var priceTd = $(this).children('td:eq(3)');
    priceTd.html(priceTd.html().replace('元', ''));
    priceTd.append('<span class=priceStand></span>');
    priceTd.children('.priceStand').css({
      color: 'red',
      'letter-spacing': '1px'
    });
  });
  //Keyup listener
  $('table.site_com_table tr:gt(0)').each(function () {
    var priceTd = $(this).children('td:eq(3)');
    priceTd.children('input').keyup(function () {
      var priceNum = priceTd.children('input').val();
      formatPrice(priceNum);
      priceTd.children('.priceStand').text('¥' + tip);
    });
    //Bat Keyup listener
    var priceBat = $('table.site_com_table tr:eq(1)').children('td:eq(3)');
    priceBat.children('input').keyup(function () {
      var priceNum = priceBat.children('input').val();
      formatPrice(priceNum);
      $('table.site_com_table tr:gt(0)').each(function () {
        $(this).children('td:eq(3)').children('.priceStand').text('¥' + tip);
      });
    });
  });
  //Buy domains
  $('.bid_domain').append('<span class="priceTip"></span>');
  var priceValue = formatPrice($('#askingPrice').text());
  if ($('#askingPrice').text() == '1') {
    $('.priceTip').text('1元拍');
  } else {
    $('.priceTip').text('¥' + priceValue);
  }
  $('.priceTip').css({
    color: 'red'
  });
  $('table.com_table tr:gt(0)').each(function () {
    if ($(this).children('td:eq(7)').length > 0) {
      var priceList = $(this).children('td:eq(5)');
    } else if ($(this).children('td:eq(6)').length > 0) {
      priceList = $(this).children('td:eq(4)');
    }
    priceList.text('¥' + formatPrice(priceList.text().replace('元', ''))).css({
      color: 'red'
    });
  });
});