iconfont_iOS

icon font unicode for iOS

  1. // ==UserScript==
  2. // @name iconfont_iOS
  3. // @description icon font unicode for iOS
  4. // @namespace https://github.com/chenshengzhi
  5. // @include *www.iconfont.cn/*
  6. // @version 0.0.1
  7. // @require http://cdn.staticfile.org/jquery/2.1.1/jquery.min.js
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. var btn = document.createElement("input");
  12. btn.type = "button";
  13. btn.value = "iOS";
  14. btn.style.position = 'fixed';
  15. var top = '30px';
  16. btn.style.top = top;
  17. btn.style.right = '30px';
  18. btn.style.width = '60px';
  19. btn.style.height = '60px';
  20. btn.style.backgroundColor = '#208F72';
  21. btn.style.borderStyle = 'none';
  22. btn.style.borderRadius = '30px';
  23. btn.style.color = 'white';
  24. btn.style.fontSize = '16px';
  25. btn.onclick = function (){
  26. var lists = $("ul.font-lists").children("li").children(".unicode");
  27. lists.each(function(){
  28. var normalUnicode = $(this).html().replace("&", '&');
  29. console.log(normalUnicode);
  30. var index = normalUnicode.indexOf("#x") + 2;
  31. var temp = normalUnicode.substr(index);
  32. temp = temp.substr(0, temp.length-1);
  33. for (var i = temp.length; i < 8; i = temp.length) {
  34. temp = '0' + temp;
  35. }
  36. var newUnicode = "\\U" + temp;
  37. console.log(newUnicode);
  38. $(this).html(newUnicode);
  39. });
  40.  
  41. var lists = $("ul.font-lists").children("li");
  42. lists.each(function(){
  43. var unicode = $(this).children(".unicode").html();
  44. $(this).children(".name").attr("data-clipboard-text", unicode);
  45. });
  46. };
  47. document.body.appendChild(btn);