|
8 | 8 | // @require https://greasyfork.org/scripts/24851-wazewrap/code/WazeWrap.js
|
9 | 9 | // @require https://greasyfork.org/scripts/27023-jscolor/code/JSColor.js
|
10 | 10 | // @require https://greasyfork.org/scripts/27254-clipboard-js/code/clipboardjs.js
|
11 |
| -// @version 0.5.3 |
12 |
| -// @grant none |
| 11 | +// @require https://greasyfork.org/scripts/28687-jquery-ui-1-11-4-custom-min-js/code/jquery-ui-1114customminjs.js |
| 12 | +// @resource jqUI_CSS https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css |
| 13 | +// @version 2017.11.14.01 |
| 14 | +// @grant GM_addStyle |
| 15 | +// @grant GM_getResourceText |
13 | 16 | // ==/UserScript==
|
14 | 17 | //---------------------------------------------------------------------------------------
|
15 | 18 |
|
|
31 | 34 | var currColor;
|
32 | 35 |
|
33 | 36 | (function() {
|
| 37 | + var jqUI_CssSrc = GM_getResourceText("jqUI_CSS"); |
| 38 | + GM_addStyle(jqUI_CssSrc); |
| 39 | + |
34 | 40 | function bootstrap(tries) {
|
35 | 41 | tries = tries || 1;
|
36 | 42 |
|
37 |
| - if (window.W && |
38 |
| - window.W.map && |
39 |
| - window.W.model && |
40 |
| - window.W.loginManager.user && |
| 43 | + if (W && |
| 44 | + W.map && |
| 45 | + W.model && |
| 46 | + W.loginManager.user && |
41 | 47 | $ &&
|
42 |
| - window.jscolor && |
43 |
| - WazeWrap.Interface) { |
| 48 | + jscolor && |
| 49 | + unsafeWindow.WazeWrap.Interface) { |
44 | 50 | InitMapRaidOverlay();
|
45 | 51 | } else if (tries < 1000) {
|
46 | 52 | setTimeout(function () {bootstrap(tries++);}, 200);
|
|
213 | 219 | else{
|
214 | 220 | var point2 = getMousePos900913();
|
215 | 221 | var points = [new OL.Geometry.Point(userCircleCenter.lon, userCircleCenter.lat), new OL.Geometry.Point(point2.lon, point2.lat)];
|
216 |
| - var radius = WazeWrap.Geometry.calculateDistance(points); |
| 222 | + var radius = unsafeWindow.WazeWrap.Geometry.calculateDistance(points); |
217 | 223 | var circleData = {
|
218 | 224 | centerPoint : new OL.Geometry.Point(userCircleCenter.lon, userCircleCenter.lat),
|
219 | 225 | radius : radius,
|
|
275 | 281 | drawPointer(currMousePos, true);
|
276 | 282 | if(userCircleCenter){
|
277 | 283 | var points = [new OL.Geometry.Point(userCircleCenter.lon, userCircleCenter.lat), new OL.Geometry.Point(currMousePos.lon, currMousePos.lat)];
|
278 |
| - var radius = WazeWrap.Geometry.calculateDistance(points); |
| 284 | + var radius = unsafeWindow.WazeWrap.Geometry.calculateDistance(points); |
279 | 285 | drawCircle(userCircleCenter, radius);
|
280 | 286 | }
|
281 | 287 | }
|
|
362 | 368 |
|
363 | 369 | function getMousePos900913(){
|
364 | 370 | var mousePosition = $('.WazeControlMousePosition').text().split(" ");
|
365 |
| - return WazeWrap.Geometry.ConvertTo900913(mousePosition[0], mousePosition[1]); |
| 371 | + return unsafeWindow.WazeWrap.Geometry.ConvertTo900913(mousePosition[0], mousePosition[1]); |
366 | 372 | }
|
367 | 373 |
|
368 | 374 | function keyUpHandler(e){
|
|
452 | 458 |
|
453 | 459 | LoadSettingsObj();
|
454 | 460 |
|
455 |
| - WazeWrap.Interface.AddLayerCheckbox("display", "Been There", true, LayerToggled); |
| 461 | + unsafeWindow.WazeWrap.Interface.AddLayerCheckbox("display", "Been There", true, LayerToggled); |
456 | 462 |
|
457 | 463 | //append our css to the head
|
458 | 464 | var g = '.beenThereButtons {font-size:26px; color:#59899e; cursor:pointer;} .flex-container {display: -webkit-flex; display: flex; background-color:black;}';
|
|
501 | 507 | setChecked('chkBTShapeFill',beenTheresettings.FillShape);
|
502 | 508 | $('#BeenThereSettings').css({'visibility':'visible'});
|
503 | 509 | });
|
504 |
| - new WazeWrap.Interface.Shortcut('NewBoxShortcut', 'Draw a box around the visible area', 'wmebt', 'Been There', beenTheresettings.NewBoxShortcut, NewBox, null).add(); |
505 |
| - new WazeWrap.Interface.Shortcut('NewUserRectShortcut', 'Draw a rectangle', 'wmebt', 'Been There', beenTheresettings.NewUserRectShortcut, NewUserRect, null).add(); |
506 |
| - new WazeWrap.Interface.Shortcut('NewUserCircleShortcut', 'Draw a circle', 'wmebt', 'Been There', beenTheresettings.NewUserCircleShortcut, NewUserCircle, null).add(); |
507 |
| - new WazeWrap.Interface.Shortcut('RemoveLastShapeShortcut', 'Remove last shape', 'wmebt', 'Been There', beenTheresettings.RemoveLastShapeShortcut, RemoveLastBox, null).add(); |
508 |
| - new WazeWrap.Interface.Shortcut('RedoLastShapeShortcut', 'Redo last shape', 'wmebt', 'Been There', beenTheresettings.RedoLastShapeShortcut, RedoLastBox, null).add(); |
509 |
| - new WazeWrap.Interface.Shortcut('RemoveAllShapesShortcut', 'Remove all shapes', 'wmebt', 'Been There', beenTheresettings.RemoveAllShapesShortcut, RemoveAllBoxes, null).add(); |
| 510 | + new unsafeWindow.WazeWrap.Interface.Shortcut('NewBoxShortcut', 'Draw a box around the visible area', 'wmebt', 'Been There', beenTheresettings.NewBoxShortcut, NewBox, null).add(); |
| 511 | + new unsafeWindow.WazeWrap.Interface.Shortcut('NewUserRectShortcut', 'Draw a rectangle', 'wmebt', 'Been There', beenTheresettings.NewUserRectShortcut, NewUserRect, null).add(); |
| 512 | + new unsafeWindow.WazeWrap.Interface.Shortcut('NewUserCircleShortcut', 'Draw a circle', 'wmebt', 'Been There', beenTheresettings.NewUserCircleShortcut, NewUserCircle, null).add(); |
| 513 | + new unsafeWindow.WazeWrap.Interface.Shortcut('RemoveLastShapeShortcut', 'Remove last shape', 'wmebt', 'Been There', beenTheresettings.RemoveLastShapeShortcut, RemoveLastBox, null).add(); |
| 514 | + new unsafeWindow.WazeWrap.Interface.Shortcut('RedoLastShapeShortcut', 'Redo last shape', 'wmebt', 'Been There', beenTheresettings.RedoLastShapeShortcut, RedoLastBox, null).add(); |
| 515 | + new unsafeWindow.WazeWrap.Interface.Shortcut('RemoveAllShapesShortcut', 'Remove all shapes', 'wmebt', 'Been There', beenTheresettings.RemoveAllShapesShortcut, RemoveAllBoxes, null).add(); |
510 | 516 |
|
511 | 517 | //necessary to catch changes to the keyboard shortcuts
|
512 |
| - window.addEventListener("beforeunload", function() { |
| 518 | + unsafeWindow.onbeforeunload = function() { |
| 519 | + alert("Working!"); |
513 | 520 | saveSettings();
|
514 |
| - }, false); |
| 521 | + }; |
515 | 522 |
|
516 | 523 | $('[name="currColor"]').change(function() {
|
517 | 524 | currColor = '#' + $('#' + this.value)[0].jscolor.toString();
|
|
0 commit comments