WME URComments wiki

This script is for Bogota`s wiki comments to be used with script URComments

当前为 2016-09-22 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name WME URComments wiki
  3. // @description This script is for Bogota`s wiki comments to be used with script URComments
  4. // @namespace 12345@gmail.com
  5. // @grant none
  6. // @grant GM_info
  7. // @version 1.7.1.1
  8. // @match https://editor-beta.waze.com/*editor/*
  9. // @match https://beta.waze.com/*editor/*
  10. // @match https://www.waze.com/*editor/*
  11. // @author 12345
  12. // @license MIT/BSD/X11
  13. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAwCAYAAACFUvPfAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NTc3MiwgMjAxNC8wMS8xMy0xOTo0NDowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTQgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjQyQjZDNjdEODYzODExRTRBRDY0Q0I2QjA1MjU4N0EyIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjQyQjZDNjdFODYzODExRTRBRDY0Q0I2QjA1MjU4N0EyIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NDJCNkM2N0I4NjM4MTFFNEFENjRDQjZCMDUyNTg3QTIiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NDJCNkM2N0M4NjM4MTFFNEFENjRDQjZCMDUyNTg3QTIiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6++Bk8AAANOElEQVR42tRZ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
  14. // ==/UserScript==
  15. //URO+ in order for the URO pop up not to be over the ur pin change the URO+ script find all 4 uroPopupX = markerXY.x + popupXOffset; and change it to uroPopupX = markerXY.x + popupXOffset + 40;
  16. //to make this script find open URs faster change the number 1000 to something smaller this is in milliseconds 1000 = 1 second
  17. //line 892 it looks like this setTimeout(URComments.LookForOpenedUR, 1000); // 1 second search
  18. //line 892 it looks like this setTimeout(URComments.LookForOpenedUR, 500); // .5 second search
  19. var URCommentVersion = GM_info.script.version;//var URCommentVersion = "1.5.4"; //branched from 0.9.3
  20. var URCommentUpdateMessage = "yes"; // yes alert the user, no has a silent update.
  21.  
  22. /* Changelog
  23. The change log has been moved to https://docs.google.com/spreadsheets/d/1PM4bOYGJxL82E4th2yy87ZzQKpMDF4N1dcKZ2evXc5o/edit?usp=sharing
  24. This sheet will now be used to also track editor requests, to add a request please pm me on waze at rickzabel
  25. */
  26.  
  27. //here is my todo; remove ur count, instruction link in new window
  28.  
  29. var URCommentVersionUpdateNotes = "UR Comments has been updated to " + URCommentVersion;
  30. URCommentVersionUpdateNotes = URCommentVersionUpdateNotes + "\n" + "Added DominicanSpanish to the list";
  31.  
  32. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  33. //////
  34. ////// Define items that need to be at the root level so they can be used inside functions
  35. //////
  36. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  37.  
  38. //use this for counting how many times we waited for waze to finish a task..
  39. //currently used to write to the console so the code is easier to debug
  40. //in the future we might do actions if we waited to long
  41. var PauseCount = "1";
  42.  
  43. //these are the names of the comments lists built into the script and will show up in the comment list drop down
  44. var BoilerPlateCreatorsArray = [
  45. "CommentTeam",
  46. "Custom",
  47.  
  48. //"orbit" //https://greasyfork.org/en/users/8079-orbit
  49.  
  50. ];
  51.  
  52. //get the SelectedBoilerPlateCreator
  53. var SelectedBoilerPlateCreator = localStorage.getItem('BoilerPlateCreators');
  54. //console.log( SelectedBoilerPlateCreator);
  55.  
  56. //if the comment list hasn't been chosen default to the CommentTeam's list
  57. if (SelectedBoilerPlateCreator === "" || SelectedBoilerPlateCreator === null || SelectedBoilerPlateCreator === "rickzabel") {
  58. SelectedBoilerPlateCreator = "CommentTeam";
  59. localStorage.setItem('BoilerPlateCreators', SelectedBoilerPlateCreator);
  60. //localStorage.setItem('BoilerPlateCreators', 'CommentTeam');
  61. }
  62.  
  63. //array that holds the comments
  64. var URCommentsArray = [];
  65.  
  66. //these are the holders for the position in the comments list that the reminder and close messages are at
  67. var ReminderPosistion = "";
  68. var CloseNotIdentifiedPosistion = "";
  69.  
  70.  
  71. var def_names = []; //default waze message array
  72. var URC_Text = []; //URC text
  73. var URC_URL = []; //URC text
  74. var URC_Text_tooltip = []; //URC tool-tip text
  75. var URC_USER_PROMPT = []; //URC Alerts, Confirmations, and orange box messages
  76.  
  77. //waze swaps out the close button on the UR window after you click send. we use this to grab the close and compare to the new one
  78. var CloseButtonHolder = "";
  79. //since we are scanning for open UR I need to keep track of the current urID so the comments can be overridden
  80. var UrCommentLasturID = "";
  81.  
  82. //this is used to hold the info about the previous tab, before we auto switched tabs
  83. var PreviousTab = null;
  84. var PreviousTabPosistion = null;
  85.  
  86.  
  87. //used to track if we are switching languages
  88. var ChangeLanguage = false;
  89.  
  90. //return to zoom instead of zoom 0
  91. var ReturnToCurrentZoom = "";
  92.  
  93. var UrCommentsIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAwCAYAAACFUvPfAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NTc3MiwgMjAxNC8wMS8xMy0xOTo0NDowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTQgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjQyQjZDNjdEODYzODExRTRBRDY0Q0I2QjA1MjU4N0EyIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjQyQjZDNjdFODYzODExRTRBRDY0Q0I2QjA1MjU4N0EyIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NDJCNkM2N0I4NjM4MTFFNEFENjRDQjZCMDUyNTg3QTIiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NDJCNkM2N0M4NjM4MTFFNEFENjRDQjZCMDUyNTg3QTIiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6++Bk8AAANOElEQVR42tRZ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";
  94.  
  95. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  96. //////
  97. ////// bootstrap
  98. //////
  99. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  100.  
  101.  
  102. function urcToConsole(logtext) {
  103. //console.log('URComments: '+logtext);
  104. }
  105.  
  106. //setup keyboard shortcut's header and add a keyboard shortcuts
  107. function WMEKSRegisterKeyboardShortcut(ScriptName, ShortcutsHeader, NewShortcut, ShortcutDescription, FunctionToCall, ShortcutKeysObj) {
  108. //check for and add keyboard shourt group to WME
  109. try {
  110. var x = I18n.translations.en.keyboard_shortcuts.groups[ScriptName].members.length;
  111. } catch (e) {
  112. //setup keyboard shortcut's header
  113. Waze.accelerators.Groups[ScriptName] = []; //setup your shortcut group
  114. Waze.accelerators.Groups[ScriptName].members = []; //set up the members of your group
  115. I18n.translations.en.keyboard_shortcuts.groups[ScriptName] = []; //setup the shortcuts text
  116. I18n.translations.en.keyboard_shortcuts.groups[ScriptName].description = ShortcutsHeader; //Scripts header
  117. I18n.translations.en.keyboard_shortcuts.groups[ScriptName].members = []; //setup the shortcuts text
  118. }
  119. //check if the function we plan on calling exists
  120. if (FunctionToCall && (typeof FunctionToCall == "function")) {
  121. I18n.translations.en.keyboard_shortcuts.groups[ScriptName].members[NewShortcut] = ShortcutDescription; //shortcut's text
  122. Waze.accelerators.addAction(NewShortcut, {
  123. group: ScriptName
  124. }); //add shortcut one to the group
  125. //clear the short cut other wise the previous shortcut will be reset MWE seems to keep it stored
  126. var ClearShortcut = '-1';
  127. var ShortcutRegisterObj = {};
  128. ShortcutRegisterObj[ClearShortcut] = NewShortcut;
  129. Waze.accelerators._registerShortcuts(ShortcutRegisterObj);
  130.  
  131. if (ShortcutKeysObj !== null) {
  132. //add the new shortcut
  133. ShortcutRegisterObj = {};
  134. ShortcutRegisterObj[ShortcutKeysObj] = NewShortcut;
  135. Waze.accelerators._registerShortcuts(ShortcutRegisterObj);
  136. }
  137. //listen for the shortcut to happen and run a function
  138. W.accelerators.events.register(NewShortcut, null, function() {
  139. FunctionToCall();
  140. });
  141. } else {
  142. alert('The function ' + FunctionToCall + ' has not been declared');
  143. }
  144.  
  145. }
  146.  
  147. //if saved load and set the shortcuts
  148. function WMEKSLoadKeyboardShortcuts(ScriptName) {
  149. if (localStorage[ScriptName + 'KBS']) {
  150. var LoadedKBS = JSON.parse(localStorage[ScriptName + 'KBS']); //JSON.parse(localStorage['WMEAwesomeKBS']);
  151. for (var i = 0; i < LoadedKBS.length; i++) {
  152. Waze.accelerators._registerShortcuts(LoadedKBS[i]);
  153. }
  154. }
  155. }
  156.  
  157. function WMEKSSaveKeyboardShortcuts(ScriptName) {
  158. //return function() {
  159. var TempToSave = [];
  160. for (var name in Waze.accelerators.Actions) {
  161. //console.log(name);
  162. var TempKeys = "";
  163. if (Waze.accelerators.Actions[name].group == ScriptName) {
  164. if (Waze.accelerators.Actions[name].shortcut) {
  165. if (Waze.accelerators.Actions[name].shortcut.altKey === true) {
  166. TempKeys += 'A';
  167. }
  168. if (Waze.accelerators.Actions[name].shortcut.shiftKey === true) {
  169. TempKeys += 'S';
  170. }
  171. if (Waze.accelerators.Actions[name].shortcut.ctrlKey === true) {
  172. TempKeys += 'C';
  173. }
  174. if (TempKeys !== "") {
  175. TempKeys += '+';
  176. }
  177. if (Waze.accelerators.Actions[name].shortcut.keyCode) {
  178. TempKeys += Waze.accelerators.Actions[name].shortcut.keyCode;
  179. }
  180. } else {
  181. TempKeys = "-1";
  182. }
  183. var ShortcutRegisterObj = {};
  184. ShortcutRegisterObj[TempKeys] = Waze.accelerators.Actions[name].id;
  185. TempToSave[TempToSave.length] = ShortcutRegisterObj;
  186. }
  187. }
  188. localStorage[ScriptName + 'KBS'] = JSON.stringify(TempToSave);
  189. //}
  190. }
  191.  
  192. //now we use this to load the arrays, but we wait till the me tab &loads, this gives the custom comments file a chance to also load
  193. function URComments_bootstrap() {
  194. //urcToConsole("Test");
  195. //get the SelectedBoilerPlateCreator
  196. var SelectedBoilerPlateCreator = localStorage.getItem('BoilerPlateCreators');
  197.  
  198. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  199. // these is the array used to store the ur comments
  200. // comment arrays should follow the format
  201. // "Title", * is what will show up in the ur comment tab
  202. // "comment", * is the comment that will be sent to the user currently
  203. // "URStatus" * this is action to take when the option "Auto Click Open, Solved, Not Identified" is on.
  204. // after clicking send it will click one of those choices. usage is. "Open", or "Solved",or "NotIdentified",
  205. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  206.  
  207. if (SelectedBoilerPlateCreator === "CommentTeam") {
  208.  
  209. URCommentsArray = [
  210. "Resuelto",
  211. "Gracias por el Reporte, el problema fue solucionado y se verá reflejado en la Aplicación de 48 a 72 horas. Síguenos en @Waze_Bog, Saludos",
  212. "Solved",
  213.  
  214. "Más Información",
  215. "Hola Wazer, ¿Puede darnos más detalles?, para así solucionar el error reportado. Gracias",
  216. "Open",
  217.  
  218. "No Identificado",
  219. "Lamentablemente no pudimos solucionar el error en esta ocasión. Por favor, déjenos más datos la próxima vez. Gracias",
  220. "NotIdentified",
  221.  
  222. "Límite Erróneo",
  223. "Gracias por su reporte, por favor reportar solamente los límites de velocidad señalizados en la vía. Juntos hacemos el tráfico más inteligente. Saludos",
  224. "NotIdentified",
  225. " Límite Resuelto",
  226. "Se corrigió el límite de velocidad, gracias por su reporte e interés por mejorar Waze.",
  227. "Solved",
  228.  
  229. ];
  230.  
  231. //auto insertion config:
  232. //the position in the list that the reminder message is at. (counting titles, comments, and ur status)
  233. ReminderPosistion = 24;
  234.  
  235. //the position of the close as Not Identified message that you have in the list (the first comment is the list is 0)
  236. CloseNotIdentifiedPosistion = 27;
  237.  
  238. //Waze's default URs number to name conversion array
  239. //Thanks to SuperMedic
  240.  
  241. def_names[6] = "Incorrect turn";
  242. def_names[7] = "Incorrect address";
  243. def_names[8] = "Incorrect route";
  244. def_names[9] = "Missing roundabout";
  245. def_names[10] = "General error";
  246. def_names[11] = "Turn not allowed";
  247. def_names[12] = "Incorrect junction";
  248. def_names[13] = "Missing bridge overpass";
  249. def_names[14] = "Wrong driving direction";
  250. def_names[15] = "Missing Exit";
  251. def_names[16] = "Missing Road";
  252. def_names[18] = "Missing Landmark";
  253. def_names[19] = "Blocked Road";
  254. def_names[21] = "Missing Street Name";
  255. def_names[22] = "Incorrect Street Prefix or Suffix";
  256. def_names[23] = "Speed Limit"; //speed limit ur type is number 23
  257.  
  258. //zoom out links
  259. URC_Text[0] = "Zoom Out 0 & Close UR";
  260. URC_Text_tooltip[0] = "Zooms all the way out and closes the UR window";
  261.  
  262. URC_Text[1] = "Zoom Out 2 & Close UR";
  263. URC_Text_tooltip[1] = "Zooms out to level 2 and closes the UR window (this is where I found most of the toolbox highlighting works)";
  264.  
  265. URC_Text[2] = "Zoom Out 3 & Close UR";
  266. URC_Text_tooltip[2] = "Zooms out to level 3 and closes the UR window (this is where I found most of the toolbox highlighting works)";
  267.  
  268. URC_Text_tooltip[3] = "Reload the map";
  269.  
  270. URC_Text_tooltip[4] = "Number of URs Shown on screen";
  271.  
  272. //tab names
  273. URC_Text[5] = "Comments";
  274. URC_Text[6] = "UR Filtering";
  275. URC_Text[7] = "Settings";
  276.  
  277. //UR Filtering Tab
  278. URC_Text[8] = "Click here for Instructions";
  279. URC_Text_tooltip[8] = "Instructions for UR filtering";
  280. URC_URL[8] = "https://docs.google.com/presentation/d/1zwdKAejRbnkUll5YBfFNrlI2I3Owmb5XDIbRAf47TVU/";
  281.  
  282. URC_Text[9] = "Enable URComments UR filtering";
  283. URC_Text_tooltip[9] = "Enable or disable URComments filtering";
  284.  
  285. URC_Text[10] = "Enable UR pill counts";
  286. URC_Text_tooltip[10] = "Enable or disable the pill with UR counts";
  287.  
  288. URC_Text[12] = "Hide Waiting";
  289. URC_Text_tooltip[12] = "Only show URs that need work (hide in-between states)";
  290.  
  291. URC_Text[13] = "Only show my URs";
  292. //URC_Text_tooltip[13] = "Hide UR where there are zero comments from the logged in editor";
  293. URC_Text_tooltip[13] = "Hide URs where you have no comments";
  294.  
  295. URC_Text[14] = "Show others URs past reminder + close";
  296. URC_Text_tooltip[14] = "Show URs that other commented on that have gone past the reminder and close day settings added together";
  297.  
  298. URC_Text[15] = "Hide URs Reminder needed";
  299. URC_Text_tooltip[15] = "Hide URs where reminders are needed";
  300.  
  301. URC_Text[16] = "Hide URs user replies";
  302. URC_Text_tooltip[16] = "Hide UR with user replies";
  303.  
  304. URC_Text[17] = "Hide URs close needed";
  305. URC_Text_tooltip[17] = "Hide URs that need closing";
  306.  
  307. URC_Text[18] = "Hide URs no comments";
  308. URC_Text_tooltip[18] = "Hide URs that have zero comments";
  309.  
  310. URC_Text[19] = "hide 0 comments without descriptions";
  311. URC_Text_tooltip[19] = "Hide URs that do not have descriptions or comments";
  312.  
  313. URC_Text[20] = "hide 0 comments with descriptions";
  314. URC_Text_tooltip[20] = "Hide URs that have descriptions and zero comments";
  315.  
  316. URC_Text[21] = "Hide Closed URs";
  317. URC_Text_tooltip[21] = "Hide closed URs";
  318.  
  319. URC_Text[22] = "Hide Tagged URs";
  320. URC_Text_tooltip[22] = "Hide URs that are tagged with URO+ style tags ex. [NOTE]";
  321.  
  322. URC_Text[23] = "Reminder days: ";
  323. //URC_Text_tooltip[23] = "";
  324.  
  325. URC_Text[24] = "Close days: ";
  326. //URC_Text_tooltip[] = "";
  327.  
  328. //settings tab
  329. URC_Text[25] = "Auto set new UR comment";
  330. URC_Text_tooltip[25] = "Auto set the UR comment on new URs that do not already have comments";
  331.  
  332. URC_Text[26] = "Auto set reminder UR comment";
  333. URC_Text_tooltip[26] = "Auto set the UR reminder comment for URs that are older than reminder days setting and have only one comment";
  334.  
  335. URC_Text[27] = "Auto zoom in on new UR";
  336. URC_Text_tooltip[27] = "Auto zoom in when opening URs with no comments and when sending UR reminders";
  337.  
  338. URC_Text[28] = "Auto center on UR";
  339. URC_Text_tooltip[28] = "Auto Center the map at the current map zoom when UR has comments and the zoom is less than 3";
  340.  
  341. URC_Text[29] = "Auto click open, solved, not identified";
  342. URC_Text_tooltip[29] = "Suppress the message about recent pending questions to the reporter and then depending on the choice set for that comment Clicks Open, Solved, Not Identified";
  343.  
  344. URC_Text[30] = "Auto save after a solved or not identified comment";
  345. URC_Text_tooltip[30] = "If Auto Click Open, Solved, Not Identified is also checked, this option will click the save button after clicking on a UR-Comment and then the send button";
  346.  
  347. URC_Text[31] = "Auto close comment window";
  348. URC_Text_tooltip[31] = "For the user requests that do not require saving this will close the user request after clicking on a UR-Comment and then the send button";
  349.  
  350. URC_Text[32] = "Auto reload map after comment";
  351. URC_Text_tooltip[32] = "Reloads the map after clicking on a UR-Comment and then send button. This does not apply to any messages that needs to be saved, since saving automatically reloads the map. Currently this is not needed but I am leaving it in encase Waze makes changes";
  352.  
  353. URC_Text[33] = "Auto zoom out after comment";
  354. URC_Text_tooltip[33] = "After clicking on a UR-Comment in the list and clicking send on the UR the map zoom will be set back to your previous zoom";
  355.  
  356. URC_Text[34] = "Auto switch to the UrComments tab";
  357. URC_Text_tooltip[34] = "Auto switch to the URComments tab when opening a UR, when the UR window is closed you will be switched to your previous tab";
  358.  
  359. URC_Text[35] = "Close message - double click link (auto send)";
  360. URC_Text_tooltip[35] = "Add an extra link to the close comment when double clicked will auto send the comment to the UR windows and click send, and then will launch all of the other options that are enabled";
  361.  
  362. URC_Text[36] = "All comments - double click link (auto send)";
  363. URC_Text_tooltip[36] = "Add an extra link to each comment in the list that when double clicked will auto send the comment to the UR windows and click send, and then will launch all of the other options that are enabled";
  364.  
  365. URC_Text[37] = "Comment List";
  366. URC_Text_tooltip[37] = "This shows the selected comment list. There is support for a custom list. If you would like your comment list built into this script or have suggestions on the Comments team’s list, please contact me at rickzabel @waze or @gmail";
  367.  
  368. URC_Text[38] = "Disable done / next buttons";
  369. URC_Text_tooltip[38] = "Disable the done / next buttons at the bottom of the new UR window";
  370.  
  371. URC_Text[39] = "Unfollow UR after send";
  372. URC_Text_tooltip[39] = "Unfollow UR after sending comment";
  373.  
  374. URC_Text[40] = "Auto send reminders";
  375. URC_Text_tooltip[40] = "Auto send reminders to my UR as they are on screen";
  376.  
  377. URC_Text[41] = "Replace tag name with editor name";
  378. URC_Text_tooltip[41] = "When a UR has the logged in editors name in the description or any of the comments of the UR (not the name Waze automatically adds when commenting) replace the tag type with the editors name";
  379.  
  380. URC_Text[42] = "(Double Click)"; //double click to close links
  381. URC_Text_tooltip[42] = "Double click here to auto send - ";
  382.  
  383. URC_Text[43] = "Dont show tag name on pill";
  384. URC_Text_tooltip[43] = "Dont show tag name on pill where there is a URO tag";
  385.  
  386. URC_USER_PROMPT[0] = "URComments - You either have a older version of the custom comments file or a syntax error either will keep the custom list from loading. Missing: ";
  387.  
  388. URC_USER_PROMPT[1] = "URComments - You are missing the following items from your custom comment list: ";
  389.  
  390. URC_USER_PROMPT[2] = "List can not be found. You can find the list and instructions at https://wiki.waze.com/wiki/User:Rickzabel/UrComments/";
  391.  
  392. URC_USER_PROMPT[3] = "URComments you can not set close days to zero";
  393.  
  394. URC_USER_PROMPT[4] = "URComments - To use the double click links you must have the Auto click open, solved, not identified option enabled";
  395.  
  396. URC_USER_PROMPT[5] = "URComments - Aborting FilterURs2 because both filtering, counts, and auto reminders are disabled";
  397.  
  398. URC_USER_PROMPT[6] = "URComments: Loading UR data has timed out, retrying."; //this message is shown across the top of the map in a orange box, length must be kept short
  399.  
  400. URC_USER_PROMPT[7] = "URComments: Adding reminder message to UR: "; //this message is shown across the top of the map in a orange box, length must be kept short
  401.  
  402. URC_USER_PROMPT[8] = "URComment's UR Filtering has been disabled because URO+\'s UR filters are active."; //this message is shown across the top of the map in a orange box, length must be kept short
  403.  
  404. URC_USER_PROMPT[9] = "UrComments has detected that you have unsaved edits!\n\nWith the Auto Save option enabled and with unsaved edits you cannot send comments that would require the script to save. Please save your edits and then re-click the comment you wish to send.";
  405.  
  406. URC_USER_PROMPT[10] = "URComments: Can not find the comment box! In order for this script to work you need to have a UR open."; //this message is shown across the top of the map in a orange box, length must be kept short
  407.  
  408. URC_USER_PROMPT[11] = "URComments - This will send reminders at the reminder days setting. This only happens when they are visible on your screen. NOTE: when using this feature you should not leave any UR open unless you had a question that needed an answer from the wazer as this script will send those reminders."; //conformation message/ question
  409.  
  410. //end CommentTeam's list
  411.  
  412. //custom other languages lists from external list
  413. } else {
  414.  
  415. try {
  416.  
  417. var CustomListError = false;
  418. var CustomErrorListText = "";
  419. var CustomErrorListCount = 0;
  420. //custom list
  421. URCommentsArray = eval("window.Urcomments" + SelectedBoilerPlateCreator + "Array2");
  422.  
  423. //the position in the list that the reminder message is at. (starting at 0 counting titles, comments, and ur status)
  424. ReminderPosistion = eval("window.Urcomments" + SelectedBoilerPlateCreator + "ReminderPosistion");
  425.  
  426. //the position of the close as Not Identified message (starting at 0 counting titles, comments, and ur status)
  427. CloseNotIdentifiedPosistion = eval("window.Urcomments" + SelectedBoilerPlateCreator + "CloseNotIdentifiedPosistion");
  428.  
  429. //copy the waze default titles into the active ?
  430. //Waze's default URs number to name conversion array
  431. //Thanks to SuperMedic
  432.  
  433. def_names[6] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "def_names[6]"); //"Incorrect turn";
  434. def_names[7] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "def_names[7]"); //"Incorrect address";
  435. def_names[8] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "def_names[8]"); //"Incorrect route";
  436. def_names[9] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "def_names[9]"); //"Missing roundabout";
  437. def_names[10] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "def_names[10]"); //"General error";
  438. def_names[11] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "def_names[11]"); //"Turn not allowed";
  439. def_names[12] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "def_names[12]"); //"Incorrect junction";
  440. def_names[13] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "def_names[13]"); //"Missing bridge overpass";
  441. def_names[14] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "def_names[14]"); //"Wrong driving direction";
  442. def_names[15] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "def_names[15]"); //"Missing Exit";
  443. def_names[16] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "def_names[16]"); //"Missing Road";
  444. def_names[18] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "def_names[18]"); //"Missing Landmark";
  445. def_names[19] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "def_names[19]"); //"Blocked Road";
  446. def_names[21] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "def_names[21]"); //"Missing Street Name";
  447. def_names[22] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "def_names[22]"); //"Incorrect Street Prefix or Suffix";
  448. def_names[23] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "def_names[23]"); //"Speed limits";
  449.  
  450.  
  451. //try {
  452. URC_Text[0] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[0]");
  453. URC_Text_tooltip[0] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[0]");
  454.  
  455. URC_Text[1] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[1]");
  456. URC_Text_tooltip[1] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[1]");
  457.  
  458. URC_Text[2] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[2]");
  459. URC_Text_tooltip[2] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[2]");
  460.  
  461. URC_Text[3] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[3]");
  462. URC_Text_tooltip[3] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[3]");
  463.  
  464. URC_Text[4] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[4]");
  465. URC_Text_tooltip[4] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[4]");
  466.  
  467. URC_Text[5] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[5]");
  468. URC_Text_tooltip[5] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[5]");
  469.  
  470. URC_Text[6] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[6]");
  471. URC_Text_tooltip[6] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[6]");
  472.  
  473. URC_Text[7] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[7]");
  474. URC_Text_tooltip[7] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[7]");
  475.  
  476. URC_Text[8] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[8]");
  477. URC_Text_tooltip[8] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[8]");
  478. URC_URL[8] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_URL[8]");
  479.  
  480. URC_Text[9] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[9]");
  481. URC_Text_tooltip[9] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[9]");
  482.  
  483. URC_Text[10] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[10]");
  484. URC_Text_tooltip[10] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[10]");
  485.  
  486. URC_Text[11] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[11]");
  487. URC_Text_tooltip[11] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[11]");
  488.  
  489. URC_Text[12] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[12]");
  490. URC_Text_tooltip[12] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[12]");
  491.  
  492. URC_Text[13] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[13]");
  493. URC_Text_tooltip[13] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[13]");
  494.  
  495. URC_Text[14] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[14]");
  496. URC_Text_tooltip[14] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[14]");
  497.  
  498. URC_Text[15] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[15]");
  499. URC_Text_tooltip[15] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[15]");
  500.  
  501. URC_Text[16] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[16]");
  502. URC_Text_tooltip[16] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[16]");
  503.  
  504. URC_Text[17] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[17]");
  505. URC_Text_tooltip[17] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[17]");
  506.  
  507. URC_Text[18] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[18]");
  508. URC_Text_tooltip[18] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[18]");
  509.  
  510. URC_Text[19] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[19]");
  511. URC_Text_tooltip[19] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[19]");
  512.  
  513. URC_Text[20] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[20]");
  514. URC_Text_tooltip[20] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[20]");
  515.  
  516. URC_Text[21] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[21]");
  517. URC_Text_tooltip[21] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[21]");
  518.  
  519. URC_Text[22] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[22]");
  520. URC_Text_tooltip[22] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[22]");
  521.  
  522. URC_Text[23] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[23]");
  523. URC_Text_tooltip[23] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[23]");
  524.  
  525. URC_Text[24] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[24]");
  526. URC_Text_tooltip[24] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[24]");
  527.  
  528. URC_Text[25] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[25]");
  529. URC_Text_tooltip[25] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[25]");
  530.  
  531. URC_Text[26] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[26]");
  532. URC_Text_tooltip[26] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[26]");
  533.  
  534. URC_Text[27] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[27]");
  535. URC_Text_tooltip[27] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[27]");
  536.  
  537. URC_Text[28] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[28]");
  538. URC_Text_tooltip[28] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[28]");
  539.  
  540. URC_Text[29] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[29]");
  541. URC_Text_tooltip[29] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[29]");
  542.  
  543. URC_Text[30] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[30]");
  544. URC_Text_tooltip[30] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[30]");
  545.  
  546. URC_Text[31] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[31]");
  547. URC_Text_tooltip[31] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[31]");
  548.  
  549. URC_Text[32] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[32]");
  550. URC_Text_tooltip[32] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[32]");
  551.  
  552. URC_Text[33] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[33]");
  553. URC_Text_tooltip[33] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[33]");
  554.  
  555. URC_Text[34] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[34]");
  556. URC_Text_tooltip[34] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[34]");
  557.  
  558. URC_Text[35] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[35]");
  559. URC_Text_tooltip[35] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[35]");
  560.  
  561. URC_Text[36] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[36]");
  562. URC_Text_tooltip[36] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[36]");
  563.  
  564. URC_Text[37] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[37]");
  565. URC_Text_tooltip[37] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[37]");
  566.  
  567. URC_Text[38] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[38]");
  568. URC_Text_tooltip[38] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[38]");
  569.  
  570. URC_Text[39] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[39]");
  571. URC_Text_tooltip[39] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[39]");
  572.  
  573. URC_Text[40] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[40]");
  574. URC_Text_tooltip[40] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[40]");
  575.  
  576. URC_Text[41] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[41]");
  577. URC_Text_tooltip[41] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[41]");
  578.  
  579. URC_Text[42] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[42]");
  580. URC_Text_tooltip[42] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[42]");
  581.  
  582. URC_Text[43] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text[43]");
  583. URC_Text_tooltip[43] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_Text_tooltip[43]");
  584.  
  585. URC_USER_PROMPT[0] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_USER_PROMPT[0]");
  586. URC_USER_PROMPT[1] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_USER_PROMPT[1]");
  587. URC_USER_PROMPT[2] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_USER_PROMPT[2]");
  588. URC_USER_PROMPT[3] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_USER_PROMPT[3]");
  589. URC_USER_PROMPT[4] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_USER_PROMPT[4]");
  590. URC_USER_PROMPT[5] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_USER_PROMPT[5]");
  591. URC_USER_PROMPT[6] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_USER_PROMPT[6]");
  592. URC_USER_PROMPT[7] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_USER_PROMPT[7]");
  593. URC_USER_PROMPT[8] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_USER_PROMPT[8]");
  594. URC_USER_PROMPT[9] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_USER_PROMPT[9]");
  595. URC_USER_PROMPT[10] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_USER_PROMPT[10]");
  596. URC_USER_PROMPT[11] = eval("window.Urcomments" + SelectedBoilerPlateCreator + "URC_USER_PROMPT[11]");
  597.  
  598.  
  599. } catch (err) {
  600. alert("URC: All of the text in URC is now configurable within the custom comments file. Your comments file " + SelectedBoilerPlateCreator + " is outdated, has errors, or your language file is not installed please back up your comments. Then force update the comments file from greasyfork and paste your comments back into the custom comments file. Since there is an error the comments team's list will be chosen.");
  601. console.log("URC: comment list error " + err);
  602. localStorage.setItem('BoilerPlateCreators', 'CommentTeam');
  603. $("#sidepanel-Comments").html('');
  604. //reload the content
  605. ChangeLanguage = true;
  606. URComments_bootstrap();
  607. return false;
  608. }
  609. }
  610. URComments_init();
  611. }
  612. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  613. //////
  614. ////// init
  615. //////
  616. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  617.  
  618. function URComments_init() {
  619. //urcToConsole("Start init 1");
  620.  
  621. //create the URComments object
  622. var URComments = {};
  623.  
  624. URComments.init = function() {
  625. //if we are changing the language do not redraw the tab
  626. if (ChangeLanguage === false) {
  627.  
  628. //CSS
  629. //expand the UR textarea so we can verfiy what comment we clicked on. special thanks to SeekingSerenity
  630. var g = '.ur-comment-list .comment-list { bottom: 200px !important; } .ur-comment-list .new-comment-form textarea { height: 140px !important; } .ur-comment-list .new-comment-form { height: 200px !important; }';
  631.  
  632. var wazeheight = $(".view-area").height();
  633. if (wazeheight > 500) {
  634. //betaeditor commetn textarea
  635. g = g + '.new-comment-form .new-comment-text { height: 140px !important; }';
  636. }
  637.  
  638. //css for items in my tab that are in a label (uro presets)
  639. g = g + '#sidepanel-Comments label { cursor:pointer; margin:0px 0px 0px; vertical-align: middle;font-size: 10px;}';
  640.  
  641. //css for checkboxes
  642. g = g + '#sidepanel-Comments .URCommentsCheckbox { text-decoration:none; cursor:pointer; color: #000000; margin:0px 0px 0px; vertical-align: middle; font-size: 12px;}';
  643.  
  644. //css for our comments,
  645. g = g + '#sidepanel-Comments .URComments { text-decoration:none; cursor:pointer; color: #000000; font-size: 12px;}'; // margin-top: 5px;
  646.  
  647. //css for our uro presets,
  648. g = g + '#sidepanel-Comments .URCommentsPresets { text-decoration:none; cursor:pointer; color: #000000; font-size: 10px;}';
  649.  
  650. //css for our nav tabs,
  651. g = g + '#comments-tab22 ul { font-size: 12px; padding: 0px;}';
  652.  
  653. //css for our nav tabs links,
  654. g = g + '#comments-tab22 a { padding: 3px !important ; margin-right: 0px !important;}';
  655.  
  656. // keep the padding on our nav tabs
  657. g = g + '#comments-tab22 nav-tabs { padding: 0px !important;}';
  658.  
  659. //css for non selected UR opacity
  660. g = g + ".olMap.problem-selected .map-problem:not(.selected) { opacity: .5 !important;}";
  661.  
  662. //css to fix the beta editors UR window
  663. g = g + '.problem-edit .section .title { line-height: 15px !important; }';
  664.  
  665. g = g + '.problem-edit .header { line-height: 15px !important; padding: 0px 15px!important; }';
  666. g = g + '.problem-edit .section .content { padding: 5px !important;}';
  667.  
  668. /* old css
  669. g = g + '.problem-edit { max-height: 85% !important; }';
  670.  
  671. //g = g + '.problem-edit .body { position: absolute !important; top: 30px !important; bottom: 5px !important; overflow: auto !important;}';
  672.  
  673. //g = g + '.problem-edit .body { position: absolute !important; top: 30px !important; bottom: 5px !important; overflow: auto !important; width: 280px !important;}';
  674.  
  675. g = g + '#panel-container .panel { left: 0px !important; top: 60px !important; bottom: 25px !important; margin-bottom: 15px !important;}';
  676.  
  677. g = g + '.problem-edit .conversation.section .new-comment-form { padding: 10px 15px !important; }';
  678. //g = g + '.problem-edit .conversation.section .new-comment-form textarea { placeholder: "Remember, be nice!"; margin-bottom: 5px; }';
  679. g = g + '.problem-edit .actions .controls-container label[for|="state"] { margin-bottom: 5px; }';
  680. g = g + '.header .close-panel { padding-top: 5px; }';
  681. g = g + '.header .focus { padding-top: 5px; }';
  682. g = g + '.problem-edit .conversation.section .comment-list { padding-right: 0px; margin-right: 5px; padding-left: 0px; margin-left: 5px; overflow-y: hidden; max-height: 100%;}';
  683. */
  684.  
  685. //css to undo some of the changes from maximizer
  686. if ($("#sidebar").width() < 300) {
  687. g = g + '#sidebar { max-width: 290px !important;}';
  688. g = g + '.show-sidebar .row-fluid .fluid-fixed {margin-left: 290px !important;}';
  689. }
  690.  
  691. //move description up a div
  692. g = g + '.problem-edit .description { background-color: white; overflow-x: hidden; overflow-y: auto; max-height: 80px; border-bottom: 2px solid #e9e9e9;}';
  693.  
  694.  
  695. //append our css to the head
  696. $("head").append($('<style type="text/css">' + g + '</style>'));
  697.  
  698. //urcToConsole("Start adding the URComments's tab");
  699. //add comments tab
  700. var b = $('<li><a href="#sidepanel-Comments" data-toggle="tab" id="CommentsTab">URC</a> </li> ');
  701. //i had to switch to first() becuase someone was reusing the nav tabs in another script and this would cause my tab to go inside theirs!
  702. //$("h2 + ul.nav-tabs").first().append(b);
  703. $("#user-info ul.nav-tabs").first().append(b);//production 10/29/2015
  704. $("#user-tabs ul.nav-tabs").first().append(b);//beta 10/29/2015
  705.  
  706.  
  707. //add the content to the comments tab
  708. //Comment tab header and zoom out button
  709. var c = "";
  710. c = c + '<div class="tab-pane" id="sidepanel-Comments" ><div class="URComments"></div></div>';
  711. $("#user-info div.tab-content").first().append(c);//production 10/29/2015
  712. $("#user-tabs div.tab-content").first().append(c);//beta 10/29/2015
  713.  
  714. }
  715. //reset the var to change the language
  716. ChangeLanguage = false;
  717.  
  718. var c = "";
  719. c = c + '<div class="row middle-xs">';
  720. c = c + '<div class="colxs-6" style= "position: relative !important; left: 64px !important; width: 200px;"><div style=""><img src="' + UrCommentsIcon + '" style="cursor:default;"><div id="URCWazeReloadMap" title="' + URC_Text_tooltip[3] + '" data-original-title="" class="fa fa-repeat reload-button reload-button URComments" content="" style="font-size: 25px; position: relative; top: 10px; right: -63px;"></div>';
  721. c = c + '<div class="box">';
  722. c = c + '<br>';
  723. c = c + '<a id="URCommentZoomOutButton" class="URComments" Title="' + URC_Text_tooltip[0] + '">' + URC_Text[0] + '</a>';
  724. c = c + '<br>';
  725. c = c + '<a id="URCommentZoomOutButton2" class="URComments" Title="' + URC_Text_tooltip[1] + '">' + URC_Text[1] + '</a>';
  726. c = c + '<br>';
  727. c = c + '<a id="URCommentZoomOutButton3" class="URComments" Title="' + URC_Text_tooltip[2] + '">' + URC_Text[2] + '</a>';
  728. c = c + '<div Title="' + URC_Text_tooltip[4] + '" id="URCount" style="font-size: 12px; width: 75%; text-align:center;"></div>';
  729. c = c + '</div>';
  730. c = c + '</div>';
  731. c = c + '</div> ';
  732. $(".URComments").append(c);
  733. //add the map zoom out handlers
  734. $("#URCommentZoomOutButton").click(URComments.SetZoomCloseUR(0, "CloseUR"));
  735. //$("#URCommentZoomOutButton").click(URComments.SetZoomCloseUR(1, "CloseUR"));
  736. $("#URCommentZoomOutButton2").click(URComments.SetZoomCloseUR(2, "CloseUR"));
  737. $("#URCommentZoomOutButton3").click(URComments.SetZoomCloseUR(3, "CloseUR"));
  738.  
  739. //add the map reload handler
  740. $("#URCWazeReloadMap").click(URComments.AutoReloadMapOnComment);
  741.  
  742. c = '<div id="comments-tab22" class="active" style="padding-top: 0px;">';
  743. c = c + ' <ul class="nav nav-tabs">';
  744. c = c + ' <li class="active"><a data-toggle="tab" href="#sidepanel-URComments-list">' + URC_Text[5] + '</a></li>';
  745. c = c + ' <li><a data-toggle="tab" href="#sidepanel-URComments-URO-Presets">' + URC_Text[6] + '</a></li>';
  746. c = c + ' <li><a data-toggle="tab" href="#sidepanel-URComments-settings">' + URC_Text[7] + '</a></li>';
  747. c = c + ' </ul>';
  748. c = c + ' <div class="tab-content">'; // style="padding: 10px 1px 1px 10px !important;"
  749. c = c + ' <div class="tab-pane active" id="sidepanel-URComments-list">';
  750. c = c + ' </div>';
  751. c = c + ' <div class="tab-pane" id="sidepanel-URComments-URO-Presets">';
  752. c = c + ' </div>';
  753. c = c + ' <div class="tab-pane" id="sidepanel-URComments-settings">';
  754. c = c + ' </div>';
  755. c = c + ' </div>';
  756. c = c + '</div>';
  757.  
  758. //add the sub tabs to the scripts main tab
  759. $("#sidepanel-Comments").append(c);
  760.  
  761. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  762. //////
  763. ////// Comments
  764. //////
  765. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  766.  
  767. d = $('<a target="_blank" Title="' + URC_Text_tooltip[8] + '" href="' + URC_URL[8] + '">' + URC_Text[8] + '<a/><br><br>');
  768. $("#sidepanel-URComments-URO-Presets").append(d);
  769.  
  770. //enable or disable urc filtering URCommentsFilterEnabled
  771. d = $('<label Title="' + URC_Text_tooltip[9] + '"><input type="checkbox" id="URCommentsFilterEnabled" class="URCommentsCheckbox"> ' + URC_Text[9] + '</input></label><br>');
  772. //$("#sidepanel-URComments-list").append(d);
  773. $("#sidepanel-URComments-URO-Presets").append(d);
  774. $("#URCommentsFilterEnabled").click(function() {
  775. $(localStorage.setItem('URCommentsFilterEnabled', URCommentsFilterEnabled.checked));
  776.  
  777. //if(URCommentsFilterEnabled.checked == true){
  778. setTimeout(URComments.FilterURs('filterenabled'), 0);
  779. //}
  780. });
  781.  
  782. var avdd = localStorage.getItem('URCommentsFilterEnabled');
  783. if (avdd === null) {
  784. avdd = true;
  785. }
  786. $("#URCommentsFilterEnabled").prop('checked', eval(avdd));
  787.  
  788. //enable or disable ur pill counts
  789. d = $('<label Title="' + URC_Text_tooltip[10] + '"><input type="checkbox" id="URCommentsPillEnabled" class="URCommentsCheckbox"> ' + URC_Text[10] + '</input></label><br><br>');
  790. //$("#sidepanel-URComments-list").append(d);
  791. $("#sidepanel-URComments-URO-Presets").append(d);
  792. $("#URCommentsPillEnabled").click(function() {
  793. $(localStorage.setItem('URCommentsPillEnabled', URCommentsPillEnabled.checked));
  794.  
  795. //if(URCommentsPillEnabled.checked == true){
  796. setTimeout(URComments.FilterURs('filterenabled'), 0);
  797. //}
  798. });
  799.  
  800. var avdd = localStorage.getItem('URCommentsPillEnabled');
  801. if (avdd === null) {
  802. avdd = true;
  803. }
  804. $("#URCommentsPillEnabled").prop('checked', eval(avdd));
  805.  
  806. //hide inbetween ur
  807. d = $('<label Title="' + URC_Text_tooltip[12] + '"><input type="checkbox" id="URCommentsHideInbetween" class="URCommentsCheckbox"> ' + URC_Text[12] + '</input></label><br>');
  808. //$("#sidepanel-URComments-list").append(d);
  809. $("#sidepanel-URComments-URO-Presets").append(d);
  810. $("#URCommentsHideInbetween").click(function() {
  811. $(localStorage.setItem('URCommentsHideInbetween', URCommentsHideInbetween.checked));
  812. setTimeout(URComments.FilterURs('hideInbetween'), 0);
  813. });
  814.  
  815. var avdd = localStorage.getItem('URCommentsHideInbetween');
  816. if (avdd === null) {
  817. avdd = true;
  818. }
  819. $("#URCommentsHideInbetween").prop('checked', eval(avdd));
  820.  
  821. //hide UR that are not "mine"
  822. d = $('<label Title="' + URC_Text_tooltip[13] + '"><input type="checkbox" id="URCommentsHideNotMyUR" class="URCommentsCheckbox"> ' + URC_Text[13] + '</input></label><br>');
  823. //$("#sidepanel-URComments-list").append(d);
  824. $("#sidepanel-URComments-URO-Presets").append(d);
  825. $("#URCommentsHideNotMyUR").click(function() {
  826. $(localStorage.setItem('URCommentsHideNotMyUR', URCommentsHideNotMyUR.checked));
  827. setTimeout(URComments.FilterURs('URCommentsHideNotMyUR'), 0);
  828. });
  829.  
  830. var avdd = localStorage.getItem('URCommentsHideNotMyUR');
  831. if (avdd === null) {
  832. avdd = true;
  833. }
  834. $("#URCommentsHideNotMyUR").prop('checked', eval(avdd));
  835.  
  836. //show UR that have gone past the close day setting
  837. d = $('<label Title="' + URC_Text_tooltip[14] + '"><input type="checkbox" id="URCommentsShowPastClose" class="URCommentsCheckbox"> ' + URC_Text[14] + '</input></label><br>');
  838. //$("#sidepanel-URComments-list").append(d);
  839. $("#sidepanel-URComments-URO-Presets").append(d);
  840. $("#URCommentsShowPastClose").click(function() {
  841. $(localStorage.setItem('URCommentsShowPastClose', URCommentsShowPastClose.checked));
  842. setTimeout(URComments.FilterURs('URCommentsShowPastClose'), 0);
  843. });
  844.  
  845. var avdd = localStorage.getItem('URCommentsShowPastClose');
  846. if (avdd === null) {
  847. avdd = true;
  848. }
  849. $("#URCommentsShowPastClose").prop('checked', eval(avdd));
  850.  
  851. //hide reminders
  852. d = $('<label Title="' + URC_Text_tooltip[15] + '"><input type="checkbox" id="URCommentsHideReminderNeeded" class="URCommentsCheckbox"> ' + URC_Text[15] + '</input></label><br><br>');
  853. //$("#sidepanel-URComments-list").append(d);
  854. $("#sidepanel-URComments-URO-Presets").append(d);
  855. $("#URCommentsHideReminderNeeded").click(function() {
  856. $(localStorage.setItem('URCommentsHideReminderNeeded', URCommentsHideReminderNeeded.checked));
  857. setTimeout(URComments.FilterURs('URCommentsHideReminderNeeded'), 0);
  858. });
  859.  
  860. var avdd = localStorage.getItem('URCommentsHideReminderNeeded');
  861. if (avdd === null) {
  862. avdd = false;
  863. }
  864. $("#URCommentsHideReminderNeeded").prop('checked', eval(avdd));
  865.  
  866. //hide replies
  867. d = $('<label Title="' + URC_Text_tooltip[16] + '"><input type="checkbox" id="URCommentsHideReplies" class="URCommentsCheckbox"> ' + URC_Text[16] + '</input></label><br>');
  868. //$("#sidepanel-URComments-list").append(d);
  869. $("#sidepanel-URComments-URO-Presets").append(d);
  870. $("#URCommentsHideReplies").click(function() {
  871. $(localStorage.setItem('URCommentsHideReplies', URCommentsHideReplies.checked));
  872. setTimeout(URComments.FilterURs('URCommentsHideReplies'), 0);
  873. });
  874.  
  875. var avdd = localStorage.getItem('URCommentsHideReplies');
  876. if (avdd === null) {
  877. avdd = false;
  878. }
  879. $("#URCommentsHideReplies").prop('checked', eval(avdd));
  880.  
  881. //hide older than 7 day
  882. d = $('<label Title="' + URC_Text_tooltip[17] + '"><input type="checkbox" id="URCommentsHideCloseNeeded" class="URCommentsCheckbox"> ' + URC_Text[17] + '</input></label><br>');
  883. //$("#sidepanel-URComments-list").append(d);
  884. $("#sidepanel-URComments-URO-Presets").append(d);
  885. $("#URCommentsHideCloseNeeded").click(function() {
  886. $(localStorage.setItem('URCommentsHideCloseNeeded', URCommentsHideCloseNeeded.checked));
  887. setTimeout(URComments.FilterURs('URCommentsHideCloseNeeded'), 0);
  888. });
  889.  
  890. var avdd = localStorage.getItem('URCommentsHideCloseNeeded');
  891. if (avdd === null) {
  892. avdd = false;
  893. }
  894. $("#URCommentsHideCloseNeeded").prop('checked', eval(avdd));
  895.  
  896. //hide initial (zero comments)
  897. d = $('<label Title="' + URC_Text_tooltip[18] + '"><input type="checkbox" id="URCommentsHideInital" class="URCommentsCheckbox"> ' + URC_Text[18] + '</input></label><br>');
  898. //$("#sidepanel-URComments-list").append(d);
  899. $("#sidepanel-URComments-URO-Presets").append(d);
  900. $("#URCommentsHideInital").click(function() {
  901. $(localStorage.setItem('URCommentsHideInital', URCommentsHideInital.checked));
  902. setTimeout(URComments.FilterURs('URCommentsHideInital'), 0);
  903. });
  904.  
  905. var avdd = localStorage.getItem('URCommentsHideInital');
  906. if (avdd === null) {
  907. avdd = false;
  908. }
  909. $("#URCommentsHideInital").prop('checked', eval(avdd));
  910.  
  911. //Hide UR that do not have descriptions
  912. d = $('<label Title="' + URC_Text_tooltip[19] + '"><input type="checkbox" id="URCommentsHideWithoutDescript" class="URCommentsCheckbox"> ' + URC_Text[19] + '</input></label><br>');
  913. //$("#sidepanel-URComments-list").append(d);
  914. $("#sidepanel-URComments-URO-Presets").append(d);
  915. $("#URCommentsHideWithoutDescript").click(function() {
  916. $(localStorage.setItem('URCommentsHideWithoutDescript', URCommentsHideWithoutDescript.checked));
  917. setTimeout(URComments.FilterURs('HideWithoutDescript'), 0);
  918. });
  919.  
  920. var avdd = localStorage.getItem('URCommentsHideWithoutDescript');
  921. if (avdd === null) {
  922. avdd = false;
  923. }
  924. $("#URCommentsHideWithoutDescript").prop('checked', eval(avdd));
  925.  
  926. //Hide UR that have descriptions
  927. d = $('<label Title="' + URC_Text_tooltip[20] + '"><input type="checkbox" id="URCommentsHideWithDescript" class="URCommentsCheckbox"> ' + URC_Text[20] + '</input></label><br>');
  928. //$("#sidepanel-URComments-list").append(d);
  929. $("#sidepanel-URComments-URO-Presets").append(d);
  930. $("#URCommentsHideWithDescript").click(function() {
  931. $(localStorage.setItem('URCommentsHideWithDescript', URCommentsHideWithDescript.checked));
  932. setTimeout(URComments.FilterURs('HideWithDescript'), 0);
  933. });
  934.  
  935. var avdd = localStorage.getItem('URCommentsHideWithDescript');
  936. if (avdd === null) {
  937. avdd = false;
  938. }
  939. $("#URCommentsHideWithDescript").prop('checked', eval(avdd));
  940.  
  941. //hide closed
  942. d = $('<label Title="' + URC_Text_tooltip[21] + '"><input type="checkbox" id="URCommentsHideClosed" class="URCommentsCheckbox"> ' + URC_Text[21] + '</input></label><br>');
  943. //$("#sidepanel-URComments-list").append(d);
  944. $("#sidepanel-URComments-URO-Presets").append(d);
  945. $("#URCommentsHideClosed").click(function() {
  946. $(localStorage.setItem('URCommentsHideClosed', URCommentsHideClosed.checked));
  947. setTimeout(URComments.FilterURs('URCommentsHideClosed'), 0);
  948. });
  949.  
  950. var avdd = localStorage.getItem('URCommentsHideClosed');
  951. if (avdd === null) {
  952. avdd = true;
  953. }
  954. $("#URCommentsHideClosed").prop('checked', eval(avdd));
  955.  
  956. //hide notes
  957. d = $('<label Title="' + URC_Text_tooltip[22] + '"><input type="checkbox" id="URCommentsHideNotes" class="URCommentsCheckbox"> ' + URC_Text[22] + '</input></label><br><br>');
  958. //$("#sidepanel-URComments-list").append(d);
  959. $("#sidepanel-URComments-URO-Presets").append(d);
  960. $("#URCommentsHideNotes").click(function() {
  961. $(localStorage.setItem('URCommentsHideNotes', URCommentsHideNotes.checked));
  962. setTimeout(URComments.FilterURs('URCommentsHideNotes'), 0);
  963. });
  964.  
  965. var avdd = localStorage.getItem('URCommentsHideNotes');
  966. if (avdd === null) {
  967. avdd = false;
  968. }
  969. $("#URCommentsHideNotes").prop('checked', eval(avdd));
  970.  
  971. //days used to filter UR (reminder days / close days)
  972. var d = $('<form>' + URC_Text[23] + '<input type="text" id="ReminderDays" style="width: 35px;"><br>' + URC_Text[24] + ' <input type="text" id="CloseDays" style="width: 35px;"><br> </form><br><br><br><br><br><br>');
  973. $("#sidepanel-URComments-URO-Presets").append(d);
  974.  
  975. //load reminder days
  976. $('#ReminderDays').val(localStorage.getItem('ReminderDays'));
  977. //load close days
  978. $('#CloseDays').val(localStorage.getItem('CloseDays'));
  979. //on load validation
  980. if ($('#ReminderDays').val() < 0) { //|| $('#ReminderDays').val() >= $('#CloseDays').val()
  981. $('#ReminderDays').val('0');
  982. $(localStorage.setItem('ReminderDays', $('#ReminderDays').val()));
  983. }
  984. if ($('#CloseDays').val() < 1) { // || $('#CloseDays').val() <= $('#ReminderDays').val()
  985. $('#CloseDays').val('7');
  986. $(localStorage.setItem('CloseDays', $('#CloseDays').val()));
  987. }
  988.  
  989. //reminder days verification
  990. $("#ReminderDays").change(function() {
  991. $(localStorage.setItem('ReminderDays', $('#ReminderDays').val()));
  992. setTimeout(URComments.FilterURs('ReminderDaysChange'), 0);
  993. });
  994.  
  995. //close days verification
  996. $("#CloseDays").change(function() {
  997. if ($('#CloseDays').val() < 1) { //|| $('#CloseDays').val() <= $('#ReminderDays').val()
  998. $('#CloseDays').val('7');
  999. alert(URC_USER_PROMPT[3]); //"URComments you can not set close days to zero days";
  1000. } else {
  1001. //save
  1002. $(localStorage.setItem('CloseDays', $('#CloseDays').val()));
  1003. setTimeout(URComments.FilterURs('CloseDaysChange'), 0);
  1004. }
  1005. });
  1006.  
  1007. //start generating the comment list and mouse click handlers
  1008. //urcToConsole("Start adding comments to the comment tab");
  1009. //comments setup
  1010. d = "";
  1011.  
  1012. //CurrentIndex is used to keep count of total arrays pairs which is used on the div's id tags
  1013. var CurrentIndex = 1;
  1014. //urcToConsole("Create Div 1");
  1015.  
  1016. //setup the comment color var
  1017. var colorrr = "CC0000";
  1018. var Title = "";
  1019. var URCommentURLNote = "";
  1020. var SelectedBoilerPlateCreator = localStorage.getItem('BoilerPlateCreators');
  1021. //go over the array and generate comment divs
  1022. for (var i = 0; i < URCommentsArray.length; i = i + 3) {
  1023. //urcToConsole("Create div for - " + URCommentsArray[i] + " " + URCommentsArray[i + 2]);
  1024.  
  1025. // make the URStatus lower case
  1026. var URStatus = (URCommentsArray[i + 2]).toLowerCase();
  1027.  
  1028. if (URStatus === "open") {
  1029. //black
  1030. colorrr = "#000000";
  1031. } else if (URStatus === "solved") {
  1032. //green
  1033. colorrr = "#008F00";
  1034. } else if (URStatus === "notidentified") {
  1035. //orange
  1036. colorrr = "#E68A00";
  1037. } else {
  1038. //red - not defined and that is a problem
  1039. colorrr = "#CC0000";
  1040.  
  1041. }
  1042. //escaping titles and comments with escapeHtml(Comment) so we can display items with special char as html;
  1043. //generate the comment links
  1044.  
  1045. Title = URCommentsArray[i];
  1046. var Comment = URComments.escapeHtml(URCommentsArray[i + 1]);
  1047.  
  1048. //normal comment link
  1049. d = '<div><a id="URComments-comment' + CurrentIndex + '" class="URComments" style="color:' + colorrr + '" Title="Title: ' + Title + ' Action: ' + URStatus + '; Comment: ' + Comment + ' ">' + Title + '</a>';
  1050. //$("#sidepanel-Comments").append(d);
  1051.  
  1052. if (URCommentsArray[i] === URCommentsArray[CloseNotIdentifiedPosistion] && localStorage.getItem('DBLClk7DCAutoSend') == "yes" || localStorage.getItem('DBLClkAll') == "yes") {
  1053. if (URCommentsArray[i] !== "<br>") {
  1054. d = d + '<a id="URComments-commentDBLCLK' + CurrentIndex + '" class="URComments" style="color:' + colorrr + '" Title="' + URC_Text_tooltip[42] + Title + '"> ' + URC_Text[42] + '</a>'; //double click links
  1055.  
  1056. }
  1057. }
  1058.  
  1059. d = d + '</div>';
  1060.  
  1061. //add comment to list
  1062. $("#sidepanel-URComments-list").append(d);
  1063.  
  1064. //set urID to zero so we don't freak out the functions expecting a UR ID
  1065. urID = 0;
  1066.  
  1067. //create the click function for each comment
  1068. $("#URComments-comment" + CurrentIndex).click(URComments.AutoZoomIN(URCommentsArray[i], URCommentsArray[i + 1], URStatus, urID));
  1069.  
  1070. //create the double click function for each comment
  1071. if (URCommentsArray[i] !== "<br>" && URCommentsArray[i] === URCommentsArray[CloseNotIdentifiedPosistion] && localStorage.getItem('DBLClk7DCAutoSend') == "yes" || localStorage.getItem('DBLClkAll') == "yes") {
  1072. //use this to click send automatically
  1073. if (URCommentsArray[i] !== "<br>") {
  1074. $("#URComments-commentDBLCLK" + CurrentIndex).dblclick(URComments.AutoZoomIN(URCommentsArray[i], URCommentsArray[i + 1], URStatus, urID, "AutoSendComment"));
  1075. }
  1076.  
  1077. }
  1078. //add a keyboardshortcut for each comment
  1079. if (URCommentsArray[i] !== "<br>") {
  1080. WMEKSRegisterKeyboardShortcut('URC' + SelectedBoilerPlateCreator, 'URComments ' + SelectedBoilerPlateCreator, 'URC' + SelectedBoilerPlateCreator + 'Shortcut'+i, URCommentsArray[i], URComments.AutoZoomIN(URCommentsArray[i], URCommentsArray[i + 1], URStatus, urID), '-1'); //shortcut1
  1081. }
  1082. //inc the CurrentIndex
  1083. CurrentIndex++;
  1084. }
  1085.  
  1086. //add 2 br to the end of the list for lower resolution monitors
  1087. d = '<br><br>';
  1088. $("#sidepanel-URComments-list").append(d);
  1089.  
  1090. //load the saved keyboard shortcuts
  1091. WMEKSLoadKeyboardShortcuts('URC' + SelectedBoilerPlateCreator);
  1092. //before unloading WME save the keyboard shortcuts
  1093. window.addEventListener("beforeunload", function() {
  1094. WMEKSSaveKeyboardShortcuts('URC' + SelectedBoilerPlateCreator);
  1095. }, false);
  1096.  
  1097. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1098. //////
  1099. ////// URO+ Preset filters
  1100. //////
  1101. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1102.  
  1103. //urcToConsole("Start adding URO preset filters to the comment tab");
  1104.  
  1105. /*
  1106. //URO+ new ur with no description
  1107. var d = $('<div><a id="URONewNoDescription" class="URCommentsPresets" Title="Use URO+ to only show new requests without descriptions">URO+ New UR without descriptions</a></div>');
  1108. $("#sidepanel-URComments-URO-Presets").append(d);
  1109. $("#URONewNoDescription").click(URComments.UROClearClicked('URONewNoDescription'));
  1110.  
  1111. //URO+ new ur
  1112. d = $('<div><a id="URCommentURONEW" class="URCommentsPresets" Title="Use URO+ to only show new requests or ones that have replies from the requestor">URO+ New requests / UR replies</a></div>');
  1113. $("#sidepanel-URComments-URO-Presets").append(d);
  1114. $("#URCommentURONEW").click(URComments.UROClearClicked('UroShowNew'));
  1115.  
  1116. //show no responses for reminders
  1117. d = $('<div><a id="URCommentURO4DayFollowUp" class="URCommentsPresets" Title="Use URO+ to only show URs that need a reminders message sent to them">URO+ Reminder message</a></div>');
  1118. $("#sidepanel-URComments-URO-Presets").append(d);
  1119. //create the callback function
  1120. $("#URCommentURO4DayFollowUp").click(URComments.UROClearClicked('URO4DayFollowUp'));
  1121.  
  1122. //show no responses for 7 days needs closing
  1123. d = $('<div><a id="URCommentURO7Day" class="URCommentsPresets" Title="Use URO+ to only show URs that are older than 7 days and need to be closed">URO+ 7 Day</a></div>');
  1124. $("#sidepanel-URComments-URO-Presets").append(d);
  1125. //create the callback function
  1126. $("#URCommentURO7Day").click(URComments.UROClearClicked('URO7Day'));
  1127.  
  1128. //show no responses for 8 days needs closing
  1129. d = $('<div><a id="URCommentURO8Day" class="URCommentsPresets" Title="Use URO+ to only show URs that are older than 8 days and need to be closed">URO+ 8 Day</a></div>');
  1130. $("#sidepanel-URComments-URO-Presets").append(d);
  1131. //create the callback function
  1132. $("#URCommentURO8Day").click(URComments.UROClearClicked('URO8Day'));
  1133.  
  1134. //show no responses for 10 days needs closing
  1135. d = $('<div><a id="URCommentURO10Day" class="URCommentsPresets" Title="Use URO+ to only show URs that are older than 10 days and need to be closed">URO+ 10 Day</a></div>');
  1136. $("#sidepanel-URComments-URO-Presets").append(d);
  1137. //create the callback function
  1138. $("#URCommentURO10Day").click(URComments.UROClearClicked('URO10Day'));
  1139.  
  1140. //show no responses for 24 Hour Notice now needs closing
  1141. d = $('<div><a id="URCommentURO24Hr" class="URCommentsPresets" Title="URO+ 8 day 24 Hour Notice. the idea behind this one is that on day 7 you will send 24 hour notices and then 24 hours later come back with this preset to find the ones that need closing">24 Hour Notice expermintal</a></div>');
  1142. $("#sidepanel-URComments-URO-Presets").append(d);
  1143. //create the callback function
  1144. $("#URCommentURO24Hr").click(URComments.UROClearClicked('URO24Hr'));
  1145. */
  1146. //URO+ clear
  1147. //var d = $('<div><a id="URCommentUROclearUROFiltrs" class="URCommentsPresets" Title="Clears all of the checks boxes in URO’s URs tab, except for Do not apply state/age filters to tagged URs and if you have Only My URs enabled in URComments">URO+ Clear UR Filters</a></div>');
  1148. //$("#sidepanel-URComments-URO-Presets").append(d);
  1149. //create the callback function
  1150. //$("#URCommentUROclearUROFiltrs").click(URComments.UROClearClicked('UROclearUROFiltrs'));
  1151.  
  1152. /*
  1153. //the predefined presets only show comments that the current user has commented on
  1154. d = $('<label Title="Use URO+ to only Show URs with comments from me"><input type="checkbox" id="URCommentUROOnlyMyUR" class="URCommentsCheckbox"> Only My URs</input></label><br>');
  1155. $("#sidepanel-URComments-URO-Presets").append(d);
  1156. //create the callback function
  1157. $("#URCommentUROOnlyMyUR").click(URComments.OnlyMyUR);
  1158.  
  1159. //the predefined presets only show comments that the current user has commented on
  1160. d = $('<label Title="Use URO+ to hide tagged pins. This setting will not be saved."><input type="checkbox" id="URCommentUROHideTagged" class="URCommentsCheckbox"> Temporarily hide tagged pins</input></label><br><br>');
  1161. $("#sidepanel-URComments-URO-Presets").append(d);
  1162. //create the callback function
  1163. $("#URCommentUROHideTagged").click(URComments.HideTagged("trash"));
  1164. */
  1165.  
  1166. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1167. //////
  1168. ////// Draw Options
  1169. //////
  1170. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1171.  
  1172. //Auto Set ur comment on new URs
  1173. d = $('<label Title="' + URC_Text_tooltip[25] + '"><input type="checkbox" id="UrCommentAutoSetNewComment" class="URCommentsCheckbox"> ' + URC_Text[25] + '</input></label><br>');
  1174. $("#sidepanel-URComments-settings").append(d);
  1175. //create the callback function
  1176. $("#UrCommentAutoSetNewComment").click(URComments.AutoSetNewComment);
  1177.  
  1178. //Auto Set ur reminder on new URs
  1179. d = $('<label Title="' + URC_Text_tooltip[26] + '"><input type="checkbox" id="UrCommentAutoSet4dayComment" class="URCommentsCheckbox"> ' + URC_Text[26] + '</input></label><br>');
  1180. $("#sidepanel-URComments-settings").append(d);
  1181. //create the callback function
  1182. $("#UrCommentAutoSet4dayComment").click(URComments.UrCommentAutoSet4dayComment);
  1183.  
  1184. //auto zoom in for new with no comments
  1185. d = $('<label Title="' + URC_Text_tooltip[27] + '"><input type="checkbox" id="UrCommentNewZoomIn" class="URCommentsCheckbox"> ' + URC_Text[27] + '</input></label><br>');
  1186. $("#sidepanel-URComments-settings").append(d);
  1187. //create the callback function
  1188. $("#UrCommentNewZoomIn").click(URComments.NewZoomIn);
  1189.  
  1190. //auto center at current zoom for UR with comments
  1191. d = $('<label Title="' + URC_Text_tooltip[28] + '"><input type="checkbox" id="UrCommentWithCommentRecenter" class="URCommentsCheckbox"> ' + URC_Text[28] + '</input></label><br>');
  1192. $("#sidepanel-URComments-settings").append(d);
  1193. //create the callback function
  1194. $("#UrCommentWithCommentRecenter").click(URComments.WithCommentRecenter);
  1195.  
  1196. //Auto Click open solved not Identified
  1197. d = $('<label Title="' + URC_Text_tooltip[29] + '"><input type="checkbox" id="URCommentAutoClickURStatus" class="URCommentsCheckbox"> ' + URC_Text[29] + '</input></label><br>');
  1198. $("#sidepanel-URComments-settings").append(d);
  1199. //create the callback function
  1200. $("#URCommentAutoClickURStatus").click(URComments.AutoClickURStatus);
  1201.  
  1202. //UrCommentSaveAfterComment
  1203. d = $('<label Title="' + URC_Text_tooltip[30] + '"><input type="checkbox" id="UrCommentSaveAfterComment" class="URCommentsCheckbox"> ' + URC_Text[30] + '</input></label><br>');
  1204. $("#sidepanel-URComments-settings").append(d);
  1205. //create the callback function
  1206. $("#UrCommentSaveAfterComment").click(URComments.SaveAfterComment);
  1207.  
  1208. //auto close after sending comment replies
  1209. d = $('<label Title="' + URC_Text_tooltip[31] + '"><input type="checkbox" id="UrCommentAutoCloseComment" class="URCommentsCheckbox"> ' + URC_Text[31] + '</input></label><br>');
  1210. $("#sidepanel-URComments-settings").append(d);
  1211. //create the callback function
  1212. $("#UrCommentAutoCloseComment").click(URComments.AutoCloseComment);
  1213.  
  1214. //auto reload map after sending comment replies
  1215. //d = $('<label Title="' + URC_Text_tooltip[32] + '"><input type="checkbox" id="UrCommentAutoReloadAfterComment" class="URCommentsCheckbox"> ' + URC_Text[32] + '</input></label><br>');
  1216. //$("#sidepanel-URComments-settings").append(d);
  1217. //create the callback function
  1218. //$("#UrCommentAutoReloadAfterComment").click(URComments.AutoReloadAfterComment);
  1219.  
  1220. //zoom out map after sending comment replies
  1221. d = $('<label Title="' + URC_Text_tooltip[33] + '"><input type="checkbox" id="UrCommentZoomOutAfterComment" class="URCommentsCheckbox"> ' + URC_Text[33] + '</input></label><br>');
  1222. $("#sidepanel-URComments-settings").append(d);
  1223. //create the callback function
  1224. $("#UrCommentZoomOutAfterComment").click(URComments.ZoomOutAfterComment);
  1225.  
  1226. //Auto switch to the URComments tab after page load
  1227. d = $('<label Title="' + URC_Text_tooltip[34] + '"><input type="checkbox" id="UrCommentAutoSwitchToURCommentsTab" class="URCommentsCheckbox"> ' + URC_Text[34] + '</input></label><br>');
  1228. $("#sidepanel-URComments-settings").append(d);
  1229. //create the callback function
  1230. $("#UrCommentAutoSwitchToURCommentsTab").click(URComments.AutoSwitchToURCommentsTab);
  1231.  
  1232. //Double clicking the 7 day close comment will auto send the 7day close comment
  1233. d = $('<label Title="' + URC_Text_tooltip[35] + '"><input type="checkbox" id="UrCommentDBLClk7DCAutoSend" class="URCommentsCheckbox"> ' + URC_Text[35] + '</input></label><br>');
  1234. $("#sidepanel-URComments-settings").append(d);
  1235. //create the callback function
  1236. $("#UrCommentDBLClk7DCAutoSend").click(URComments.DBLClk7DCAutoSend);
  1237.  
  1238. //Double clicking comments will auto send comments
  1239. d = $('<label Title="' + URC_Text_tooltip[36] + '"><input type="checkbox" id="UrCommentDBLClkAll" class="URCommentsCheckbox"> ' + URC_Text[36] + '</input></label><br>');
  1240. $("#sidepanel-URComments-settings").append(d);
  1241. //create the callback function
  1242. $("#UrCommentDBLClkAll").click(URComments.DBLClkAll);
  1243.  
  1244. //go over BoilerPlateCreatorsArray and generate the select
  1245. d = '<font style="font-size: 12px;">' + URC_Text[37] + ' <select id="BoilerPlateCreators" style="font-size: 12px; margin-top: 5px;" title="' + URC_Text_tooltip[37] + '">';
  1246. for (i = 0; i < BoilerPlateCreatorsArray.length; i = i + 1) {
  1247. urcToConsole("BoilerPlateCreatorsArray " + BoilerPlateCreatorsArray[i]);
  1248. d = d + '<option style="font-size 12px;" value="' + BoilerPlateCreatorsArray[i] + '">' + BoilerPlateCreatorsArray[i] + '</option>';
  1249. }
  1250. d = d + "</select> </font><br><br>";
  1251. $("#sidepanel-URComments-settings").append(d);
  1252. //create call back for the select
  1253. $("#BoilerPlateCreators").change(URComments.BoilerPlateCreatorsFunction);
  1254.  
  1255. //UrCommentDisableURDoneBtn
  1256. d = $('<label Title="' + URC_Text_tooltip[38] + '"><input type="checkbox" id="UrCommentDisableURDoneBtn" class="URCommentsCheckbox"> ' + URC_Text[38] + '</input></label><br>');
  1257. //$("#sidepanel-URComments-list").append(d);
  1258. $("#sidepanel-URComments-settings").append(d);
  1259. $("#UrCommentDisableURDoneBtn").click(function() {
  1260. $(localStorage.setItem('UrCommentDisableURDoneBtn', UrCommentDisableURDoneBtn.checked));
  1261. });
  1262.  
  1263. var avdd = localStorage.getItem('UrCommentDisableURDoneBtn');
  1264. if (avdd === null) {
  1265. avdd = true;
  1266. }
  1267. $("#UrCommentDisableURDoneBtn").prop('checked', eval(avdd));
  1268.  
  1269. //URCommentURUnfollow
  1270. d = $('<label Title="' + URC_Text_tooltip[39] + '"><input type="checkbox" id="URCommentURUnfollow" class="URCommentsCheckbox"> ' + URC_Text[39] + '</input></label><br>');
  1271. $("#sidepanel-URComments-settings").append(d);
  1272. $("#URCommentURUnfollow").click(function() {
  1273. $(localStorage.setItem('URCommentURUnfollow', URCommentURUnfollow.checked));
  1274. });
  1275.  
  1276. var avdd = localStorage.getItem('URCommentURUnfollow');
  1277. if (avdd === null) {
  1278. avdd = false;
  1279. }
  1280. $("#URCommentURUnfollow").prop('checked', eval(avdd));
  1281.  
  1282. //when on screen auto send my own reminders
  1283. d = $('<label Title="' + URC_Text_tooltip[40] + '"><input type="checkbox" id="URCommentsAutoSendMyReminders" class="URCommentsCheckbox"> ' + URC_Text[40] + '</input></label><br>');
  1284. $("#sidepanel-URComments-settings").append(d);
  1285. $("#URCommentsAutoSendMyReminders").click(function() {
  1286.  
  1287. if (URCommentsAutoSendMyReminders.checked == true) {
  1288. var r = confirm(URC_USER_PROMPT[11]); //"URComments This will send reminders at the reminder days setting. This only happens when they are in your visible area. NOTE: when using this feature you should not leave any UR open unless you had a question that needed an answer from the wazer as this script will send those reminders. "
  1289.  
  1290. //this is where we reuse the r var this makes the nested ifs much more simple
  1291. if (r === true) {
  1292. setTimeout(URComments.FilterURs('URCommentsAutoSendMyReminders'), 0);
  1293. } else {
  1294. $("#URCommentsAutoSendMyReminders").prop('checked', false);
  1295.  
  1296. }
  1297. }
  1298. $(localStorage.setItem('URCommentsAutoSendMyReminders', URCommentsAutoSendMyReminders.checked));
  1299. });
  1300.  
  1301. var avdd = localStorage.getItem('URCommentsAutoSendMyReminders');
  1302. if (avdd === null) {
  1303. avdd = false;
  1304. }
  1305. $("#URCommentsAutoSendMyReminders").prop('checked', eval(avdd));
  1306.  
  1307. d = $('<label Title="' + URC_Text_tooltip[41] + '"><input type="checkbox" id="URCommentsReplaceTagWithEditorName" class="URCommentsCheckbox"> ' + URC_Text[41] + '</input></label><br>');
  1308. $("#sidepanel-URComments-settings").append(d);
  1309. $("#URCommentsReplaceTagWithEditorName").click(function() {
  1310. $(localStorage.setItem('URCommentsReplaceTagWithEditorName', URCommentsReplaceTagWithEditorName.checked));
  1311. setTimeout(URComments.FilterURs('URCommentsReplaceTagWithEditorName'), 0);
  1312. });
  1313.  
  1314. var avdd = localStorage.getItem('URCommentsReplaceTagWithEditorName');
  1315. if (avdd === null) {
  1316. avdd = false;
  1317. }
  1318. $("#URCommentsReplaceTagWithEditorName").prop('checked', eval(avdd));
  1319. d = $('<label Title="' + URC_Text_tooltip[43] + '"><input type="checkbox" id="URCommentsDontShowTaggedText" class="URCommentsCheckbox"> ' + URC_Text[43] + '</input></label><br>');
  1320. $("#sidepanel-URComments-settings").append(d);
  1321. $("#URCommentsDontShowTaggedText").click(function() {
  1322. $(localStorage.setItem('URCommentsDontShowTaggedText', URCommentsDontShowTaggedText.checked));
  1323. setTimeout(URComments.FilterURs(URCommentsDontShowTaggedText), 0);
  1324. });
  1325.  
  1326. var avdd = localStorage.getItem('URCommentsDontShowTaggedText');
  1327. if (avdd === null) {
  1328. avdd = false;
  1329. }
  1330. $("#URCommentsDontShowTaggedText").prop('checked', eval(avdd));
  1331.  
  1332. urcToConsole("Tab Complete");
  1333.  
  1334. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1335. //////
  1336. ////// Load and set saved options
  1337. //////
  1338. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1339.  
  1340. //URComments tab is loaded load options to last state
  1341. //here we also check to see if the options have ever been set (new user) if not we enable them all on script load
  1342. //enabling them will trigger a click of the option which will cause the option to be saved
  1343.  
  1344. //OnlyMyUR have the predefined pre-sets only show comments that the current user has commented on
  1345. if (localStorage.getItem('OnlyMyUR') == "yes") {
  1346. $("#URCommentUROOnlyMyUR").trigger('click');
  1347. }
  1348.  
  1349. //auto set new urs comment
  1350. if (localStorage.getItem('AutoSetNewComment') == "yes" || !localStorage.getItem('AutoSetNewComment')) {
  1351. $("#UrCommentAutoSetNewComment").trigger('click');
  1352. }
  1353.  
  1354. //auto set 4day urs comment
  1355. if (localStorage.getItem('UrCommentAutoSet4dayComment') == "yes" || !localStorage.getItem('UrCommentAutoSet4dayComment')) {
  1356. $("#UrCommentAutoSet4dayComment").trigger('click');
  1357. }
  1358.  
  1359. //UrCommentAutoCloseComment
  1360. if (localStorage.getItem('UrCommentAutoCloseComment') == "yes" || !localStorage.getItem('UrCommentAutoCloseComment')) {
  1361. $("#UrCommentAutoCloseComment").trigger('click');
  1362. }
  1363.  
  1364. //AutoReloadAfterComment
  1365. //if (localStorage.getItem('AutoReloadAfterComment') == "yes") {
  1366. // $("#UrCommentAutoReloadAfterComment").trigger('click');
  1367. //}
  1368.  
  1369. //NewZoomIn
  1370. if (localStorage.getItem('NewZoomIn') == "yes" || !localStorage.getItem('NewZoomIn')) {
  1371. $("#UrCommentNewZoomIn").trigger('click');
  1372. }
  1373.  
  1374. //auto recenter ur without comments
  1375. if (localStorage.getItem('WithCommentRecenter') == "yes" || !localStorage.getItem('WithCommentRecenter')) {
  1376. $("#UrCommentWithCommentRecenter").trigger('click');
  1377. }
  1378.  
  1379. // URComments load and set settings and check boxes
  1380. if (localStorage.getItem('AutoClickURStatus') == "yes" || !localStorage.getItem('AutoClickURStatus')) {
  1381. $("#URCommentAutoClickURStatus").trigger('click');
  1382. if (localStorage.getItem('DBLClk7DCAutoSend') == "yes" || localStorage.getItem('DBLClkAll') == "yes") {
  1383. $('#URCommentAutoClickURStatus').prop('checked', true);
  1384. localStorage.setItem('AutoClickURStatus', 'yes');
  1385. }
  1386. }
  1387.  
  1388. //UrCommentSaveAfterComment
  1389. if (localStorage.getItem('SaveAfterComment') == "yes" || !localStorage.getItem('SaveAfterComment')) {
  1390. $("#UrCommentSaveAfterComment").trigger('click');
  1391. }
  1392.  
  1393. //AutoZoomOutAfterComment
  1394. if (localStorage.getItem('ZoomOutAfterComment') == "yes" || !localStorage.getItem('ZoomOutAfterComment')) {
  1395. $("#UrCommentZoomOutAfterComment").trigger('click');
  1396. }
  1397.  
  1398. //AutoSwitchToURCommentsTab
  1399. if (localStorage.getItem('AutoSwitchToURCommentsTab') == "yes" || !localStorage.getItem('AutoSwitchToURCommentsTab')) {
  1400. $("#UrCommentAutoSwitchToURCommentsTab").trigger('click');
  1401. }
  1402.  
  1403. //UrCommentDBLClk7DCAutoSend
  1404. if (localStorage.getItem('DBLClk7DCAutoSend') == "yes") {
  1405. $("#UrCommentDBLClk7DCAutoSend").prop('checked', true);
  1406. $("#AutoClickURStatus").prop('checked', true);
  1407. localStorage.setItem('AutoClickURStatus', 'yes');
  1408. }
  1409.  
  1410. //UrCommentDBLClkAll
  1411. if (localStorage.getItem('DBLClkAll') == "yes") {
  1412. $("#UrCommentDBLClkAll").prop('checked', true);
  1413. $("#AutoClickURStatus").prop('checked', true);
  1414. localStorage.setItem('AutoClickURStatus', 'yes');
  1415. }
  1416.  
  1417. //set the users BoilerPlateCreators choice in the select
  1418. var SelectedBoilerPlateCreator = localStorage.getItem('BoilerPlateCreators');
  1419. $("#BoilerPlateCreators").val(SelectedBoilerPlateCreator);
  1420. //end getting boilerplatecreators
  1421.  
  1422. //check to see if the option to auto switch to the URComments tab is enabled
  1423. //if (UrCommentAutoSwitchToURCommentsTab.checked) {
  1424. // //make UR Comments tab active
  1425. // $('#CommentsTab').trigger('click');
  1426. //}
  1427.  
  1428. if (URCommentUpdateMessage === "yes") {
  1429. //alert the user in URComment version updates
  1430. if (localStorage.getItem('URCommentVersion') === URCommentVersion) {
  1431. urcToConsole("Version - " + URCommentVersion);
  1432. } else {
  1433. alert(URCommentVersionUpdateNotes);
  1434. localStorage.setItem('URCommentVersion', URCommentVersion);
  1435. }
  1436. }
  1437.  
  1438. //set the background of the last used URO preset
  1439. //URComments.UROPresetHighlight(localStorage.getItem('UROCurrentPeset'));
  1440.  
  1441. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1442. //////
  1443. ////// Launch background task(s)
  1444. //////
  1445. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1446.  
  1447. //start looking for opened UR's window
  1448. setTimeout(URComments.LookForOpenedUR, 1000);
  1449.  
  1450. //reset URO the hiding of tagged pin
  1451. //setTimeout(URComments.HideTagged("startup"), 10000);
  1452.  
  1453. setTimeout(URComments.URCLoadUpdateRequestsEvents, 0);
  1454.  
  1455. //enable exp road $( ".toggler label span:contains('Roads experimental')" ).click();// turn on experimental roads layer
  1456. //$(".toggler label span:contains('Me!')").click(); //auto enable wme me!
  1457. //end of URCommentsinit
  1458. };
  1459.  
  1460. ///////////////////////////////////////////////////////////////////////////////////
  1461. //////
  1462. ////// Background task(s)
  1463. //////
  1464. ///////////////////////////////////////////////////////////////////////////////////
  1465.  
  1466. //look for the UR window to be open
  1467. URComments.LookForOpenedUR = function() {
  1468. //urcToConsole("look for open UR window " + (new Date()).getTime());
  1469. //check for an open UR and that the UR's text area is shown
  1470. //test urc messages
  1471. //var dateNow = new Date();
  1472. //TrickRemove = dateNow.getTime();
  1473. //URComments.ShowWMEMessage("test " + TrickRemove , 10000);
  1474. //relaunch checking for open ur - moved this up here so the script would keep trying if I had an error
  1475. setTimeout(URComments.LookForOpenedUR, 500); //line 892
  1476.  
  1477. var urID = 0;
  1478.  
  1479. urID = $(".update-requests .selected").data("id");
  1480.  
  1481. /*
  1482. 768 807
  1483. 900 974
  1484. 1050 1156
  1485. 1080 941
  1486. */
  1487.  
  1488. /*
  1489. //try to resize the ur window to the browser size
  1490. if(urID > 0 && typeof urID !== 'undefined') {
  1491. if(window.innerHeight <= 810){ //*768
  1492. $('.problem-edit .conversation.section .comment-list').css('max-height', '110px');
  1493. } else { //default wme setting
  1494. //$('.problem-edit .conversation.section .comment-list').css('max-height', '500px');
  1495. $('.problem-edit .conversation.section .comment-list').css('max-height', window.innerHeight - 700 +'px');
  1496. }
  1497. }
  1498. //comment area
  1499. $('.problem-edit .conversation.section .comment-list').css('max-height', '100%');
  1500. }
  1501. */
  1502. if (urID > 0 && typeof urID !== 'undefined') {
  1503. //new or same ur (re))open(ed) so now we can do stuff; this prevents this function to continuously applying settings to a ur
  1504. if (UrCommentLasturID !== urID && $(".new-comment-text").length !== 0) {
  1505. urcToConsole("Found open UR - " + urID);
  1506.  
  1507. //grab the current UR ID for next time
  1508. UrCommentLasturID = urID;
  1509.  
  1510. //url to open a UR
  1511. //https://www.waze.com/editor/?zoom=5&lat=34.024522&lon=-118.297005&mapUpdateRequest=3710607&env=usa
  1512. //https://www.waze.com/editor/?zoom=5&mapUpdateRequest=4271288&env=usa
  1513.  
  1514. //auto expand ur comments list and text area (verify that this is not for the old WME)
  1515. if ($('#edit-request .comment-view-shown').length === 0) {
  1516. setTimeout(function() {
  1517. $('#edit-request .toggle-comment-view').trigger('click');
  1518. }, 0);
  1519. }
  1520.  
  1521. //beta editor auto expand ur comments list and text area
  1522. if ($("#panel-container .problem-edit .conversation").length !== 0) {
  1523. $("#panel-container .problem-edit .conversation").removeClass('collapsed'); //beta editor auto expand UR Comment box
  1524. }
  1525.  
  1526. //beta editor auto expand ur comments more info
  1527. if ($("#panel-container .problem-edit .more-info").length !== 0) {
  1528. $("#panel-container .problem-edit .more-info").removeClass('collapsed'); //beta editor auto expand UR Comment box
  1529. }
  1530.  
  1531. /*
  1532. //disable the stupid new done button
  1533. if ($("#panel-container .content .done").length > 0 && UrCommentDisableURDoneBtn.checked === true) {
  1534. $("#panel-container .content .done").attr('disabled', true);
  1535. $("#panel-container .content .done").html('(Done) Disabled by URComments');
  1536. }
  1537. //is the done/next disabled box checked
  1538. if(UrCommentDisableURDoneBtn.checked === true) {
  1539. if ($("#panel-container .content .next").length > 0) {
  1540. //disable the stupid new next button
  1541. $("#panel-container .content .next").attr('disabled', true);
  1542. $("#panel-container .content .next").html('(Next) Disabled by URComments');
  1543. } else if ($("#panel-container .content .done").length > 0) {
  1544. //disable the stupid new done button
  1545. $("#panel-container .content .done").attr('disabled', true);
  1546. $("#panel-container .content .done").html('(Done) Disabled by URComments');
  1547. }
  1548. }*/
  1549.  
  1550.  
  1551. //disable the stupid buttons at the bottom of the UR window done / next
  1552. if ($("#panel-container .content .navigation .btn-block").length > 0 && UrCommentDisableURDoneBtn.checked === true) {
  1553. $("#panel-container .content .navigation .btn-block").attr('disabled', true);
  1554. $("#panel-container .content .navigation .btn-block").html('Disabled by URComments');
  1555. }
  1556. //complaints about editors not reading the description so I am moving the description up a div
  1557. var desc = $(".body .description").html();
  1558. if (desc != undefined) {
  1559. //move the description up a div
  1560. $(".problem-edit .header").after('<div class="description section">' + desc + '</div>');
  1561. $(".problem-edit .body .description").remove();
  1562. }
  1563.  
  1564. //jump to bottom
  1565. $('.problem-edit .comment-list').scrollTop($('.conversation-view .comment-list')[0].scrollHeight);
  1566. $('.problem-edit .problem-data').scrollTop($('.conversation-view .comment-list')[0].scrollHeight);
  1567.  
  1568. //attach an even listener to the UR center button to take us to the UR
  1569. $('#panel-container > div > div > div.header > a.focus > i').click(URComments.CrossHairsClicked(urID, 5));
  1570.  
  1571. //auto fill in comment
  1572. //check what type of message to insert into the ur
  1573. reporter_comment = Waze.model.updateRequestSessions.objects[urID].comments;
  1574. i = reporter_comment.length;
  1575.  
  1576. urcToConsole("LookForOpenedUR number of comments: " + i);
  1577.  
  1578. //if number of comment is zero assume this is a new ur
  1579. if (i === 0) {
  1580. //initial, zero comments
  1581.  
  1582. urcToConsole("LookForOpenedUR no comments");
  1583.  
  1584. if (UrCommentAutoSetNewComment.checked === true) {
  1585. urcToConsole("LookForOpenedUR no comments2");
  1586. //this will be on of the types of UR that a user can choose from when submitting a UR
  1587.  
  1588. var urType = Waze.model.mapUpdateRequests.objects[urID].attributes.type;
  1589. urcToConsole("LookForOpenedUR Found open UR - " + urID + " " + def_names[urType]);
  1590.  
  1591. //loop trough the comment array for a comment that matches the request type.
  1592. for (var ii = 0; ii < URCommentsArray.length; ii = ii + 3) {
  1593. if (URCommentsArray[ii].toLowerCase() === def_names[urType].toLowerCase()) {
  1594. urcToConsole("LookForOpenedUR Matched Comment: " + def_names[urType]);
  1595. setTimeout(URComments.AutoZoomIN(URCommentsArray[ii], URCommentsArray[ii + 1], URCommentsArray[ii + 2], urID), 0);
  1596. }
  1597. }
  1598. }
  1599.  
  1600. } else {
  1601. //4DAY OR 7DAY section
  1602.  
  1603. LastCommentorUserID = reporter_comment[reporter_comment.length - 1].userID;
  1604. urcToConsole("LookForOpenedUR LastCommentorUserID: " + LastCommentorUserID);
  1605.  
  1606. //uro days old
  1607. var commentDaysOld = URComments.uroGetCommentAge(W.model.updateRequestSessions.objects[urID].comments[i - 1]);
  1608. urcToConsole("LookForOpenedUR Days old: " + commentDaysOld);
  1609.  
  1610. //if (i === 1 && commentDaysOld >= 4 && LastCommentorUserID > 1 && UrCommentAutoSet4dayComment.checked === true) {
  1611. var ReminderDays = $('#ReminderDays').val();
  1612. urcToConsole("LookForOpenedUR ReminderDays: " + ReminderDays);
  1613.  
  1614. if (i === 1 && ReminderDays > 0 && commentDaysOld >= ReminderDays && LastCommentorUserID > 1 && UrCommentAutoSet4dayComment.checked === true) {
  1615. //4day - 1 comment, last comment less than 4 days, last comment is not from reporter
  1616. urcToConsole("LookForOpenedUR 4day");
  1617.  
  1618. //4 day ur 1 comment
  1619. setTimeout(URComments.AutoZoomIN(URCommentsArray[ReminderPosistion], URCommentsArray[ReminderPosistion + 1], URCommentsArray[ReminderPosistion + 2], urID), 0);
  1620. }
  1621. //don't allow auto filling of the close message because it clicks the not identified option and causes trouble when the Ur window is shut/closed the next save will mark it as not identified, without a comment.
  1622.  
  1623. }
  1624.  
  1625. var WazeCurrentZoom = "";
  1626. WazeCurrentZoom = URComments.GetWazeMapZoomLevel();
  1627. urcToConsole("zoomD " + WazeCurrentZoom + " " + UrCommentNewZoomIn.checked);
  1628. if (i === 0 && UrCommentNewZoomIn.checked === true) {
  1629. //zoom in new
  1630. //predefined zoom threshold for auto zoom
  1631. var zoom = 4;
  1632.  
  1633. //do not zoom back out if we are already zoomed in and just happen to be re-clicking on a UR.
  1634. if (WazeCurrentZoom < zoom) {
  1635. urcToConsole("zoom in 1");
  1636. URComments.gotoURById(urID, 5);
  1637. }
  1638. } else if (UrCommentWithCommentRecenter.checked === true) {
  1639. //re-center on urs that are not zoom in
  1640. if (WazeCurrentZoom < 3) {
  1641. //alert(WazeCurrentZoom);
  1642. urcToConsole("Auto center 1");
  1643. URComments.gotoURById(urID, WazeCurrentZoom);
  1644. }
  1645.  
  1646. }
  1647.  
  1648. //auto switch to ur comments tab
  1649. if (UrCommentAutoSwitchToURCommentsTab.checked) {
  1650. //grab the active tab
  1651. PreviousTab = $("#user-tabs > ul > li.active > a");
  1652. //grab the active tabs scroll posistion
  1653. PreviousTabPosistion = $('#sidebar').scrollTop();
  1654. $('#sidebar').scrollTop( 0 ); //set scoll pos
  1655. //make UR Comments tab active
  1656. $('#CommentsTab').trigger('click');
  1657. }
  1658. }
  1659.  
  1660.  
  1661. } else {
  1662. //reset the id if a ur is not open so we can set the tab for the same ur
  1663. UrCommentLasturID = "";
  1664. urID = "";
  1665. //switch tab back
  1666. if (UrCommentAutoSwitchToURCommentsTab.checked) {
  1667. //verify that we had found a tab
  1668. if (PreviousTab !== null) {
  1669. //click back on the previous tab
  1670. $(PreviousTab).trigger('click');
  1671. $('#sidebar').scrollTop( PreviousTabPosistion ); //set scoll pos
  1672. //clear out the previous tab holder
  1673. PreviousTab = null;
  1674. PreviousTabPosistion = null;
  1675. }
  1676. }
  1677. //urcToConsole("LookForOpenedUR Looking for ur...");
  1678. }
  1679.  
  1680. };
  1681.  
  1682. ////////////////////////////////////////////////////////////////////////////
  1683. //////
  1684. ////// Save Options on click
  1685. //////
  1686. ////////////////////////////////////////////////////////////////////////////
  1687.  
  1688. //use uro to only show urs that I have commented on
  1689. URComments.OnlyMyUR = function() {
  1690.  
  1691. //try to save the state of the check box
  1692. if (URCommentUROOnlyMyUR.checked) {
  1693. localStorage.setItem('OnlyMyUR', 'yes');
  1694. } else {
  1695. localStorage.setItem('OnlyMyUR', 'no');
  1696. }
  1697.  
  1698. //only show my ur 'OnlyMyUR'
  1699. if (URCommentUROOnlyMyUR.checked && !_cbHideAnyComments.checked) {
  1700. $("#_cbHideAnyComments").trigger('click');
  1701.  
  1702. } else if (!URCommentUROOnlyMyUR.checked && _cbHideAnyComments.checked) {
  1703. $("#_cbHideAnyComments").trigger('click');
  1704. }
  1705.  
  1706. };
  1707. /*
  1708. //URCommentUROHideTagged
  1709. //use uro to Hide Tagged pins
  1710. URComments.HideTagged = function(when) {
  1711. return function() {
  1712. urcToConsole("URCommentUROHideTagged");
  1713. URComments.TaggedPinsAray = [
  1714. "_cbFilterRoadworks", //
  1715. "_cbFilterConstruction",//
  1716. "_cbFilterClosure", //
  1717. "_cbFilterEvent", //
  1718. "_cbFilterNote" //
  1719. ];
  1720.  
  1721. //go over the array and clear all of the URO+ check boxes
  1722. for (var URComments_URO_Index = 0; URComments_URO_Index < URComments.TaggedPinsAray.length; URComments_URO_Index = URComments_URO_Index + 1) {
  1723. if(when==="startup") {
  1724. if ($('#' + URComments.TaggedPinsAray[URComments_URO_Index]).is(":checked")) {
  1725. $('#URCommentUROHideTagged').prop('checked', true);
  1726. }
  1727.  
  1728.  
  1729. } else {
  1730. urcToConsole("URCommentUROHideTagged " + URComments.TaggedPinsAray[URComments_URO_Index]);
  1731.  
  1732. if ($('#' + URComments.TaggedPinsAray[URComments_URO_Index]).length <= 0) {
  1733. alert("there was an error finding URO's hide tagged pins setting please verify these settings are in the correct state");
  1734. return false;
  1735. }
  1736.  
  1737.  
  1738. if (URCommentUROHideTagged.checked && !$('#' + URComments.TaggedPinsAray[URComments_URO_Index]).is(":checked")) {
  1739. $('#' + URComments.TaggedPinsAray[URComments_URO_Index]).trigger('click');
  1740. } else if (!URCommentUROHideTagged.checked && $('#' + URComments.TaggedPinsAray[URComments_URO_Index]).is(":checked")) {
  1741. $('#' + URComments.TaggedPinsAray[URComments_URO_Index]).trigger('click');
  1742. }
  1743. }
  1744. }
  1745. };
  1746. };
  1747. */
  1748.  
  1749. URComments.AutoClickURStatus = function() {
  1750. //try to save the state of the check box
  1751. if (URCommentAutoClickURStatus.checked) {
  1752. localStorage.setItem('AutoClickURStatus', 'yes');
  1753. //alert("yes");
  1754. } else {
  1755. localStorage.setItem('AutoClickURStatus', 'no');
  1756. //alert("no");
  1757. //turn off save after send
  1758. if (!URCommentAutoClickURStatus.checked && UrCommentSaveAfterComment.checked) {
  1759. $('#UrCommentSaveAfterComment').prop('checked', false);
  1760. localStorage.setItem('SaveAfterComment', 'no');
  1761. }
  1762.  
  1763. if (UrCommentDBLClk7DCAutoSend.checked == true || UrCommentDBLClkAll.checked == true) {
  1764. $('#URCommentAutoClickURStatus').prop('checked', true);
  1765. alert(URC_USER_PROMPT[4]); //"URComments to use the double click links you must have the autoset UR status option enabled"
  1766. localStorage.setItem('AutoClickURStatus', 'yes');
  1767. }
  1768. }
  1769. };
  1770.  
  1771. URComments.SaveAfterComment = function() {
  1772. //try to save the state of the check box
  1773. if (UrCommentSaveAfterComment.checked) {
  1774. localStorage.setItem('SaveAfterComment', 'yes');
  1775. //alert("yes");
  1776. } else {
  1777. localStorage.setItem('SaveAfterComment', 'no');
  1778. //alert("no");
  1779. }
  1780. //when save if on turn on auto click status
  1781. if (UrCommentSaveAfterComment.checked && !URCommentAutoClickURStatus.checked) {
  1782. $('#URCommentAutoClickURStatus').prop('checked', true);
  1783. localStorage.setItem('AutoClickURStatus', 'yes');
  1784. }
  1785. };
  1786.  
  1787. URComments.AutoCloseComment = function() {
  1788. //try to save the state of the check box
  1789. if (UrCommentAutoCloseComment.checked) {
  1790. localStorage.setItem('UrCommentAutoCloseComment', 'yes');
  1791. //alert("yes");
  1792. } else {
  1793. localStorage.setItem('UrCommentAutoCloseComment', 'no');
  1794. //alert("no");
  1795. }
  1796. //alert ( localStorage.getItem('UrCommentAutoCloseComment') );
  1797. };
  1798.  
  1799. // UrCommentAutoReloadAfterComment
  1800. //URComments.AutoReloadAfterComment = function() {
  1801. // UrCommentAutoReloadAfterComment
  1802. //try to save the state of the check box
  1803. // if (UrCommentAutoReloadAfterComment.checked) {
  1804. // localStorage.setItem('AutoReloadAfterComment', 'yes');
  1805. //alert("yes");
  1806. // } else {
  1807. // localStorage.setItem('AutoReloadAfterComment', 'no');
  1808. //alert("no");
  1809. // }
  1810. //};
  1811.  
  1812. URComments.ZoomOutAfterComment = function() {
  1813. if (UrCommentZoomOutAfterComment.checked) {
  1814. localStorage.setItem('ZoomOutAfterComment', 'yes');
  1815. //alert("yes");
  1816. } else {
  1817. localStorage.setItem('ZoomOutAfterComment', 'no');
  1818. //alert("no");
  1819. }
  1820. };
  1821.  
  1822. URComments.AutoSetNewComment = function() {
  1823. //add reply instructions to replies
  1824. //try to save the state of the check box
  1825. if (UrCommentAutoSetNewComment.checked) {
  1826. localStorage.setItem('AutoSetNewComment', 'yes');
  1827. //alert(" AutoSetNewComment yes");
  1828. } else {
  1829. localStorage.setItem('AutoSetNewComment', 'no');
  1830. //alert("AutoSetNewComment no");
  1831. }
  1832. };
  1833.  
  1834. URComments.UrCommentAutoSet4dayComment = function() {
  1835. //add reply instructions to replies
  1836. //try to save the state of the check box
  1837. if (UrCommentAutoSet4dayComment.checked) {
  1838. localStorage.setItem('UrCommentAutoSet4dayComment', 'yes');
  1839. //alert(" UrCommentAutoSet4dayComment yes");
  1840. } else {
  1841. localStorage.setItem('UrCommentAutoSet4dayComment', 'no');
  1842. //alert("UrCommentAutoSet4dayComment no");
  1843. }
  1844. };
  1845.  
  1846. URComments.NewZoomIn = function() {
  1847. //add reply instructions to replies
  1848. //try to save the state of the check box
  1849. if (UrCommentNewZoomIn.checked) {
  1850. localStorage.setItem('NewZoomIn', 'yes');
  1851. //alert(" NewZoomIn yes");
  1852. } else {
  1853. localStorage.setItem('NewZoomIn', 'no');
  1854. //alert("NewZoomIn no");
  1855. }
  1856.  
  1857. };
  1858.  
  1859. URComments.WithCommentRecenter = function() {
  1860. //add reply instructions to replies
  1861. //try to save the state of the check box
  1862. if (UrCommentWithCommentRecenter.checked) {
  1863. localStorage.setItem('WithCommentRecenter', 'yes');
  1864. //alert(" WithCommentRecenter yes");
  1865. } else {
  1866. localStorage.setItem('WithCommentRecenter', 'no');
  1867. //alert("WithCommentRecenter no");
  1868. }
  1869.  
  1870. };
  1871.  
  1872. URComments.AutoSwitchToURCommentsTab = function() {
  1873. // AutoSwitchToURCommentsTab
  1874. //try to save the state of the check box
  1875. if (UrCommentAutoSwitchToURCommentsTab.checked) {
  1876. localStorage.setItem('AutoSwitchToURCommentsTab', 'yes');
  1877. //alert("yes");
  1878. } else {
  1879. localStorage.setItem('AutoSwitchToURCommentsTab', 'no');
  1880. //alert("no");
  1881. }
  1882. };
  1883.  
  1884. //UrCommentDBLClk7DCAutoSend
  1885. URComments.DBLClk7DCAutoSend = function() {
  1886. if (UrCommentDBLClk7DCAutoSend.checked) {
  1887. //save the selection
  1888. localStorage.setItem('DBLClk7DCAutoSend', 'yes');
  1889.  
  1890. $('#URCommentAutoClickURStatus').prop('checked', true);
  1891. localStorage.setItem('AutoClickURStatus', 'yes');
  1892.  
  1893. } else {
  1894. localStorage.setItem('DBLClk7DCAutoSend', 'no');
  1895. }
  1896.  
  1897. //clear the html from the tabs
  1898. $("#sidepanel-Comments").html('');
  1899. //reload the content
  1900. ChangeLanguage = true;
  1901.  
  1902. //setTimeout(URComments_bootstrap, 20);
  1903. URComments_bootstrap();
  1904.  
  1905. };
  1906.  
  1907. //UrCommentDBLClkAll
  1908. URComments.DBLClkAll = function() {
  1909. if (UrCommentDBLClkAll.checked) {
  1910. localStorage.setItem('DBLClkAll', 'yes');
  1911.  
  1912. $('#URCommentAutoClickURStatus').prop('checked', true);
  1913. localStorage.setItem('AutoClickURStatus', 'yes');
  1914. } else {
  1915. localStorage.setItem('DBLClkAll', 'no');
  1916. }
  1917.  
  1918. //clear the html from the tabs
  1919. $("#sidepanel-Comments").html('');
  1920. //reload the content
  1921. ChangeLanguage = true;
  1922.  
  1923. //setTimeout(URComments_bootstrap, 20);
  1924. URComments_bootstrap();
  1925. };
  1926.  
  1927. ///////////////////////////////////////////////////////////////////////
  1928. //////
  1929. ////// UR Comment functions
  1930. //////
  1931. ///////////////////////////////////////////////////////////////////////
  1932.  
  1933. URComments.escapeHtml = function(a) {
  1934. a = a.replace(/&/g, "&amp;");
  1935. a = a.replace(/</g, "&lt;");
  1936. a = a.replace(/>/g, "&gt;");
  1937. a = a.replace(/"/g, "&quot;");
  1938. a = a.replace(/'/g, "&#039;");
  1939. return a;
  1940. };
  1941.  
  1942. //$( "#update-request-panel .solution p").html()
  1943. URComments.StringSwap = function(a) {
  1944.  
  1945. if ($("#update-request-panel .solution p").length > 0) {
  1946. a = a.replace("$URD", $("#update-request-panel .solution p").html());
  1947. //remove stupid waze spaces
  1948. //a = $(".new-comment-text").val()
  1949. a = a.replace(/ /g, "");
  1950. a = a.replace(/ /g, "");
  1951. a = a.replace(/(\r\n|\n)/gm, "");
  1952. } else if ($(".description .content").length > 0) {
  1953. a = a.replace("$URD", $(".description .content").html());
  1954. a = a.replace(/ /g, "");
  1955. a = a.replace(/ /g, "");
  1956. a = a.replace(/(\r\n|\n)/gm, "");
  1957. a = a.replace("$USERNAME", Waze.model.loginManager.user.userName);
  1958. } else if (a.indexOf("$URD") >= 0) {
  1959. //a = "";
  1960. a = a.replace(" \"$URD\"", "");
  1961. }
  1962.  
  1963. //selected segments
  1964. var streetName = "";
  1965. if (W.selectionManager.selectedItems.length >= 1 && W.selectionManager.selectedItems.length <= 2) {
  1966. for (var i = 0; i < W.selectionManager.selectedItems.length; i++) {
  1967. if (W.selectionManager.selectedItems[i].model.CLASS_NAME == "Waze.Feature.Vector.Segment") {
  1968. var primaryStreetID = W.selectionManager.selectedItems[i].model.attributes.primaryStreetID;
  1969. if (i == 0) {
  1970. streetName = W.model.streets.objects[primaryStreetID].name;
  1971. } else {
  1972. streetName = "the intersection of " + streetName + " and " + W.model.streets.objects[primaryStreetID].name;
  1973. }
  1974. }
  1975. }
  1976. console.log(streetName);
  1977. a = a.replace("$SELSEGS", streetName);
  1978. }
  1979. return a;
  1980. };
  1981.  
  1982. //gets the total number of comments on a ur
  1983. TotalNumberOfComments = function(urID) {
  1984. urcToConsole("reporterComments");
  1985. return ($(wazeModel.updateRequestSessions.objects[urID].comments).length);
  1986. };
  1987.  
  1988. //sorry URO if i was going to use you to sort Urs i needed to use the same dates you do! Thanks! ;)
  1989. URComments.uroGetCommentAge = function(commentObj) {
  1990. if (commentObj.createdOn === null) return -1;
  1991. return URComments.uroDateToDays(commentObj.createdOn);
  1992. };
  1993.  
  1994. URComments.uroDateToDays = function(dateToConvert) {
  1995. var dateNow = new Date();
  1996. var elapsedSinceEpoch = dateNow.getTime();
  1997. var elapsedSinceEvent = elapsedSinceEpoch - dateToConvert;
  1998. dateNow.setHours(0);
  1999. dateNow.setMinutes(0);
  2000. dateNow.setSeconds(0);
  2001. dateNow.setMilliseconds(0);
  2002. var elapsedSinceMidnight = elapsedSinceEpoch - dateNow.getTime();
  2003. if (elapsedSinceEvent < elapsedSinceMidnight) {
  2004. // event occurred today...
  2005. return 0;
  2006. } else {
  2007. // event occurred at some point prior to midnight this morning, so return a minimum value of 1...
  2008. return 1 + Math.floor((elapsedSinceEvent - elapsedSinceMidnight) / 86400000);
  2009. }
  2010. };
  2011.  
  2012. URComments.onScreen = function(obj) {
  2013.  
  2014. //geometry was removed from Waze.model.mapUpdateRequests.objects[id]
  2015. //but can be found in Waze.model.mapUpdateRequests.objects[id].geometry
  2016.  
  2017. if (obj.geometry) {
  2018. return (Waze.map.getExtent().intersectsBounds(obj.geometry.getBounds()));
  2019. }
  2020. return false;
  2021. };
  2022.  
  2023. URComments.URCLoadUpdateRequestsEvents = function() {
  2024. /*
  2025. W.model.mapUpdateRequests.events.register("objectschanged", null, uroFilterURs_onObjectsChanged);
  2026. W.model.mapUpdateRequests.events.register("objectsadded", null, uroFilterURs_onObjectsAdded);
  2027. W.model.mapUpdateRequests.events.register("objectsremoved", null, uroFilterURs_onObjectsRemoved);
  2028.  
  2029. W.model.updateRequestSessions.events.register("objectschanged", null, uroUREvent_onObjectsChanged);
  2030. W.model.updateRequestSessions.events.register("objectsadded", null, uroUREvent_onObjectsAdded);
  2031. W.model.updateRequestSessions.events.register("objectsremoved", null, uroUREvent_onObjectsRemoved);
  2032. */
  2033.  
  2034. window.HideUR = "stopped";
  2035. //W.model.mapUpdateRequests.events.register("objectschanged", null, URComments.urcUREvent_onObjectsAdded('mapUpdateRequests objectschanged')); //needed
  2036. //W.model.updateRequestSessions.events.register("objectsadded", null, URComments.urcUREvent_onObjectsAdded('updateRequestSessions objectsadded'));
  2037.  
  2038. //from Cardyin 5/26/2016
  2039. W.model.mapUpdateRequests.on("objectschanged", URComments.urcUREvent_onObjectsAdded('mapUpdateRequests objectschanged')); //needed
  2040. W.model.updateRequestSessions.on("objectsadded", URComments.urcUREvent_onObjectsAdded('updateRequestSessions objectsadded')); //needed
  2041.  
  2042.  
  2043. //W.model.updateRequestSessions.events.register("objectschanged", null, URComments.urcUREvent_onObjectsAdded('updateRequestSessions objectschanged')); // this launches every time a UR is opened
  2044. //needed
  2045.  
  2046.  
  2047. W.map.events.register("moveend", null, URComments.urcUREvent_onObjectsAdded('moveend')); //needed
  2048. W.map.events.register("zoomend", null, URComments.urcUREvent_onObjectsAdded('zoomend')); //needed
  2049. //W.map.events.register("mouseup", null, URComments.urcUREvent_onObjectsAdded('mouseup'));
  2050.  
  2051. //urcToConsole("UR events added");
  2052.  
  2053. //setTimeout(URComments.urcUREvent_onObjectsAdded('pageload'), 1000);
  2054. setTimeout(URComments.urcUREvent_onObjectsAdded('pageload'), 50);
  2055. };
  2056.  
  2057.  
  2058. URComments.urcUREvent_onObjectsAdded = function(a) {
  2059. return function() {
  2060.  
  2061. //check if filtering or the pill count are enabled other wise abort this function
  2062. //URCommentsFilterEnabled URCommentsPillEnabled
  2063. if (URCommentsFilterEnabled.checked === false && URCommentsPillEnabled.checked === false && URCommentsAutoSendMyReminders.checked === false) {
  2064. urcToConsole(URC_USER_PROMPT[5]); //"aborting FilterURs2 becasue both filtering, counts, and auto reminders are disabled"
  2065. return;
  2066. }
  2067.  
  2068. urcToConsole("urcUREvent_onObjectsAdded " + a + " " + window.HideUR);
  2069.  
  2070. if (a == "timedout" && window.HideUR == "running") { //|| a === "list is empty retry"){
  2071. window.HideUR = "stopped";
  2072. a = "timedout";
  2073. URComments.ShowWMEMessage(URC_USER_PROMPT[6], 5000); //"URComments: Loading UR data has timed out, retrying."
  2074. }
  2075.  
  2076. if (window.HideUR === "stopped" && a !== "timedout") {
  2077. clearTimeout(window.buffertedtimeout);
  2078. clearTimeout(window.buffertedtimeout2);
  2079.  
  2080. urcToConsole("set time-out to filter UR and time-out check " + a + " " + window.HideUR);
  2081.  
  2082. //certain events need to be launched a bit later then others
  2083. if (a == "moveend" || a == "zoomend") {
  2084. window.buffertedtimeout = setTimeout(URComments.FilterURs(a), 2000);
  2085. } else {
  2086. window.buffertedtimeout = setTimeout(URComments.FilterURs(a), 500);
  2087. }
  2088.  
  2089. window.HideUR = "running";
  2090. window.BufferFillterURCommand = false;
  2091. window.buffertedtimeout2 = setTimeout(URComments.urcUREvent_onObjectsAdded("timedout"), 30000);
  2092. } else {
  2093. urcToConsole("aborted: " + a + " " + window.HideUR);
  2094. }
  2095.  
  2096. };
  2097. };
  2098.  
  2099. URComments.FilterURs = function(a, b) {
  2100. return function() {
  2101.  
  2102. urcToConsole("Start Filtering URs - " + a);
  2103. for (var i = 0; i < W.map.layers.length; i++) {
  2104. if (W.map.layers[i].uniqueName == 'update_requests') window.uroURLayerIdx = i;
  2105. //if(W.map.layers[i].uniqueName == 'problems') uroProblemLayerIdx = i;
  2106. //if(W.map.layers[i].name == 'Spotlight') uroMaskLayer = i;
  2107. //if(W.map.layers[i].uniqueName == 'speed_cameras') uroCamLayer = i;
  2108. //if(W.map.layers[i].name.indexOf('Waze.Control.SelectHighlightFeature') !== -1) uroRootContainer = W.map.layers[i].div.id;
  2109. //if(W.map.layers[i].uniqueName == 'area_managers') uroAMLayerIdx = i;
  2110. //if(W.map.layers[i].uniqueName == 'landmarks') uroPlacesRoot = W.map.layers[i].id + '_vroot';
  2111. //if(W.map.layers[i].name == 'Node Connections') uroTurnsLayerIdx = i;
  2112. }
  2113.  
  2114. var CloseDays = $('#CloseDays').val();
  2115. //check that all visible urs are loaded
  2116. var idList = [];
  2117. var allID = "";
  2118. var PushNeededCount = 0;
  2119.  
  2120. for (var urID in W.model.mapUpdateRequests.objects) {
  2121.  
  2122. if (W.model.updateRequestSessions.objects[urID] == null) {
  2123. idList.push(urID);
  2124. PushNeededCount = PushNeededCount + 1;
  2125. }
  2126.  
  2127. if (PushNeededCount > 500) {
  2128. //urcToConsole('trash grabbing updateRequestSessions with IDs ' + idList);
  2129. W.model.updateRequestSessions.get(idList);
  2130. idList = [];
  2131. PushNeededCount = 0;
  2132. urcToConsole('over 1k ur');
  2133. }
  2134. }
  2135.  
  2136. if (idList.length > 0) {
  2137. //urcToConsole('trash grabbing updateRequestSessions with IDs ' + idList);
  2138. W.model.updateRequestSessions.get(idList);
  2139. }
  2140.  
  2141. //abort filtering URs if the list is empty
  2142. if (Object.keys(W.model.updateRequestSessions.objects).length === 0) {
  2143. window.HideUR = "stopped";
  2144. urcToConsole("no Ur in active sessions");
  2145. setTimeout(URComments.urcUREvent_onObjectsAdded("list is empty retry"), 5000);
  2146. return;
  2147. }
  2148.  
  2149. var urdescription = "";
  2150. var EditorID = Waze.model.loginManager.user.id; //editor's id number
  2151. var ReminderReload = false;
  2152. var TotalVisibleURCount = 0;
  2153. var CountOfIdInList = 0;
  2154. var DelayTimeoutCountOfIdInList = 0;
  2155.  
  2156. for (var id1 in W.model.mapUpdateRequests.objects) {
  2157. TotalVisibleURCount = TotalVisibleURCount + 1;
  2158. if (URComments.onScreen(W.model.mapUpdateRequests.objects[id1])) {
  2159. allID = allID + id1 + ",";
  2160. CountOfIdInList = CountOfIdInList + 1;
  2161. }
  2162.  
  2163. if (CountOfIdInList >= 500) {
  2164. urcToConsole("reached 500 UR requesting list: " + DelayTimeoutCountOfIdInList);
  2165. //play with putting a timeout between each group requested
  2166. setTimeout(URComments.FilterURs2(a, allID, TotalVisibleURCount), DelayTimeoutCountOfIdInList);
  2167.  
  2168. CountOfIdInList = 0;
  2169. allID = "";
  2170. DelayTimeoutCountOfIdInList = DelayTimeoutCountOfIdInList + 1000;
  2171. }
  2172. }
  2173.  
  2174. urcToConsole("reached end of UR list requesting list: " + DelayTimeoutCountOfIdInList);
  2175. $("#URCount").html(TotalVisibleURCount);
  2176. setTimeout(URComments.FilterURs2(a, allID, TotalVisibleURCount), 0);
  2177. };
  2178. };
  2179.  
  2180.  
  2181. URComments.FilterURs2 = function(a, allID, TotalVisibleURCount) {
  2182. return function() {
  2183. urcToConsole("FilterURs2 TotalVisibleURCount: " + TotalVisibleURCount);
  2184.  
  2185. var CloseDays = ($('#CloseDays').val() * 1);
  2186. var ReminderDays = ($('#ReminderDays').val() * 1);
  2187. var ClosePlussReminderDays = CloseDays + ReminderDays;
  2188. var urdescription = "";
  2189. var EditorID = Waze.model.loginManager.user.id; //editor's id number
  2190. var ReminderReload = false;
  2191. var LoggedInEditor = Waze.model.loginManager.user.userName;
  2192. var openingUR;
  2193. r = require("Waze/Feature/Vector/ProblemResolution");
  2194.  
  2195. if (allID !== "") {
  2196. //this is the link that works but I think it is grabbing a cached version of the page var urSessionURL = 'https://www.waze.com/2tes-live/app/MapProblems/UpdateRequests?ids=' + allID;
  2197.  
  2198. //https://www.waze.com/Descartes-live/app/MapProblems/UpdateRequests?ids=4284449
  2199. var urSessionURL = 'https://' + window.location.host + Waze.Config.api_base + '/MapProblems/UpdateRequests?ids=' + allID + "&time=" + (new Date()).getTime();
  2200.  
  2201. urcToConsole("urSessionURL: " + a + " " + urSessionURL);
  2202.  
  2203. // https://www.waze.com/Descartes-live/app/MapProblems/UpdateRequests?ids=3678676
  2204. var LastCommentorUserID = "0";
  2205.  
  2206. //urcToConsole("trash36");
  2207. $.ajax({
  2208. dataType: "json",
  2209. //dataType: 'jsonp',
  2210. url: urSessionURL,
  2211.  
  2212. success: function(json) {
  2213. try {
  2214.  
  2215. for (jsnObj = 0; jsnObj < $(json.updateRequestSessions.objects).length; jsnObj++) {
  2216. var urDetail = json.updateRequestSessions.objects[jsnObj];
  2217. var id = urDetail.id;
  2218. var skip = false;
  2219. var urStyle = 'shown';
  2220. var i = 0;
  2221. var Marked = "";
  2222. var UrcURType = "";
  2223. var urdescription = W.model.mapUpdateRequests.objects[id].attributes.description;
  2224.  
  2225. if (urDetail.comments.length === 0) {
  2226. var InitialurType = Waze.model.mapUpdateRequests.objects[id].attributes.type;
  2227. }
  2228. var NumberOfComments = urDetail.comments.length;
  2229. var CountsBGColor = "#FFFF99"; //light yellow
  2230.  
  2231. if (NumberOfComments > 0) {
  2232. var reporterResponse = false;
  2233. var lastCommentDateTime = 0;
  2234. var LastComment = "";
  2235.  
  2236. for (i = 0; i < urDetail.comments.length; i++) {
  2237. if (urDetail.comments[i].userID == -1) {
  2238. reporterResponse = true;
  2239. }
  2240. lastCommentDateTime = urDetail.comments[i].createdOn;
  2241. LastCommentorUserID = urDetail.comments[i].userID;
  2242. LastComment = urDetail.comments[i].text;
  2243. //only white if logged in editor has the last editor comment
  2244. if (LastCommentorUserID > 1) {
  2245. if (LastCommentorUserID === EditorID) {
  2246. CountsBGColor = "white";
  2247. } else {
  2248. CountsBGColor = "#FFFF99"; //light yellow
  2249. }
  2250. }
  2251. //NOTE, ROADWORKS, CONSTRUCTION, CLOSURE, EVENT,
  2252.  
  2253. var Commenttext = urDetail.comments[i].text;
  2254. //urcToConsole(Commenttext + " " + id);
  2255. if (Commenttext.indexOf("NOTE]") >= 0 || Commenttext.indexOf("ROADWORKS]") >= 0 || Commenttext.indexOf("CONSTRUCTION]") >= 0 || Commenttext.indexOf("CLOSURE]") >= 0 || Commenttext.indexOf("EVENT]") >= 0 || Commenttext.indexOf(LoggedInEditor) >= 0) {
  2256. //urcToConsole("skipped1 URO+ tagged in comments urid: " + id + "with comment text " + Commenttext);
  2257. skip = true;
  2258. }
  2259.  
  2260. if (Commenttext.indexOf(LoggedInEditor) >= 0 && URCommentsReplaceTagWithEditorName.checked === true) {
  2261. Marked = LoggedInEditor;
  2262. } else if (Commenttext.indexOf("NOTE]") >= 0) {
  2263. Marked = "Note";
  2264. } else if (Commenttext.indexOf("ROADWORKS]") >= 0) {
  2265. Marked = "Roadworks";
  2266. } else if (Commenttext.indexOf("CONSTRUCTION]") >= 0) {
  2267. Marked = "Construction";
  2268. } else if (Commenttext.indexOf("CLOSURE]") >= 0) {
  2269. Marked = "Closure";
  2270. } else if (Commenttext.indexOf("EVENT]") >= 0) {
  2271. Marked = "Event";
  2272. }
  2273. if(URCommentsDontShowTaggedText.checked === true && Marked !== ""){
  2274. Marked = "DontShowTaggedText";
  2275. }
  2276. //urcToConsole("Marked " + Marked);
  2277.  
  2278. }
  2279.  
  2280. //if (LastCommentorUserID === EditorID) {
  2281. // CountsBGColor = "white";
  2282. //}
  2283.  
  2284. //urcToConsole("LastComment: " + LastComment + " " + id);
  2285. }
  2286.  
  2287. var lastCommentAge = URComments.uroDateToDays(lastCommentDateTime);
  2288. //urcToConsole('Responder: reporter response for ' + id + ' = ' + reporterResponse + ', last comment on ' + lastCommentDateTime + ', comment age in days = ' + lastCommentAge + ' number of comments = ' + i);
  2289.  
  2290. //urdescription = W.model.mapUpdateRequests.objects[id].attributes.description;
  2291. //urcToConsole("urdescription: " + urdescription + " " + id);
  2292.  
  2293. if (urdescription) {
  2294. //urcToConsole("urdescription present: " + urdescription + " " + id);
  2295. //skip tagged URs
  2296. if (urdescription.indexOf("NOTE]") >= 0 || urdescription.indexOf("ROADWORKS]") >= 0 || urdescription.indexOf("CONSTRUCTION]") >= 0 || urdescription.indexOf("CLOSURE]") >= 0 || urdescription.indexOf("EVENT]") >= 0 || urdescription.indexOf(LoggedInEditor) >= 0) {
  2297. //urcToConsole("skipped2 URO+ tagged in description urid: " + id + "with comment text " + urdescription);
  2298. skip = true;
  2299. }
  2300.  
  2301. if (urdescription.indexOf(LoggedInEditor) >= 0 && URCommentsReplaceTagWithEditorName.checked === true) {
  2302. Marked = LoggedInEditor;
  2303. } else if (urdescription.indexOf("NOTE]") >= 0) {
  2304. Marked = "Note";
  2305. } else if (urdescription.indexOf("ROADWORKS]") >= 0) {
  2306. Marked = "Roadworks";
  2307. } else if (urdescription.indexOf("CONSTRUCTION]") >= 0) {
  2308. Marked = "Construction";
  2309. } else if (urdescription.indexOf("CLOSURE]") >= 0) {
  2310. Marked = "Closure";
  2311. } else if (urdescription.indexOf("EVENT]") >= 0) {
  2312. Marked = "Event";
  2313. } else if (urdescription.indexOf("WSLM]") >= 0) {
  2314. Marked = "WSLM";
  2315. }
  2316. if(URCommentsDontShowTaggedText.checked === true && Marked !== ""){
  2317. Marked = "DontShowTaggedText";
  2318. }
  2319.  
  2320. if (URCommentsHideWithDescript.checked == true && NumberOfComments <= 0) {
  2321. UrcURType = UrcURType + " WithDescription";
  2322. //urcToConsole("UrcURType WithDescription: " + id);
  2323. }
  2324. //urcToConsole("skipped2 tagged in description urid: " + id + "with comment text " + Commenttext);
  2325. } else {
  2326. if (URCommentsHideWithoutDescript.checked == true && NumberOfComments <= 0) {
  2327. UrcURType = UrcURType + " WithoutDescription";
  2328. //urcToConsole("UrcURType WithoutDescription: " + id);
  2329. }
  2330. }
  2331.  
  2332. if (W.model.mapUpdateRequests.objects[id].attributes.open === false) {
  2333. skip = true;
  2334. // UrcURType = "IsClosed";
  2335.  
  2336. }
  2337.  
  2338. //urcToConsole("just before skipping, skip is " + skip + " " + id);
  2339. //Waze.model.mapUpdateRequests.objects[id].type == "mapUpdateRequest"
  2340. if (skip === false && W.model.mapUpdateRequests.objects[id].type == "mapUpdateRequest") {
  2341.  
  2342. // && URComments.onScreen(Waze.model.mapUpdateRequests.objects[id])
  2343.  
  2344. if (NumberOfComments > 0) {
  2345.  
  2346. //4 day UR if there is only one comment, if the comment is less or equal to the editors setting, and if the last comment was not made by the driver
  2347. if (NumberOfComments === 1 && ReminderDays > 0 && lastCommentAge >= ReminderDays && LastCommentorUserID > 1) {
  2348. urcToConsole("URComments2 - 4day URID: " + id);
  2349. //direct link to a UR https://www.waze.com/editor/?zoom=5&lat=41.586201000000024&lon=-88.060863&layers=1957&mapUpdateRequest=4048801
  2350.  
  2351. if (URCommentsHideReminderNeeded.checked == true) {
  2352. UrcURType = UrcURType + " NeedsReminder";
  2353. }
  2354.  
  2355. if (LastCommentorUserID === EditorID && URCommentsAutoSendMyReminders.checked == true && $('[data-id="' + id + '"]').hasClass('ReminderSent') === false && EditorID > 0) {
  2356. urcToConsole("reminder needed UR: " + LastComment + " " + id);
  2357.  
  2358. Waze.model.updateRequestSessions.objects[id].addComment(URCommentsArray[ReminderPosistion + 1]);
  2359.  
  2360. //toggleFollowConversation true or false
  2361. if ($("#URCommentURUnfollow").is(":checked")) {
  2362. setTimeout(URComments.toggleFollowConversation(id), 0);
  2363. }
  2364.  
  2365. URComments.ShowWMEMessage(URC_USER_PROMPT[7] + id, 2500); //"URComments: Adding reminder message to UR: "
  2366.  
  2367. //attempting to stop double reminders from being sent by adding a class that we can check for before sending the reminder
  2368. $('[data-id="' + id + '"]').addClass('ReminderSent');
  2369.  
  2370. //set to hide if hide in between states is checked
  2371. if (URCommentsHideInbetween.checked == true) {
  2372. UrcURType = UrcURType + " InBetweenStates";
  2373. }
  2374.  
  2375. }
  2376.  
  2377.  
  2378. //7 day if the number of comments are greater than or equal to 1, days past are more then 7, the last comment was not from the driver, and number of comments are less than 2
  2379.  
  2380. } else if ((NumberOfComments >= 2 && lastCommentAge >= CloseDays && LastCommentorUserID > 1) || (NumberOfComments >= 1 && ReminderDays == 0 && lastCommentAge >= CloseDays && LastCommentorUserID > 1)) {
  2381. //urcToConsole("close needed UR: " + LastComment + " " + id);
  2382.  
  2383. //hide or show UR that need closing
  2384. if (URCommentsHideCloseNeeded.checked == true && UrcURType === "") {
  2385. UrcURType = UrcURType + " NeedsClose";
  2386. }
  2387.  
  2388. //everyones stale 2 comment URS
  2389. } else if (LastCommentorUserID > 0) {
  2390. //in between states waiting for replies or time to elapse
  2391. //urcToConsole("hiding ur 2: " + id);
  2392. if (URCommentsHideInbetween.checked == true) {
  2393. UrcURType = UrcURType + " InBetweenStates";
  2394. }
  2395. }
  2396.  
  2397. //last comment was a user reply; change the pin color to blue or peach
  2398. if (LastCommentorUserID < 1) {
  2399. if (CountsBGColor == "white") {
  2400. CountsBGColor = "#79B5C7"; //light blue
  2401. } else {
  2402. CountsBGColor = "#FFCC99"; //peach
  2403. }
  2404.  
  2405. if (URCommentsHideReplies.checked == true) {
  2406. UrcURType = UrcURType + " HasUserReplies";
  2407. }
  2408.  
  2409. } else if (lastCommentAge > ClosePlussReminderDays && CountsBGColor !== "white") {
  2410. CountsBGColor = "#FF8B8B"; //light red
  2411. }
  2412.  
  2413. //yellow at close days workaround
  2414. //urcToConsole("yellow at close days workaround " + CountsBGColor + " NumberOfComments: " +NumberOfComments + "lastCommentAge: " +lastCommentAge + " CloseDays" + CloseDays + " LastCommentorUserID: " + LastCommentorUserID + "urid: " + id);
  2415. //alert("yellow at close days workaround " + CountsBGColor + " NumberOfComments: " +NumberOfComments + "lastCommentAge: " +lastCommentAge + " CloseDays" + CloseDays + " ReminderDays: " + ReminderDays + " LastCommentorUserID: " + LastCommentorUserID + "urid: " + id);
  2416.  
  2417. if (CountsBGColor == "#FFFF99" && NumberOfComments >= 1 && lastCommentAge >= ClosePlussReminderDays && LastCommentorUserID > 1) {
  2418. CountsBGColor = "#FF8B8B"; //light red
  2419. }
  2420. /*
  2421. if (CountsBGColor == "#FFFF99") {
  2422. if (ReminderDays === 0 && NumberOfComments >= 1 && lastCommentAge >= CloseDays && LastCommentorUserID > 1) {
  2423. CountsBGColor = "#FF8B8B"; //light red
  2424. } else if (ReminderDays > 0 && NumberOfComments >= 1 && lastCommentAge >= CloseDays && LastCommentorUserID > 1) {
  2425. CountsBGColor = "#CC00FF"; //light red
  2426. }
  2427. }
  2428. */
  2429.  
  2430.  
  2431.  
  2432.  
  2433. }
  2434. //zero comments
  2435. } else {
  2436. urcToConsole("skipped UR: " + id);
  2437. }
  2438. //skipped
  2439. //urcToConsole("check for urcounts class; comment count " + i );
  2440. //urcToConsole("trash58");
  2441.  
  2442. if (lastCommentAge === undefined) {
  2443. lastCommentAge = "?";
  2444. }
  2445.  
  2446. var Message = "";
  2447. if (Marked == "DontShowTaggedText" ){
  2448. Message = i + "c " + lastCommentAge + "d";
  2449. CountsBGColor = "#CCCCCC"; //light grey
  2450. } else if (Marked !== "") {
  2451. Message = Marked + " " + i + "c";
  2452. CountsBGColor = "#CCCCCC"; //light grey
  2453. } else {
  2454. Message = i + "c " + lastCommentAge + "d";
  2455. }
  2456.  
  2457. //urcToConsole("message " + Message);
  2458. //urcToConsole("Marked " + Marked);
  2459.  
  2460.  
  2461. //if the ur is tagged or has more than 0 comments reorder the ur stacking
  2462. if (Marked !== "" || i > 0) {
  2463.  
  2464. var MessageOffset = Message.length;
  2465. if (MessageOffset < 10) {
  2466. MessageOffset = MessageOffset * 1.4;
  2467. } else {
  2468. MessageOffset = MessageOffset * 2.3;
  2469. }
  2470. MessageOffset = "-" + MessageOffset + "px";
  2471. //urcToConsole("message " + Message);
  2472. if (CountsBGColor == "#CCCCCC") { //light grey
  2473. $('[data-id="' + id + '"]').css({
  2474. 'z-index': '999'
  2475. });
  2476. } else if (CountsBGColor == "white" || CountsBGColor == "#79B5C7") {
  2477. $('[data-id="' + id + '"]').css({
  2478. 'z-index': '998'
  2479. });
  2480. //).style.visibility
  2481. } else if (CountsBGColor == "#FF8B8B") { //light red
  2482. $('[data-id="' + id + '"]').css({
  2483. 'z-index': '997'
  2484. });
  2485. }
  2486. if (URCommentsPillEnabled.checked === true) {
  2487. //add URC bubble
  2488. if ($('[data-id="' + id + '"] .URCounts').hasClass('URCounts') === false) {
  2489. $('[data-id="' + id + '"]').append($("<div>").css("clear", "both")
  2490. .css("margin-bottom", "10px")
  2491.  
  2492. .append($("<div>").html(Message)
  2493. .css("color", "black")
  2494. .css("background", CountsBGColor)
  2495. .css("position", "absolute")
  2496. .css("top", "30px")
  2497. .css("right", MessageOffset)
  2498.  
  2499. .css("display", "block")
  2500. .css("width", "auto")
  2501. .css("white-space", "nowrap")
  2502. .css("padding-left", "5px")
  2503. .css("padding-right", "5px")
  2504.  
  2505. .css("border", "1px solid")
  2506. .css("border-radius", "25px")
  2507.  
  2508. .addClass('URCounts')
  2509. )
  2510. );
  2511.  
  2512. } else {
  2513. $('[data-id="' + id + '"] .URCounts').html(Message);
  2514. $('[data-id="' + id + '"] .URCounts').css("background", CountsBGColor);
  2515. $('[data-id="' + id + '"] .URCounts').css("right", MessageOffset);
  2516. }
  2517.  
  2518. //end of URC bubble
  2519. }
  2520. }
  2521.  
  2522.  
  2523. //console.log(a);
  2524.  
  2525. //URC UR Filtering
  2526.  
  2527. var uroURFiltersActive = false; // var used to keep track if we actually need to show / hide the UR pins
  2528.  
  2529. if (sessionStorage.UROverview_hasActiveURFilters == undefined) {
  2530. //condsole.log("old version of URO, need to use existing UI-parsing test...");
  2531.  
  2532. //these are all of the tags that URO uses to filter URs. If any of the settings are enabled set a var to let URO do the filterenabled
  2533. if ($("#_cbFilterWazeAuto").is(":checked") || $("#_cbFilterIncorrectTurn").is(":checked") || $("#_cbFilterIncorrectAddress").is(":checked") || $("#_cbFilterIncorrectRoute").is(":checked") || $("#_cbFilterMissingRoundabout").is(":checked") || $("#_cbFilterGeneralError").is(":checked") || $("#_cbFilterTurnNotAllowed").is(":checked") || $("#_cbFilterIncorrectJunction").is(":checked") || $("#_cbFilterMissingBridgeOverpass").is(":checked") || $("#_cbFilterWrongDrivingDirection").is(":checked") || $("#_cbFilterMissingExit").is(":checked") || $("#_cbFilterMissingRoad").is(":checked") || $("#_cbFilterBlockedRoad").is(":checked") || $("#_cbFilterMissingLandmark").is(":checked") || $("#_cbFilterUndefined").is(":checked") || $("#_cbFilterRoadworks").is(":checked") || $("#_cbFilterConstruction").is(":checked") || $("#_cbFilterClosure").is(":checked") || $("#_cbFilterEvent").is(":checked") || $("#_cbFilterNote").is(":checked") || $("#_cbInvertURFilter").is(":checked") || $("#_cbFilterOpenUR").is(":checked") || $("#_cbFilterClosedUR").is(":checked") || $("#_cbFilterSolved").is(":checked") || $("#_cbFilterUnidentified").is(":checked") || $("#_cbEnableMinAgeFilter").is(":checked") || $("#_cbEnableMaxAgeFilter").is(":checked") || $("#_cbURDescriptionMustBePresent").is(":checked") || $("#_cbURDescriptionMustBeAbsent").is(":checked") || $("#_cbEnableKeywordMustBePresent").is(":checked") || $("#_cbEnableKeywordMustBeAbsent").is(":checked") || $("#_cbCaseInsensitive").is(":checked") || $("#_cbHideMyComments").is(":checked") || $("#_cbHideAnyComments").is(":checked") || $("#_cbHideIfLastCommenter").is(":checked") || $("#_cbHideIfNotLastCommenter").is(":checked") || $("#_cbHideIfReporterLastCommenter").is(":checked") || $("#_cbHideIfReporterNotLastCommenter").is(":checked") || $("#_cbEnableMinCommentsFilter").is(":checked") || $("#_cbEnableMaxCommentsFilter").is(":checked") || $("#_cbHideMyFollowed").is(":checked") || $("#_cbHideMyUnfollowed").is(":checked") || $("#_cbEnableCommentAgeFilter2").is(":checked") || $("#_cbEnableCommentAgeFilter").is(":checked") || $("#_cbURUserIDFilter").is(":checked") || $("#_cbURResolverIDFilter").is(":checked")) {
  2534. uroURFiltersActive = true; //at least one of URO's UR checkboxes were enabledPlugin
  2535. }
  2536. } else if (sessionStorage.UROverview_hasActiveURFilters == "true") {
  2537. //console.log("new version of URO is actively filtering UR markers...");
  2538. uroURFiltersActive = true; //twisters URO active filter bit is set to true
  2539. }
  2540.  
  2541.  
  2542. if (uroURFiltersActive === true && URCommentsFilterEnabled.checked === true) {
  2543. URComments.ShowWMEMessage(URC_USER_PROMPT[8], 5000); //"URComment's UR Filtering has been disabled because URO\'s UR filters are active."
  2544. $('#URCommentsFilterEnabled').prop('checked', false);
  2545. $(localStorage.setItem('URCommentsFilterEnabled', URCommentsFilterEnabled.checked));
  2546. }
  2547.  
  2548. if (URCommentsFilterEnabled.checked == true && uroURFiltersActive === false) {
  2549. //check if we should hide URO stype tagged UR
  2550. if (URCommentsHideNotes.checked == true && Marked !== "") {
  2551. UrcURType = UrcURType + " IsTagged";
  2552. } else if (Marked !== "" && UrcURType !== "IsClosed") {
  2553. UrcURType = UrcURType + " 1";
  2554. }
  2555.  
  2556. //check if not "my" ur
  2557. //if(URCommentsHideNotMyUR.checked == true && NumberOfComments > 0 && lastCommentAge <= CloseDays ){
  2558. if (URCommentsHideNotMyUR.checked == true && NumberOfComments > 0) {
  2559. //light red, peach, light yellow
  2560. //if(CountsBGColor == "#FF8B8B" || CountsBGColor == "#FFCC99" || CountsBGColor == "#FFFF99"){
  2561. if (CountsBGColor == "#FFCC99" || CountsBGColor == "#FFFF99" || CountsBGColor == "#FF8B8B") {
  2562. UrcURType = UrcURType + " NotMyUR";
  2563. }
  2564. }
  2565. //URCommentsShowPastClose
  2566. //check if not "my" ur
  2567. if (URCommentsShowPastClose.checked == true && NumberOfComments > 0 && lastCommentAge > ClosePlussReminderDays) {
  2568. //light red, peach, light yellow
  2569. //if(CountsBGColor == "#FF8B8B" || CountsBGColor == "#FFCC99" || CountsBGColor == "#FFFF99"){
  2570. if (CountsBGColor == "#FFCC99" || CountsBGColor == "#FFFF99" || CountsBGColor == "#FF8B8B") {
  2571. if(UrcURType.indexOf("HasUserReplies") < 0){
  2572. UrcURType = " ShowPastClose";
  2573. }
  2574. }
  2575. }
  2576.  
  2577. //initial UR no comments
  2578. if (urDetail.comments.length === 0 && URCommentsHideInital.checked == true) {
  2579. UrcURType = UrcURType + " initial";
  2580. }
  2581.  
  2582.  
  2583. //urcToConsole('UrcURType: ' + UrcURType);
  2584.  
  2585. //show or hide URs|| NumberOfComments > 3 || NumberOfComments < 3
  2586.  
  2587. if (W.model.mapUpdateRequests.objects[id].attributes.open === false) {
  2588. if (URCommentsHideClosed.checked == true) {
  2589. UrcURType = UrcURType + " IsClosed";
  2590. } else {
  2591. UrcURType = UrcURType + " ClosedNotHiden";
  2592. }
  2593. }
  2594. if (UrcURType.indexOf("IsTagged") > 0) { //|| NumberOfComments > 2
  2595. //urcToConsole('UR is tagged and set to be hidden');
  2596. urStyle = 'hidden';
  2597.  
  2598. } else if (UrcURType.indexOf("InBetweenStates") > 0 || UrcURType.indexOf("NeedsReminder") > 0 || UrcURType.indexOf("NeedsClose") > 0 || UrcURType.indexOf("initial") > 0 || UrcURType.indexOf("HasUserReplies") > 0 || UrcURType.indexOf("IsClosed") > 0 || UrcURType.indexOf("NotMyUR") > 0 || UrcURType.indexOf("WithoutDescription") > 0 || UrcURType.indexOf("WithDescription") > 0 ) {
  2599. urStyle = 'hidden';
  2600. } else {
  2601. urStyle = 'visible';
  2602. }
  2603. //console.log("id: " + id + " UrcURType: " + UrcURType + " urStyle: " + urStyle + " Marked: " + Marked);
  2604. //W.map.layers[uroURLayerIdx].markers[id].icon.imageDiv.style.visibility = urStyle;
  2605. $('[data-id="' + id + '"]').css("visibility", urStyle);
  2606. //urcToConsole('next ur ' + id);
  2607.  
  2608. //when filtering is disable and URO filters are disabled reshow all the UR
  2609. } else if (URCommentsFilterEnabled.checked == false && uroURFiltersActive === false) {
  2610. //urcToConsole('UR filtering is disabled showing all ur ' + id);
  2611. urStyle = 'visible';
  2612. // W.map.layers[uroURLayerIdx].markers[id].icon.imageDiv.style.visibility = urStyle;
  2613. $('[data-id="' + id + '"]').css("visibility", urStyle);
  2614. }
  2615.  
  2616.  
  2617. }
  2618. window.HideUR = "stopped";
  2619. //urcToConsole('rem done filtering UR, Total UR: ' + TotalVisibleURCount);
  2620.  
  2621. //URComments.ShowWMEMessage("URComments: Machete808Count: " + window.Machete808Count,600000);
  2622. //alert(CountsBGColor);
  2623.  
  2624. } catch (e) {
  2625.  
  2626. setTimeout(URComments.FilterURs('error retry'), 1000);
  2627. urcToConsole('Responder: error obtaining UR response = ' + e);
  2628. //window.HideUR = "stopped";
  2629. }
  2630. }
  2631. });
  2632. urcToConsole("" + a + " total visible: " + TotalVisibleURCount); // + " allID " + allID);
  2633. //window.HideUR = "stopped";
  2634.  
  2635. } else {
  2636. //urcToConsole("no UR aborting");
  2637. window.HideUR = "stopped";
  2638. }
  2639.  
  2640. };
  2641. };
  2642.  
  2643. URComments.OpenNextUR = function(message, delay) {
  2644. return function() {
  2645. setTimeout(URComments.OpenNextUR(a, allID, TotalVisibleURCount), 0);
  2646.  
  2647. };
  2648. };
  2649.  
  2650. URComments.ShowWMEMessage = function(message, delay) {
  2651. //if ($("#URCMapNote").length <= 0){
  2652. //delay = 10000;
  2653. var dateNow = new Date();
  2654. TrickRemove = dateNow.getTime();
  2655.  
  2656. //var message = "URComments UR Filtering has been disabled because URO\'s UR filters are active.";
  2657. //var message = "URComments: Can not find the comment box! In order for this script to work you need to have a user request open."
  2658. //var message = "URComments: Adding reminder message to UR: 4239896"
  2659. //delay = 10000;
  2660. //message = "test";
  2661. var width = message.length * 10;
  2662. //message holder div
  2663. var c = '<div id="URCMessage" style="width: 100%; font-size: 15px; font-weight: bold; margin-left: auto; margin-right: auto; position: absolute; top: 0px; left: 10px; z-index: 1000;"></div>';
  2664. $("#map").append(c);
  2665. //message div
  2666. var d = '<div id="URCMapNote' + TrickRemove + '" style="width: ' + width + 'px; font-size: 15px; font-weight: bold; margin-left: auto; margin-right: auto; background-color: orange;"><center><b>' + message + '</b></center></div>';
  2667. $("#URCMessage").append(d);
  2668. //remove messages after the duration has passed
  2669. $("#URCMapNote" + TrickRemove).show().delay(delay).queue(function(n) {
  2670. $(this).remove();
  2671. n();
  2672. });
  2673. //}
  2674. };
  2675.  
  2676.  
  2677.  
  2678. /*
  2679. CountsBGColor = "#FFFF99"; //light yellow = UR that are waiting for the last editor but still has time before the Close days setting ex 7 days
  2680. CountsBGColor = "#CCCCCC"; //light grey = URO styled notes ex [NOTE]
  2681. CountsBGColor = "#FFCC99"; //peach = another editor before the close days has gone by has user reply
  2682. CountsBGColor = "#FF8B8B"; //light red = past the close days setting and is now able to be taken over by another editor
  2683. CountsBGColor = "white"; = UR that "belong to the editor logged in that need work
  2684. CountsBGColor = "#79B5C7"; //light blue = UR that "belong to the editor logged in that have user replies
  2685.  
  2686.  
  2687. White = The editor logged in has comments on the UR and the UR needs work
  2688. light blue = The editor logged in has comments on the UR and the UR's last comment was a user reply
  2689. light red = past the close days setting and is now able to be taken over by another editor
  2690.  
  2691. light yellow = UR that are waiting for the another editor to send a reminder or to be closed but still has time before the Close days setting (ex 7 days)
  2692. peach = UR that another editor had commented on but the last comment is a user reply
  2693.  
  2694. light grey = URO styled notes ex [NOTE]
  2695.  
  2696. */
  2697.  
  2698.  
  2699.  
  2700. //save what comment list is selected and then build the tab
  2701. URComments.BoilerPlateCreatorsFunction = function() {
  2702. if (BoilerPlateCreators.value !== "---User's Lists---") {
  2703.  
  2704. //unset all the previuos lists kb shortcuts
  2705. var ScriptName = 'URC' + localStorage.getItem('BoilerPlateCreators');
  2706. for (var name in Waze.accelerators.Actions) {
  2707. if (Waze.accelerators.Actions[name].group == ScriptName) {
  2708. Waze.accelerators.Actions[name].enabled = false;
  2709. }
  2710. }
  2711. //save the selection
  2712. localStorage.setItem('BoilerPlateCreators', BoilerPlateCreators.value);
  2713.  
  2714. //clear the html from the tabs
  2715. $("#sidepanel-Comments").html('');
  2716. //reload the content
  2717. ChangeLanguage = true;
  2718.  
  2719. //setTimeout(URComments_bootstrap, 20);
  2720. URComments_bootstrap();
  2721. } else {
  2722. $("#BoilerPlateCreators").val(localStorage.getItem('BoilerPlateCreators'));
  2723. }
  2724. };
  2725.  
  2726.  
  2727. URComments.URCommentZoomOutcheck = function(Title, URStatus) {
  2728. return function() {
  2729. urcToConsole("zoom out URCommentZoomOutcheck");
  2730.  
  2731. //this is the new place for zooming out and will still be happening while the comment is sending
  2732. //zoom out option - if the user option is set to reload map after posting a comment reply
  2733. if (UrCommentZoomOutAfterComment.checked === true) {
  2734. urcToConsole("zoom out ZoomOutAfterComment enabled");
  2735. setTimeout(URComments.SetZoomCloseUR(ReturnToCurrentZoom, "LeaveOpen"), 0);
  2736. } else {
  2737. //alert("autozoomout not checked");
  2738. }
  2739. setTimeout(URComments.URCommentSendBtnClicked(Title, URStatus), 20);
  2740. };
  2741. };
  2742.  
  2743. URComments.URCommentSendBtnClicked = function(Title, URStatus) {
  2744.  
  2745. //waze is weird and after clicking send button the close button had to be refound, which takes a few seconds for the new close button to be drawn
  2746. // so we wait 1500 milliseconds before looking for the close button
  2747. //since we are passing vars to the next function we have to pass this to handler function so it doesn't happen on click
  2748.  
  2749. //the above is still true but what i have found is that it sometimes takes a while from clicking send to the comment actually posting. there was time when i closed the comment before it actually posted and it would have to be redone. so added a check and a timeout and recheck if the textarea isn't empty. afterwards we can re-grab and click the close button
  2750. return function() {
  2751. //grab the close button to compare to later
  2752. CloseButtonHolder = $(".problem-panel-navigation button.close-button");
  2753.  
  2754. //check to see if the comments went through before saving or closing the comment
  2755. if ($(".new-comment-text").val() !== "" && $(".new-comment-text").val() !== undefined) {
  2756. urcToConsole('the send button was clicked, Waiting for the comment to send. ' + PauseCount);
  2757. urcToConsole("current comment = " + $(".new-comment-text").val());
  2758. urcToConsole("current comment = ");
  2759. PauseCount++;
  2760. setTimeout(URComments.URCommentSendBtnClicked(Title, URStatus), 20);
  2761. } else {
  2762. urcToConsole('The comment went through, jumping to CloseDelayHack2');
  2763. PauseCount = "1";
  2764.  
  2765. //check if we want to unfollow
  2766. if ($("#URCommentURUnfollow").is(":checked") && $("#follow-on").is(":checked")) {
  2767. //$('#follow-on').trigger('click');
  2768. //setTimeout(URComments.URCommentSendBtnClicked(Title, URStatus), 20);
  2769. var urID = $(".update-requests .selected").data("id");
  2770. //urcToConsole("toggleFollowConversation id " + urID);
  2771. //Waze.model.updateRequestSessions.objects[urID].toggleFollowConversation('false');
  2772. setTimeout(URComments.toggleFollowConversation(urID), 500);
  2773. }
  2774. //delay this command for uro not to freakout on refreshing uro bubble ur count
  2775. setTimeout(URComments.CloseDelayHack2(Title, URStatus), 100);
  2776.  
  2777. }
  2778. };
  2779. };
  2780.  
  2781.  
  2782. URComments.toggleFollowConversation = function(urID) {
  2783. return function() {
  2784. urcToConsole("toggleFollowConversation id " + urID);
  2785. Waze.model.updateRequestSessions.objects[urID].toggleFollowConversation('false');
  2786. };
  2787. };
  2788.  
  2789.  
  2790. //this checks to see if the Waze's save button is waiting to be clicked.
  2791. //currently unused
  2792. URComments.WazeSaveWaiting = function() {
  2793. if ($(".WazeControlSave").hasClass('ItemInactive')) {
  2794. return true;
  2795. } else {
  2796. return false;
  2797. }
  2798. };
  2799.  
  2800. URComments.CloseDelayHack2 = function(Title, URStatus) {
  2801. return function() {
  2802. urcToConsole("CloseDelayhack2 " + Title + " " + URStatus);
  2803.  
  2804. PauseCount = "1";
  2805. urcToConsole("New close button");
  2806. //wrap the code in the finding of the new close button
  2807.  
  2808. //now that we found the new close button and send was clicked
  2809.  
  2810. //lets check if we should click close or save
  2811. //when clicking save you dint need to click close
  2812.  
  2813. //this checks to see if the Waze's save button is waiting to be clicked.
  2814. //URComments.WazeSaveWaiting()
  2815.  
  2816. if (URStatus.toLowerCase() === "solved" || URStatus.toLowerCase() === "notidentified") {
  2817. urcToConsole("CloseDelayhack2 Solved or NotIdentified- Clicking Save");
  2818. //this clicks the waze save btn
  2819. if (URCommentAutoClickURStatus.checked === true && UrCommentSaveAfterComment.checked === true) {
  2820. //click save
  2821. //$('#toolbar #edit-buttons .WazeControlSave').trigger('click');
  2822. //from Cardyin 5/26/2016
  2823. $('.toolbar-button.waze-icon-save').trigger('click');
  2824. } else if (UrCommentAutoCloseComment.checked) {
  2825. $(".problem-panel-navigation button.close-button").trigger('click');
  2826. }
  2827.  
  2828. } else {
  2829. //when not saving you have to click close.
  2830. urcToConsole("CloseDelayhack2 since we are not saving click the close button");
  2831. if (UrCommentAutoCloseComment.checked) {
  2832. urcToConsole("CloseDelayhack2 auto close option checked");
  2833.  
  2834.  
  2835. //normal editor
  2836. if ($(".problem-panel-navigation button.close-button").length !== 0) {
  2837. urcToConsole("zoom out CloseDelayHack2 normal editor");
  2838. $(".problem-panel-navigation button.close-button").trigger('click');
  2839. }
  2840.  
  2841. //beta editor
  2842. if ($(".problem-edit .header .close-panel").length !== 0) {
  2843. urcToConsole("zoom out CloseDelayHack2 beta editor");
  2844. $(".problem-edit .header .close-panel").trigger('click');
  2845. //setTimeout(function() {
  2846. // $('a .close-popover').trigger('click');
  2847. // }, 2000);
  2848. }
  2849.  
  2850. //since saving above reloads the map we need this reload only to happen when we dont click save
  2851. //auto reload map for non save urs
  2852. //if (UrCommentAutoReloadAfterComment.checked) {
  2853. // setTimeout(URComments.AutoReloadMapOnComment, 500);
  2854. //}
  2855. }
  2856. }
  2857.  
  2858. urcToConsole("end of saving or closing comment");
  2859. //}
  2860.  
  2861. //this is the new place for zooming out and will still be happening while the comment is sending
  2862. //zoom out option - if the user option is set to reload map after posting a comment reply
  2863. if (UrCommentZoomOutAfterComment.checked === true) {
  2864. urcToConsole("zoom out CloseDelayHack2");
  2865. setTimeout(URComments.SetZoomCloseUR(ReturnToCurrentZoom, "LeaveOpen"), 0);
  2866. } else {
  2867. //alert("autozoomout not checked");
  2868. }
  2869.  
  2870. setTimeout(URComments.urcUREvent_onObjectsAdded('URCommentsReload'), 0);
  2871.  
  2872. };
  2873. };
  2874.  
  2875. URComments.SetZoomCloseUR = function(a, b) {
  2876. //this sets the map zoom; 0 is all the way out; 10 is all the way in but next to useless (the map and sat views disappear);
  2877. //the closest zoom that shows the sat and map is zoom 9
  2878. return function() {
  2879. urcToConsole("Setting map zoom to: " + a + " with flag: " + b);
  2880. //alert(a + " " + b);
  2881. Waze.map.setCenter(Waze.map.getCenter(), a);
  2882. //close ur if zooming out to
  2883. if (b === "CloseUR") {
  2884. //alert(b);
  2885.  
  2886. //normal editor
  2887. /* if ($(".problem-panel-navigation button.close-button").length !== 0) {
  2888. $(".problem-panel-navigation button.close-button").trigger('click');
  2889. }
  2890. */
  2891. //beta editor
  2892. if ($(".problem-edit .header .close-panel").length !== 0) {
  2893. $(".problem-edit .header .close-panel").trigger('click');
  2894. // setTimeout(function() {
  2895. // $('a .close-popover').trigger('click');
  2896. // }, 2000);
  2897. }
  2898. }
  2899. };
  2900. };
  2901.  
  2902. URComments.AutoReloadMapOnComment = function() {
  2903. //waze together with URO is buggy i have to close the comment window before reloading the map or the pin ends up getting stuck on for all URO filters and it takes a page reload to fix it.
  2904. // to get URO to rescan urs that have been commented on you have to reload the map this also causes URO to hide the ones that no longer fit the current URO filters like when using my pre-sets
  2905. //click the reload button for the map
  2906. $(".controls-container .fa-repeat.reload-button").trigger('click');
  2907. };
  2908.  
  2909. URComments.ConfirmToConsole = function() {
  2910. //over ride the default action of the standard confirm by writing confirm to a new function nconfirm, making a 'fake' confirm and then restoring confirm by copying the nconfirm back over confirm!
  2911. nconfirm = confirm;
  2912. confirm = function(msg) {
  2913. //if ((I18n.translations[I18n.locale].update_requests.panel.confirm == msg) && (uroGetCBChecked('_cbDisablePendingQuestions') == true)) {
  2914. urcToConsole('URComment confirm redirected to console: ' + msg);
  2915. return true;
  2916. };
  2917. };
  2918.  
  2919. URComments.RestoreConfirmToConfirm = function() {
  2920. //restore the normal action of confirm by writing nconfirm to back over confirm, so the site is able to send user messages outside of my script!
  2921. confirm = nconfirm;
  2922. };
  2923.  
  2924. URComments.AutoZoomIN = function(Title, Comment, URStatus, urID, AutoSendComment) {
  2925. return function() {
  2926. urcToConsole("AutoZoomIN");
  2927. var URCommentsUnsavedDetected = false;
  2928. var URCommentsUnsaveCount = $(".WazeControlSave .counter").html();
  2929.  
  2930. //detect unsaved changed if there are and the auto save option is on abort adding comments to the UR
  2931. if (URCommentsUnsaveCount > 0 && $("#UrCommentSaveAfterComment").is(":checked") && URStatus.toLowerCase() !== "open") {
  2932. URCommentsUnsavedDetected = true;
  2933. alert(URC_USER_PROMPT[9]); //"UrComments has detected that you have unsaved changes!\n\nWith the Auto Save option enabled and with unsaved changes you cannot send comments that would require the script to save. Please save your changes and then re-click the comment you wish to send."
  2934. }
  2935. //URCommentsUnsavedDetected = true;
  2936.  
  2937. //get urid for manually clicked comments
  2938. if (urID === 0 || urID === "" || urID === undefined) {
  2939. urID = $(".update-requests .selected").data("id");
  2940. }
  2941.  
  2942. //check to see if the auto zoom in option in enabled if it is start the zooming in process
  2943. urcToConsole("AutoZoomIN checking if we should zoom in based of if the Title is the same as the reminder title: " + Title + " pointer title: " + URCommentsArray[ReminderPosistion] + " urID: " + urID);
  2944. //having OneOrTheOTher first is a hack to make the logic work
  2945. var OneOrTheOTher = "no";
  2946.  
  2947. if (UrCommentNewZoomIn.checked === true && Title !== URCommentsArray[ReminderPosistion] && Title !== URCommentsArray[CloseNotIdentifiedPosistion] && AutoSendComment !== "AutoSendComment") {
  2948. OneOrTheOTher = "yes";
  2949. }
  2950.  
  2951. //alert(OneOrTheOTher);
  2952. if (OneOrTheOTher === "yes" && URCommentsUnsavedDetected === false) {
  2953.  
  2954. urcToConsole("AutoZoomIN zooming to location");
  2955.  
  2956. //predefined zoom threshold for auto zoom
  2957. var zoom = 4;
  2958.  
  2959. //do not zoom back out if we are already zoomed in and just happen to be re-clicking on a UR.
  2960. //or we have the map set good for a 4-day reminder
  2961. var WazeCurrentZoom = URComments.GetWazeMapZoomLevel();
  2962.  
  2963. if (WazeCurrentZoom < zoom) {
  2964. URComments.gotoURById(urID, 5);
  2965. }
  2966.  
  2967. //setTimeout(URComments.AutoZoomIN2(Title, Comment, URStatus), 2500);
  2968. setTimeout(URComments.PostURComment(Title, Comment, URStatus, AutoSendComment, urID), 1);
  2969.  
  2970. } else if (URCommentsUnsavedDetected === false) {
  2971.  
  2972. //auto zoom in is disabled jump to postURComment
  2973. //alert("else");
  2974. urcToConsole("AutoZoomIN disabled to PostURComment id - " + urID);
  2975. //we have to use set timeout here because we need the return function() in PostURComment
  2976. //for when we are zooming in and out for the reminder
  2977. //since we are not zooming here jump rigth to PostURComment
  2978. setTimeout(URComments.PostURComment(Title, Comment, URStatus, AutoSendComment, urID), 1);
  2979. }
  2980.  
  2981. };
  2982. };
  2983.  
  2984. URComments.CrossHairsClicked = function(urID, zoom) {
  2985. return function() {
  2986. setTimeout(URComments.gotoURById(urID, 5), 500);
  2987. };
  2988. };
  2989. URComments.gotoURById = function(urID, zoom) {
  2990. //alert(urID);
  2991. //$('span[id="WME_AutoUR_Count"]').html((WMEAutoUR.Auto.index+1)+"/"+WMEAutoUR.Auto.UR_len);
  2992. //save zoom so we can return this the current zoom level
  2993. ReturnToCurrentZoom = URComments.GetWazeMapZoomLevel();
  2994. var x;
  2995. if(Waze.model.mapUpdateRequests.objects[urID].attributes.geometry.realX === undefined){ //uro fix
  2996. x = Waze.model.mapUpdateRequests.objects[urID].attributes.geometry.x;
  2997. } else {
  2998. x = Waze.model.mapUpdateRequests.objects[urID].attributes.geometry.realX; //uro fix
  2999. }
  3000. //var x = Waze.model.mapUpdateRequests.objects[urID].attributes.geometry.x;
  3001. var y = Waze.model.mapUpdateRequests.objects[urID].attributes.geometry.y;
  3002.  
  3003. urcToConsole("gotoURById: " + "x: " + x + "y: " + y + "zoom: " + zoom);
  3004.  
  3005. Waze.map.setCenter([x, y], zoom);
  3006. return;
  3007. };
  3008.  
  3009. URComments.GetWazeMapZoomLevel = function(Title, Comment, URStatus) {
  3010. zoom = W.map.mapState.mapLocation.zoom;
  3011. urcToConsole("Current Zoom: " + zoom);
  3012. return zoom;
  3013. };
  3014.  
  3015.  
  3016. URComments.WaitForURtoOpen = function(Title, Comment, URStatus, urID, AutoSendComment) {
  3017. return function() {
  3018. if ($(".new-comment-text")[0]) {
  3019. setTimeout(URComments.AutoZoomIN(Title, Comment, URStatus, urID, AutoSendComment), 500);
  3020. } else {
  3021. setTimeout(URComments.WaitForURtoOpen(Title, Comment, URStatus, urID, AutoSendComment), 200);
  3022. }
  3023. };
  3024. };
  3025.  
  3026.  
  3027. URComments.PostURComment = function(Title, Comment, URStatus, AutoSendComment, urID) {
  3028. // the user clicked on a comment link
  3029. return function() {
  3030. //Swap out special text
  3031. Comment = URComments.StringSwap(Comment);
  3032. urcToConsole("attaching to send button " + Title + " - " + Comment + " - " + URStatus);
  3033.  
  3034. //add event listener that runs most of the options = URCommentZoomOutcheck
  3035. $('.new-comment-form .new-comment-text + .btn-default').click(URComments.URCommentZoomOutcheck(Title, URStatus));
  3036.  
  3037. //check if the comment text area is present if not alert the user to open a UR
  3038. if ($(".new-comment-text")[0]) {
  3039. urcToConsole('found comment box ' + Title + ' - ' + Comment);
  3040. $(".new-comment-text").val(Comment).change();
  3041. // $($('textarea.new-comment-text').get(0)).change();
  3042. //click the Ur status
  3043. setTimeout(URComments.CheckIfClickStatus(URStatus, AutoSendComment), 1000);
  3044. } else {
  3045. //we were unable to find an open UR
  3046. URComments.ShowWMEMessage(URC_USER_PROMPT[10], 5000); //"URComments: Can not find the comment box! In order for this script to work you need to have a user request open."
  3047. }
  3048. };
  3049. };
  3050.  
  3051. //this is part of the script that gets the maps position for the 4 day reminder map link
  3052. getQueryString = function(link, name) {
  3053. var pos = link.indexOf(name + '=') + name.length + 1;
  3054. var len = link.substr(pos).indexOf('&');
  3055. if (-1 == len) len = link.substr(pos).length;
  3056. return link.substr(pos, len);
  3057. };
  3058.  
  3059. URComments.CheckIfClickStatus = function(URStatus, AutoSendComment) {
  3060. return function() {
  3061. urcToConsole("checking ur status function: " + URStatus + " " + AutoSendComment);
  3062.  
  3063. if (URCommentAutoClickURStatus.checked === true) {
  3064. //bypass the confirm function so other site messages do not come up!
  3065. URComments.ConfirmToConsole();
  3066.  
  3067. //click the ur status options (Not identified solved, open)
  3068. if ($("#state-open").length !== 0) {
  3069. $(".problem-edit .body").scrollTop($(".problem-edit .body")[0].scrollHeight);
  3070. if (URStatus.toLowerCase() == "notidentified") {
  3071. //click Not identified
  3072. $("#state-not-identified").trigger('click');
  3073. } else if (URStatus.toLowerCase() == "solved") {
  3074. //click solved
  3075. $("#state-solved").trigger('click');
  3076. } else {
  3077. //click back on open just encase the wrong reply was clicked previously
  3078. $("#state-open").trigger('click');
  3079. }
  3080. }
  3081.  
  3082. //restores confirm function so other site messages come up!
  3083. URComments.RestoreConfirmToConfirm();
  3084. //wait for the status to change
  3085. }
  3086.  
  3087. if (AutoSendComment === "AutoSendComment") {
  3088. setTimeout(URComments.URVerfiyStatusSet(URStatus, AutoSendComment), 1);
  3089. }
  3090. };
  3091. };
  3092.  
  3093. URComments.URVerfiyStatusSet = function(URStatus, AutoSendComment) {
  3094. return function() {
  3095. urcToConsole("URVerfiyStatusSet function: " + URStatus + " " + AutoSendComment);
  3096. var URStatusOk = true;
  3097.  
  3098. if (URCommentAutoClickURStatus.checked === true) {
  3099.  
  3100. if (URStatus.toLowerCase() == "notidentified") {
  3101. //click Not identified
  3102. if ($("#state-not-identified").is(":checked") == false) {
  3103. URStatusOk = false;
  3104. }
  3105. } else if (URStatus.toLowerCase() == "solved") {
  3106. //click solved
  3107. if ($("#state-solved").is(":checked") == false) {
  3108. URStatusOk = false;
  3109. }
  3110. } else {
  3111. //click back on open just encase the wrong reply was clicked previously
  3112. if ($("#state-open").is(":checked") == false) {
  3113. URStatusOk = false;
  3114. }
  3115. }
  3116.  
  3117. }
  3118.  
  3119. if (URStatusOk == true) {
  3120.  
  3121. setTimeout(URComments.AutoClickSend(URStatus, AutoSendComment), 1);
  3122. } else {
  3123. urcToConsole("UR Status has yet to change waiting 250ms");
  3124. setTimeout(URComments.URVerfiyStatusSet(URStatus, AutoSendComment), 150);
  3125. }
  3126.  
  3127. };
  3128. };
  3129.  
  3130. URComments.AutoClickSend = function(URStatus, AutoSendComment) {
  3131. return function() {
  3132. urcToConsole("checking if we are auto clicking the send button");
  3133. if (AutoSendComment === "AutoSendComment") {
  3134. urcToConsole("Auto clicking the send button");
  3135. $('.new-comment-form .new-comment-text + .btn-default').trigger('click');
  3136. }
  3137. };
  3138. };
  3139.  
  3140. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  3141. ////
  3142. //// on start-up keep checking the site to see if the me tab is loaded
  3143. ////
  3144. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  3145.  
  3146. URComments.startcode = function() {
  3147. // Check if WME is loaded, if not, waiting a moment and checks again. if yes init URComments
  3148. //try {
  3149. //look for the me tab instead if the buggy chat room!
  3150.  
  3151.  
  3152.  
  3153. if($("#user-details").length){
  3154. urcToConsole("Found user-details window");
  3155. URComments.init();
  3156. } else {
  3157. //console.log("not def");
  3158. urcToConsole("Could not find user-details window");
  3159. setTimeout(URComments.startcode, 2000);
  3160. }
  3161.  
  3162.  
  3163. /* var element = $("#user-details");
  3164. urcToConsole("Found user-details window");
  3165. if (typeof element !== "undefined" && element.value !== '') {
  3166. //urcToConsole("Test2");
  3167. URComments.init();
  3168. //urcToConsole("Test3");
  3169. } else {
  3170. setTimeout(URComments.startcode, 2000);
  3171. }*/
  3172. /* catch (err) {
  3173. urcToConsole(err);
  3174. if (err === "TypeError: element is null" || err === "TypeError: element is null") {
  3175. setTimeout(URComments.startcode, 2000);
  3176. }
  3177. setTimeout(URComments.startcode, 2000);
  3178. */
  3179. // }
  3180. };
  3181.  
  3182.  
  3183. /*
  3184. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  3185. //// URO Preset Filters
  3186. ////
  3187. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  3188.  
  3189. //URO+ these are the tags of all of the items URO uses to filter URs
  3190. URComments.UROCheckboxesArray = ["_cbFilterWazeAuto",
  3191. "_cbFilterIncorrectTurn", //
  3192. "_cbFilterIncorrectAddress", //
  3193. "_cbFilterIncorrectRoute", //
  3194. "_cbFilterMissingRoundabout", //
  3195. "_cbFilterGeneralError", //
  3196. "_cbFilterTurnNotAllowed", //
  3197. "_cbFilterIncorrectJunction", //
  3198. "_cbFilterMissingBridgeOverpass", //
  3199. "_cbFilterWrongDrivingDirection", //
  3200. "_cbFilterMissingExit", //
  3201. "_cbFilterMissingRoad", //
  3202. "_cbFilterBlockedRoad", //
  3203. "_cbFilterMissingLandmark", //
  3204. "_cbFilterUndefined", //
  3205. //"_cbFilterCryosphere", //
  3206. "_cbFilterRoadworks", //
  3207. "_cbFilterConstruction", //
  3208. "_cbFilterClosure", //
  3209. "_cbFilterEvent", //
  3210. "_cbFilterNote", //
  3211. "_cbInvertURFilter", //
  3212. "_cbFilterOpenUR", //
  3213. "_cbFilterClosedUR", //
  3214. "_cbFilterSolved", //
  3215. "_cbFilterUnidentified", //
  3216. "_cbEnableMinAgeFilter", //
  3217. "_cbEnableMaxAgeFilter", //
  3218. "_cbURDescriptionMustBePresent", //
  3219. "_cbURDescriptionMustBeAbsent", //
  3220. "_cbEnableKeywordMustBePresent", //
  3221. "_cbEnableKeywordMustBeAbsent", //
  3222. "_cbCaseInsensitive", //
  3223. "_cbHideMyComments", //
  3224. "_cbHideAnyComments", //
  3225. "_cbHideIfLastCommenter", //
  3226. "_cbHideIfNotLastCommenter", //
  3227. "_cbHideIfReporterLastCommenter", //
  3228. "_cbHideIfReporterNotLastCommenter", //
  3229. "_cbEnableMinCommentsFilter", //
  3230. "_cbEnableMaxCommentsFilter", //
  3231. "_cbHideMyFollowed", //
  3232. "_cbHideMyUnfollowed", //
  3233. "_cbEnableCommentAgeFilter2", //
  3234. "_cbEnableCommentAgeFilter", //
  3235. "_cbNoFilterForTaggedURs", //
  3236. "_cbURUserIDFilter", //Without comments from user
  3237. "_cbURResolverIDFilter" //Not resolved by user
  3238. ];
  3239.  
  3240. URComments.UROPresetHighlight = function(a) {
  3241. if (a === "URONewNoDescription") {
  3242. $('#URONewNoDescription').css('background-color', '#FFFF66');
  3243. $('#URCommentURONEW').css('background-color', '');
  3244. $('#URCommentURO4DayFollowUp').css('background-color', '');
  3245. $('#URCommentURO7Day').css('background-color', '');
  3246. $('#URCommentURO8Day').css('background-color', '');
  3247. $('#URCommentURO10Day').css('background-color', '');
  3248. $('#URCommentURO24Hr').css('background-color', '');
  3249. }
  3250.  
  3251. if (a === "UroShowNew") {
  3252. $('#URONewNoDescription').css('background-color', '');
  3253. $('#URCommentURONEW').css('background-color', '#FFFF66');
  3254. $('#URCommentURO4DayFollowUp').css('background-color', '');
  3255. $('#URCommentURO7Day').css('background-color', '');
  3256. $('#URCommentURO8Day').css('background-color', '');
  3257. $('#URCommentURO10Day').css('background-color', '');
  3258. $('#URCommentURO24Hr').css('background-color', '');
  3259. }
  3260. if (a === "URO4DayFollowUp") {
  3261. $('#URONewNoDescription').css('background-color', '');
  3262. $('#URCommentURONEW').css('background-color', '');
  3263. $('#URCommentURO4DayFollowUp').css('background-color', '#FFFF66');
  3264. $('#URCommentURO7Day').css('background-color', '');
  3265. $('#URCommentURO8Day').css('background-color', '');
  3266. $('#URCommentURO10Day').css('background-color', '');
  3267. $('#URCommentURO24Hr').css('background-color', '');
  3268. }
  3269. if (a === "URO7Day") {
  3270. $('#URONewNoDescription').css('background-color', '');
  3271. $('#URCommentURONEW').css('background-color', '');
  3272. $('#URCommentURO4DayFollowUp').css('background-color', '');
  3273. $('#URCommentURO7Day').css('background-color', '#FFFF66');
  3274. $('#URCommentURO8Day').css('background-color', '');
  3275. $('#URCommentURO10Day').css('background-color', '');
  3276. $('#URCommentURO24Hr').css('background-color', '');
  3277. }
  3278. if (a === "URO8Day") {
  3279. $('#URONewNoDescription').css('background-color', '');
  3280. $('#URCommentURONEW').css('background-color', '');
  3281. $('#URCommentURO4DayFollowUp').css('background-color', '');
  3282. $('#URCommentURO7Day').css('background-color', '');
  3283. $('#URCommentURO8Day').css('background-color', '#FFFF66');
  3284. $('#URCommentURO10Day').css('background-color', '');
  3285. $('#URCommentURO24Hr').css('background-color', '');
  3286. }
  3287. if (a === "URO10Day") {
  3288. $('#URONewNoDescription').css('background-color', '');
  3289. $('#URCommentURONEW').css('background-color', '');
  3290. $('#URCommentURO4DayFollowUp').css('background-color', '');
  3291. $('#URCommentURO7Day').css('background-color', '');
  3292. $('#URCommentURO8Day').css('background-color', '');
  3293. $('#URCommentURO10Day').css('background-color', '#FFFF66');
  3294. $('#URCommentURO24Hr').css('background-color', '');
  3295. }
  3296. if (a === "URO24Hr") {
  3297. $('#URONewNoDescription').css('background-color', '');
  3298. $('#URCommentURONEW').css('background-color', '');
  3299. $('#URCommentURO4DayFollowUp').css('background-color', '');
  3300. $('#URCommentURO7Day').css('background-color', '');
  3301. $('#URCommentURO8Day').css('background-color', '');
  3302. $('#URCommentURO10Day').css('background-color', '');
  3303. $('#URCommentURO24Hr').css('background-color', '#FFFF66');
  3304. }
  3305. if (a === "UROclearUROFiltrs") {
  3306. $('#URONewNoDescription').css('background-color', '');
  3307. $('#URCommentURONEW').css('background-color', '');
  3308. $('#URCommentURO4DayFollowUp').css('background-color', '');
  3309. $('#URCommentURO7Day').css('background-color', '');
  3310. $('#URCommentURO8Day').css('background-color', '');
  3311. $('#URCommentURO10Day').css('background-color', '');
  3312. $('#URCommentURO24Hr').css('background-color', '');
  3313. }
  3314.  
  3315. };
  3316.  
  3317. URComments.UROClearClicked = function(a) {
  3318. return function() {
  3319. URComments.UROPresetHighlight(a);
  3320.  
  3321. //save the current preset so we can reaply the highlighting on startup
  3322. localStorage.setItem('UROCurrentPeset', a);
  3323.  
  3324. if ($("#sidepanel-uroverview").length) {
  3325. //alert("test");
  3326. urcToConsole("URO clear");
  3327. //this is the array used to store the URO id tags
  3328.  
  3329. //go over the array and clear all of the URO+ check boxes
  3330. for (var URComments_URO_Index = 0; URComments_URO_Index < URComments.UROCheckboxesArray.length; URComments_URO_Index = URComments_URO_Index + 1) {
  3331.  
  3332. if ($('#' + URComments.UROCheckboxesArray[URComments_URO_Index]).length <= 0) {
  3333. alert("there was an error finding URO's tag " + URComments.UROCheckboxesArray[URComments_URO_Index]);
  3334. return false;
  3335. }
  3336.  
  3337. if ($('#' + URComments.UROCheckboxesArray[URComments_URO_Index]).is(":checked")) {
  3338. //clicks the checkbox by if the checkbox is checked
  3339. $('#' + URComments.UROCheckboxesArray[URComments_URO_Index]).trigger('click');
  3340. } else {
  3341. //click check box if checkbox in unchecked
  3342. //$(document.getElementById(URComments.UROCheckboxesArray[ URComments_URO_Index ])).trigger('click');
  3343. }
  3344. }
  3345.  
  3346. // make it so uro+ doesnt filter tagged urs [NOTE]...
  3347. $('#_cbNoFilterForTaggedURs').trigger('click');
  3348. if (a === "UroShowNew") {
  3349. urcToConsole("URO show new");
  3350. //If last comment made by UR reporter? chose no
  3351. $('#_cbHideIfReporterNotLastCommenter').trigger('click');
  3352. }
  3353. if (a === "URONewNoDescription") {
  3354. //only show no user description
  3355. $('#_cbURDescriptionMustBeAbsent').trigger('click');
  3356.  
  3357. //hide reporter did not leave the last comment
  3358. $('#_cbHideIfReporterNotLastCommenter').trigger('click');
  3359.  
  3360. //Hide With more than 1 comments
  3361. $('#_cbEnableMaxCommentsFilter').trigger('click');
  3362. $('#_inputFilterMaxComments').val(1);
  3363. }
  3364. if (a === "URO4DayFollowUp") {
  3365. urcToConsole("URO 4 day");
  3366.  
  3367. //hide With less than 1 comments
  3368. $('#_inputFilterMinComments').val(1);
  3369. $('#_cbEnableMinCommentsFilter').trigger('click');
  3370.  
  3371. //Hide With more than 1 comments
  3372. $('#_inputFilterMaxComments').val(1);
  3373. $('#_cbEnableMaxCommentsFilter').trigger('click');
  3374.  
  3375. //Hide Last comment less than 4 days ago
  3376. $('#_inputFilterCommentDays2').val(4);
  3377. $('#_cbEnableCommentAgeFilter2').trigger('click');
  3378.  
  3379. }
  3380. if (a === "URO7Day") {
  3381. urcToConsole("URO 7 day");
  3382.  
  3383. //hide With less than 1 comments
  3384. $('#_inputFilterMinComments').val(1); //1
  3385. $('#_cbEnableMinCommentsFilter').trigger('click');
  3386.  
  3387. //hide Last comment less than 7 days ago
  3388. $('#_inputFilterCommentDays2').val(7);//7
  3389. $('#_cbEnableCommentAgeFilter2').trigger('click');
  3390.  
  3391. //hide If last comment made by UR reporter?
  3392. $('#_cbHideIfReporterLastCommenter').trigger('click');
  3393. }
  3394. if (a === "URO8Day") {
  3395. urcToConsole("URO 7 day");
  3396.  
  3397. //hide With less than 1 comments
  3398. $('#_inputFilterMinComments').val(1); //1
  3399. $('#_cbEnableMinCommentsFilter').trigger('click');
  3400.  
  3401. //hide Last comment less than 8 days ago
  3402. $('#_inputFilterCommentDays2').val(8);//8
  3403. $('#_cbEnableCommentAgeFilter2').trigger('click');
  3404.  
  3405. //hide If last comment made by UR reporter?
  3406. $('#_cbHideIfReporterLastCommenter').trigger('click');
  3407. }
  3408. if (a === "URO10Day") {
  3409. urcToConsole("URO 10 day");
  3410.  
  3411. //hide With less than 1 comments
  3412. $('#_inputFilterMinComments').val(1); //1
  3413. $('#_cbEnableMinCommentsFilter').trigger('click');
  3414.  
  3415. //hide Last comment less than 8 days ago
  3416. $('#_inputFilterCommentDays2').val(10);//10
  3417. $('#_cbEnableCommentAgeFilter2').trigger('click');
  3418.  
  3419. //hide If last comment made by UR reporter?
  3420. $('#_cbHideIfReporterLastCommenter').trigger('click');
  3421. }
  3422. if (a === "URO24Hr") {
  3423.  
  3424. //alanoftheberg
  3425.  
  3426. //check "Hide URs less than days old" "8" days old
  3427. $('#_inputFilterMinDays').val(8);//8
  3428. $('#_cbEnableMinAgeFilter').trigger('click');
  3429.  
  3430.  
  3431. //check "yes" on "If last comment made by UR reporter?"
  3432. $('#_cbHideIfReporterLastCommenter').trigger('click');
  3433.  
  3434. //check "With less than" and put in "1" comments
  3435. $('#_inputFilterMinComments').val(1);//1
  3436. $('#_cbEnableMinCommentsFilter').trigger('click');
  3437.  
  3438. //check "Last comment more than" "1" days ago
  3439. $('#_inputFilterCommentDays').val(1);//1
  3440. $('#_cbEnableCommentAgeFilter').trigger('click');
  3441.  
  3442. }
  3443. if (a === "UROclearUROFiltrs") {}
  3444.  
  3445. //shared URO settings except clear
  3446. if (a !== "UROclearUROFiltrs") {
  3447. $('#_cbFilterUnidentified').trigger('click');
  3448. }
  3449.  
  3450. } else {
  3451. alert("UR Overview Plus (URO+) needs to be installed to use these URO Presets.");
  3452. }
  3453. };
  3454. };
  3455. */
  3456.  
  3457. URComments.startcode();
  3458. }
  3459. //URComments_bootstrap();
  3460. setTimeout(URComments_bootstrap, 3000);