Greasy Fork镜像 支持简体中文。

WME Copy Venue Attributes

Copy and paste Venue's attributes

目前為 2019-03-07 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name WME Copy Venue Attributes
  3. // @namespace none
  4. // @description Copy and paste Venue's attributes
  5. // @include https://www.waze.com/editor*
  6. // @include https://www.waze.com/*/editor*
  7. // @include https://beta.waze.com/editor*
  8. // @include https://beta.waze.com/*/editor*
  9. // @exclude https://www.waze.com/*user/editor/*
  10. // @version 0.1
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16. var PoiAttr={}
  17. function init(){
  18. console.log("Copy Venue Attributes: INIT");
  19. var editpanel = $('#edit-panel');
  20. if (editpanel.length==0) { window.setTimeout(init, 1000); return; }
  21.  
  22. $('#edit-panel').bind('DOMSubtreeModified',function(e){
  23. var editLM = $('.geometry-button-region');
  24. console.log("Copy Venue Attributes: editLM" , editLM.length);
  25. if (editLM.length==1) {
  26. var copyattribDiv = $('#wme-copyattrib-fr');
  27. if (copyattribDiv.length==0) {
  28. copyattribDiv=document.createElement('div');
  29. copyattribDiv.id='wme-copyattrib-fr';
  30. $(copyattribDiv).css({'float':'right','padding':'2px','border-radius':'5px','background-color':'#fff','box-shadow':'rgba(0, 0, 0, 0.1) 0px 1px 6px 0px'});
  31. editLM[0].parentNode.insertBefore(copyattribDiv, editLM[0].nextSibling);
  32.  
  33. var copyBtn=document.createElement('span');
  34. copyBtn.innerHTML='<i class="fa fa-copy" data-original-title="" title="Copy attributes"></i>';
  35. copyBtn.style.margin='0 3px';
  36. copyBtn.onclick=CopyAttrib;
  37. copyattribDiv.appendChild(copyBtn);
  38.  
  39. var pasteBtn=document.createElement('span');
  40. pasteBtn.innerHTML='<i class="fa fa-paste" data-original-title="" title="Paste attributes"></i>';
  41. pasteBtn.style.margin='0 3px';
  42. pasteBtn.onclick=PasteAttrib;
  43. copyattribDiv.appendChild(pasteBtn);
  44. }
  45. }
  46.  
  47. })
  48. }
  49. function CopyAttrib(){
  50. $('#wme-copyattrib-fr')[0].style.backgroundColor='#0a0';
  51. var venue=W.selectionManager.getSelectedFeatures()[0].model.attributes;
  52. PoiAttr.aliases=venue.aliases;
  53. PoiAttr.brand=venue.brand;
  54. PoiAttr.categories=venue.categories;
  55. PoiAttr.categoryAttributes=venue.categoryAttributes;
  56. PoiAttr.description=venue.description;
  57. PoiAttr.name=venue.name;
  58. PoiAttr.openingHours=venue.openingHours;
  59. PoiAttr.phone=venue.phone;
  60. PoiAttr.services=venue.services;
  61. PoiAttr.url=venue.url
  62. console.log(PoiAttr);
  63. setTimeout(function () { $('#wme-copyattrib-fr')[0].style.backgroundColor='#fff'; }, 1000);
  64. }
  65. function PasteAttrib(){
  66. try {
  67. $('#wme-copyattrib-fr')[0].style.backgroundColor='#26bae8';
  68. var venue=W.selectionManager.getSelectedFeatures()[0].model;
  69. W.model.actionManager.add(new (require("Waze/Action/UpdateObject"))(venue, PoiAttr));
  70. setTimeout(function () { $('#wme-copyattrib-fr')[0].style.backgroundColor='#fff'; }, 1000);
  71. }
  72. catch (err) {
  73. console.log("Copy Venue Attributes : Problem", err);
  74. }
  75. }
  76. setTimeout(init, 200);
  77. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址