A userscript that makes the WME more useable in Firefox Mobile
当前为
// ==UserScript==
// @name Waze Mobile Enhancements
// @namespace http://tomputtemans.com/
// @description A userscript that makes the WME more useable in Firefox Mobile
// @include /^https:\/\/(www|beta)\.waze\.com\/(?!user\/)(.{2,6}\/)?editor.*$/
// @version 0.0.1
// @grant none
// ==/UserScript==
// Initialisation of the script, this will only run completely one time
function init(e) {
if (e && e.user == null) {
return;
}
// if you require certain features to be loaded, you can add them here
if (typeof I18n === 'undefined' || typeof W === 'undefined' || typeof W.loginManager === 'undefined') {
setTimeout(init, 200);
return;
}
setModeChangeListener();
performScript();
}
// Attempt to hook into the controller that can notify us whenever the editor's mode changes
function setModeChangeListener() {
if (!W.app || !W.app.modeController) {
setTimeout(setModeChangeListener, 400);
return;
}
W.app.modeController.model.bind('change:mode', function(model, modeId) {
if (modeId == 0) { // 0 = Default, 1 = Events
performScript();
}
});
}
function performScript() {
var styleElement = document.createElement('style');
document.head.appendChild(styleElement);
styleElement.sheet.insertRule('.modal-dialog-login { width: 100%; margin: 0; }', 0);
styleElement.sheet.insertRule('.modal-dialog-login .modal-content { width: calc(100% - 20px); }', 0);
styleElement.sheet.insertRule('#login-popup { padding: 10px; width: auto; }', 0);
styleElement.sheet.insertRule('#login-popup .login-form { padding: 15px; height: auto; }', 0);
styleElement.sheet.insertRule('.modal-dialog-login .login-title { font-size: 19px; }', 0);
styleElement.sheet.insertRule('.login-popup-links, .language-select, .welcome-message p, .title-text { display: none; }', 0);
}
init();