This repository has been archived by the owner on Sep 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix mobile notifications on mobile chrome (#88)
* Fix mobile notifications on mobile chrome * Fix various Pokemon Name in safe sprite sheet (#89) * Fix various pokemon in Sprite sheet * fix sizing of corrected sprites * Added weather sprites * Add option to link to Worldopole (#68) * Enable Full Stats if $worldopoleURL is set * update default config * Update example.config.php * Update default.php * Update pre-index.php * fix styling * Update pre-index.php * Update pre-index.php * Improve min iv moving extra sql calc to PHP (#82) * Improvements to MinIV Script to remove to calculations from SQL * Fix Style CI Errors * Simplifying MinIV/MinLVL Query even more to share pokemon exclude list. * [fix] Spawnpoint Timers (#49) * [fix] Spawnpoint Timers * Travis * Indentation * That didnÃ't need changing. * RM fix * Show infoWindow on specific encounter when specified in querystring (#41) * Added supporting code to show the info box for a specific encounter when specified in the url. * Fixed eslint errors * Fixed CI style errors * Fixed eslint error * Adapted to new server side filtering for monkey monocle * Fixed merge conflict for develop * Fix PHP error * Fixed StyleCI errors * Fixed Travis * Potential fix to make enc_id play nice with big karp/tiny rat * Added fix for karp/rats on pgsql * Fix for certain PgSQL installs not liking || and && * Added support for encId on other forks/scanners Also a few more PgSQL compatibility fixes * StyleCI fixes * Fixes for encounter issues with miniv * Fix for Data Performance on Large Databases with Encounter Id (#84) * start to encounter fixes * Potential Fix for hidden Mons * Fixes for Travis Errors * Forget to change a variable * Fast-tracked fix for expired mons not disappearing. * Travis fixes * Support for Castform variants (#85) I'm not saying "form" twice in a commit message * Fix merge conflict when conds was still cond. * MOTD 404 fix (#87) * Fix MOTD 404 * Fixed wrong var name * Add Deoxys forms (#90) * Clean up encId code * Revert stop weather_data calls when weather overlay is disabled * Workaround for google maps api update (#92) * workaround for google maps api update * Small change to use & * possible fix for mass issue with miniv rewrite. (#93) * possible fix for mass issue with miniv rewrite. * Query fixes * Fixed bug fetch all pokemon when add to exclude min IV/lvl * Ex eligible gym filter (#86) * Ex Eligible Gym Filter * Travis CI fixes * Travis CI Style * Adds Sponsor support for EX Raids * Move EX Eligible outside the gym filter to be seen by both Gym and Raids. Added default value. * Fixed defaults for ex-raid filter * StyleCI Fixes * fixed non-ex gyms coming back up after toggling ex gyms on and off. * Changed conditional to check for fork rather than map * Fixed Castform missing weather sprite forms * Fixed mobile notifications for all platforms * Added in apache rewrite rule removed min from service worker. * minified Service Worker * Added into grunt task to minify file. Updated appropriate links to unminified version * Added nginx config into example file
- Loading branch information
1 parent
c26c553
commit 059410f
Showing
5 changed files
with
196 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/** | ||
* Push v1.0-beta | ||
* ============== | ||
* A compact, cross-browser solution for the JavaScript Notifications API | ||
* | ||
* Credits | ||
* ------- | ||
* Tsvetan Tsvetkov (ttsvetko) | ||
* Alex Gibson (alexgibson) | ||
* | ||
* License | ||
* ------- | ||
* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015-2017 Tyler Nickerson | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
/* global clients */ | ||
'use strict' | ||
|
||
function isFunction(obj) { | ||
return obj && {}.toString.call(obj) === '[object Function]' | ||
} | ||
|
||
function runFunctionString(funcStr) { | ||
if (funcStr.trim().length > 0) { | ||
// eslint-disable-next-line no-new-func | ||
var func = new Function(funcStr) | ||
if (isFunction(func)) { | ||
func() | ||
} | ||
} | ||
} | ||
|
||
function findValidClient(clients, origin) { | ||
var validClient = null | ||
for (var i = 0; i < clients.length; i++) { | ||
var client = clients[i] | ||
if (client.url === origin) { | ||
validClient = client | ||
if ('focused' in client && client.focused) { | ||
return client | ||
} | ||
} | ||
} | ||
return validClient | ||
} | ||
|
||
function sendCenterMapMessage(client, lat, lon) { | ||
client.postMessage(JSON.stringify({ | ||
action: 'centerMap', | ||
lat: lat, | ||
lon: lon | ||
})) | ||
} | ||
|
||
self.addEventListener('message', function (event) { | ||
self.client = event.source | ||
}) | ||
|
||
self.onnotificationclick = function (event) { | ||
event.notification.close() | ||
|
||
event.waitUntil(clients.matchAll({includeUncontrolled: true, type: 'window'}).then(function (clientList) { | ||
var client = findValidClient(clientList, event.notification.data.origin) | ||
|
||
if (client && 'focus' in client) { | ||
client.focus().then(function (client) { | ||
sendCenterMapMessage(client, event.notification.data.lat, event.notification.data.lon) | ||
}) | ||
} else if ('openWindow' in clients) { | ||
clients.openWindow('/').then(function (client) { | ||
sendCenterMapMessage(client, event.notification.data.lat, event.notification.data.lon) | ||
}) | ||
} | ||
})) | ||
} | ||
|
||
self.onnotificationclose = function (event) { | ||
runFunctionString(event.notification.data.onClose) | ||
|
||
/* Tell Push to execute close callback */ | ||
self.client.postMessage(JSON.stringify({ | ||
id: event.notification.data.id, | ||
action: 'close' | ||
})) | ||
} |