eNameX

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

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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'
    });
  });
});