Plugin pour Papyrus v1.6.5

Comme le nom l'indique, ici ce sont les archives, où on met tous les vieux trucs :)

Moderators: krankyd, shirlig, slicer, Country Managers France, Forum moderators

Re: Plugin pour Papyrus

Postby slicer » Thu Oct 06, 2011 10:56 am

Alcolo, le script ne fonctionne pas sous chrome. Je vais jeter un oeil :)
FR Country Manager
.....................................................................
Samsung Galaxy Note II (GT-N7100) - Android 4.1.2Waze v3.5.3.904
Facebook | Skype : slicer59
------------------------------------------------------------
Image
slicer
Waze Champs
 
Posts: 1679
Joined: Tue Mar 02, 2010 8:08 pm
Location: WALINCOURT SELVIGNY, 59127
Has thanked: 6 times
Been thanked: 4 times

Re: Plugin pour Papyrus

Postby Tim1987 » Thu Oct 06, 2011 10:57 am

alcolo47 wrote:Version 1.2 toujours a la même URL:
http://waze-papyrus-extended-tools.googlecode.com/svn/trunk/waze.user.js

Adding chrome support (not tested)
Adding State column and http://www.waze.com support
Adding scrolling

J'ai intégré le code de tim1987 et ajouté le scrolling du tableau.

Alcolo,

Thanks for using the fix that I found and mentioning me (no need to really ;))
However, it doesn't work in Chrome right now. The newly added function GM_setValue and GM_getValue aren't supported in Chrome(/Chromium). See here.
Tim1987
 
Posts: 55
Joined: Thu Mar 17, 2011 6:00 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Plugin pour Papyrus

Postby slicer » Thu Oct 06, 2011 10:59 am

Yes Tim, pour some others chrome's extensions can handled the GM_ fonctions. I'm searching for a solution :)
FR Country Manager
.....................................................................
Samsung Galaxy Note II (GT-N7100) - Android 4.1.2Waze v3.5.3.904
Facebook | Skype : slicer59
------------------------------------------------------------
Image
slicer
Waze Champs
 
Posts: 1679
Joined: Tue Mar 02, 2010 8:08 pm
Location: WALINCOURT SELVIGNY, 59127
Has thanked: 6 times
Been thanked: 4 times

Re: Plugin pour Papyrus

Postby gogo2000 » Thu Oct 06, 2011 11:00 am

alcolo47 wrote:Version 1.2 toujours a la même URL:
http://waze-papyrus-extended-tools.googlecode.com/svn/trunk/waze.user.js

Adding chrome support (not tested)
Adding State column and http://www.waze.com support
Adding scrolling

J'ai intégré le code de tim1987 et ajouté le scrolling du tableau.


Sous chrome tes nouvelles fonctionnalités ne fonctionnent pas ainsi que le reste finalement parceque certaines commandes n'existent pas (je cite du forum anglais) :
Alcolo47 has implemented the fix for unsafewindow (in some way), but he's added other functions that don't work in Chrome. He now has the GM_setValue and GM_getValue in the code. So no go...
(Chromium website) wrote:
Chromium does not support @require, @resource, unsafeWindow, GM_registerMenuCommand, GM_setValue, or GM_getValue

Je pense qu'il est nécessaire de faire une version par type de navigateur
Gogo2000
Area Manager: France : Haute-Saône(70) + Doubs(25) + Jura(39)
Waze Android
Image
N'hésitez pas à me contacter en MP pour toute demande d'édition dans ma zone.
gogo2000
 
Posts: 204
Joined: Thu Jun 16, 2011 6:49 pm
Location: Fondremand - Haute-Saône - France
Has thanked: 4 times
Been thanked: 0 time

Re: Plugin pour Papyrus

Postby buchet37 » Thu Oct 06, 2011 11:26 am

Bonjour,

alcolo47 wrote:Version 1.2 toujours a la même URL:
http://waze-papyrus-extended-tools.googlecode.com/svn/trunk/waze.user.js

Adding chrome support (not tested)
Adding State column and http://www.waze.com support
Adding scrolling

Le scrolling est un plus, mais chez moi, l'ascenseur masque en partie les boutons de sélection des rues.
Peut-être une colonne supplémentaire à droite de la table pour réserver la place de ascenseur !!

:D Heu...
En passant...
Toujours rien de prévu pour cartouche_old
:D
Country Manager France - Area Manager Touraine
750K edits - 3500 UR - Iphone 5- waze 3.6.0.0
buchet37
Waze Champs
 
Posts: 596
Joined: Sat May 21, 2011 6:31 am
Has thanked: 3 times
Been thanked: 6 times

Re: Plugin pour Papyrus

Postby alcolo47 » Thu Oct 06, 2011 11:40 am

J'ai pas regardé pour cartouche mais je pense qu'il n'y a rien en mémoire puisque il y a un temps d'attente pour avoir les noms de rues: donc requête serveur.
CM: France
AM: France - Montauban (82)
Samsung GT-I9003 - Android 4.1.2 Cyanogenmod - Latest official Waze

Contact: G+
alcolo47
 
Posts: 436
Joined: Sat Jul 23, 2011 5:16 am
Location: Montauban (82)
Has thanked: 2 times
Been thanked: 9 times

Re: Plugin pour Papyrus

Postby slicer » Thu Oct 06, 2011 11:55 am

waze.user.zip
Voici le script modifié :
(2.12 KiB) Downloaded 42 times
J'ai trouvé :)

le problème du script, c'est ici :

Code: Select all
unsafeWindow = (function() {
    var el = document.createElement('p');
    el.setAttribute('onclick', 'return window;');
    return el.onClick();
  })();


return el.onClick(); il faut enlever le C majuscule par un c minuscule :

Code: Select all
unsafeWindow = (function() {
    var el = document.createElement('p');
    el.setAttribute('onclick', 'return window;');
    return el.onclick();
  })();


Alcolo, si tu veux je peux maintenir une version pour chrome ! dis moi :)
FR Country Manager
.....................................................................
Samsung Galaxy Note II (GT-N7100) - Android 4.1.2Waze v3.5.3.904
Facebook | Skype : slicer59
------------------------------------------------------------
Image
slicer
Waze Champs
 
Posts: 1679
Joined: Tue Mar 02, 2010 8:08 pm
Location: WALINCOURT SELVIGNY, 59127
Has thanked: 6 times
Been thanked: 4 times

Re: Plugin pour Papyrus

Postby alcolo47 » Thu Oct 06, 2011 12:42 pm

V1.2.1: onClick -> onclick + 3s -> 5s avant de délai pour la mise en place du tableau (sûrement la cause du problème de dmf-dmf)
CM: France
AM: France - Montauban (82)
Samsung GT-I9003 - Android 4.1.2 Cyanogenmod - Latest official Waze

Contact: G+
alcolo47
 
Posts: 436
Joined: Sat Jul 23, 2011 5:16 am
Location: Montauban (82)
Has thanked: 2 times
Been thanked: 9 times

Re: Plugin pour Papyrus

Postby renardblanc » Thu Oct 06, 2011 12:50 pm

alcolo47 wrote:V1.2.1: onClick -> onclick + 3s -> 5s avant de délai pour la mise en place du tableau (sûrement la cause du problème de dmf-dmf)


Il faudrait que tu te fasse un lien dans ta signature ou qu'ont le fasse placer sur le début du topic
Image
Sur Samsung Note sous Android Ics 4.0.4, Waze 3.6
G-lob 1.0.84f, Area Manager de la zone de Souillac et la partie Nord du Lot.
renardblanc
 
Posts: 350
Joined: Sun Nov 07, 2010 9:07 pm
Location: Souillac, Lot, France
Has thanked: 4 times
Been thanked: 1 time

Re: Plugin pour Papyrus

Postby Tim1987 » Thu Oct 06, 2011 1:08 pm

Made a small change so that the State column will only appear when on the www server.
Hope you don't mind me talking English here? (Or should I buzz off to the Papyrus forum? :))

Code: Select all
// ==UserScript==
// @name           Waze
// @namespace      https://waze-papyrus-extended-tools.googlecode.com/svn/trunk/
// @include        https://world.waze.com/cartouche/*
// @include        https://www.waze.com/cartouche/*
// @match          https://world.waze.com/cartouche/*
// @match          https://www.waze.com/cartouche/*
// ==/UserScript==



var version = "1.2.2";

// Compatibility with google chrome web browser
// Thanks to bgodette and Tim1987
if(window.navigator.vendor.match(/Google/)) {
  console.log("Patching google chrome environment");

  unsafeWindow = (function() {
    var el = document.createElement('p');
    el.setAttribute('onclick', 'return window;');
    return el.onclick();
  })();

  GM_deleteValue = function(name) {
    localStorage.removeItem(name);
  };

  GM_getValue = function(name, defaultValue) {
    var value = localStorage.getItem(name);
    if (!value) return defaultValue;
    var type = value[0];
    value = value.substring(1);
    switch (type) {
      case 'b': return value == 'true';
      case 'n': return Number(value);
      default: return value;
    }
  };

  GM_setValue = function(name, value) {
    localStorage.setItem(name, (typeof value)[0] + value);
  };
};

var $   = unsafeWindow.$;
var doc = unsafeWindow.document;
var wm  = unsafeWindow.wazeModel;
Array = unsafeWindow.Array; // Because unsafeWindow.Array have some extra prototype (like first())

function createElement(p, type, className) {
  var e = doc.createElement(type);
  if(p) p.appendChild(e);
  if (className != undefined) e.className = className;
  return e;
}

function createTextNode(p, txt) {
  p.appendChild(doc.createTextNode(txt));
  return p;
}



function getStreet(seg) {
  var sid = seg.attributes.primaryStreetID;
  if(sid) return wm.streets.objects[sid];
}

function getCity(str) {
  var cityId = str.cityID;
  if(cityId) return wm.cities.objects[cityId];
}

function getState(city) {
  var stateId = city.stateID;
  if (stateId) return wm.states.objects[stateId];
}

function getCountry(city) {
  var countryId = city.countryID;
  if(countryId) return wm.countries.objects[countryId];
}

function computeDicCountry() {
  var dicCountry = {};
 
  for(var segId in wm.segments.objects) {
    var seg = wm.segments.objects[segId];
    if(seg) {
      var str = getStreet(seg);
      var countryName = "";
      var stateName = "";
      var cityName = "";
      var strName = "";
      if(str) {
        if(str.name) strName = str.name;
        var city = getCity(str);
        if(city) {
          if(city.name) cityName = city.name;
          var country = getCountry(city);
          if(country && country.name) countryName = country.name;
          var state = getState(city);
          if (state && state.name) stateName = state.name;
        }
      }

      if(countryName == "Belgium") countryName = "BE";
      if(countryName == "Canada") countryName = "CAN";
      if(countryName == "France") countryName = "F";
      if(countryName == "Germany") countryName = "DE";
      if(countryName == "Mexico") countryName = "MEX";
      if(countryName == "Netherlands") countryName = "NL";
      if(countryName == "United States") countryName = "USA";
     
     
      var dicState = dicCountry[countryName];
      if (dicState == null) { dicState = {}; dicCountry[countryName] = dicState; }
      var dicCity = dicState[stateName];
      if(dicCity == null) { dicCity = {}; dicState[stateName] = dicCity; }
      var dicStr = dicCity[cityName];
      if(dicStr == null) { dicStr = {}; dicCity[cityName] = dicStr; }
      var lSeg = dicStr[strName];
      if(lSeg == null) { lSeg = new Array(); dicStr[strName] = lSeg; }
      lSeg.push(seg);
    }
  } 
  return dicCountry;
}

function refreshTable(tab, tbody) {
  console.log("Refresh");
  wm  = unsafeWindow.wazeModel;
  var dicCountry  = computeDicCountry();
  $(tbody).empty();
  for(var countryName in dicCountry) {
    var dicState = dicCountry[countryName];
    for(var stateName in dicState) {
      var dicCity = dicState[stateName];
      for(var cityName in dicCity) {
        var dicStr = dicCity[cityName];
        for(var strName in dicStr) {
          var lSeg = dicStr[strName];
          var tr = createElement(tbody, "TR");
          var td = createElement(tr, "TD");
          createTextNode(td, countryName);
          var td = createElement(tr, "TD");
        if(location.hostname == "www.waze.com") {
            createTextNode(td, stateName);
            var td = createElement(tr, "TD");
        }
          createTextNode(td, cityName);
          var td = createElement(tr, "TD");
          createTextNode(td, strName);
          var td = createElement(tr, "TD");
         
          var but = createElement(td, "INPUT");
          but.type = "button";
          but.value = lSeg.length;
          but.addEventListener("click", (function(lSeg) {
            return function(e) {
              unsafeWindow.selectionManager.select(lSeg);
            }; })(lSeg));
        }
      }
    }
  }
  $(tab).find("TD").css({borderWidth: "1px", borderStyle: "solid", padding: "2px"});
}

$(doc).ready(function() {
  console.log("Ready");
  window.setTimeout(function() {
    console.log("Timeout");
    $("#map-problems-explanation").remove();
   
    var user = $("#user-details");
    var para = createElement(null, "P");
    user.append(para);
   
    var divver = createElement(para, "DIV");
    $(divver).css( { fontSize: "10px", textAlign: "right" } );
    createTextNode(divver, "Extended tools V" + version);
   
    var but = createElement(para, "INPUT");
    but.type = "button";
    but.value = "Refresh table";
    but.addEventListener("click", function(e) { refreshTable(tab, tbody); });
   
    var log = createElement(para, "SPAN");
    $(log).css("font-size", "10px");
   
    var scrol = createElement(para, "DIV");
    $(scrol).css({ height: "670px", overflow: "auto" });
   
    var tab = createElement(scrol, "TABLE");
    $(tab).css("font-size", "10px");
   
    var thead = createElement(tab, "THEAD");
    $(thead).css( { fontSize: "12px", fontWeight: "bold" } );
    var td = createElement(thead, "TD");
    createTextNode(td, "Ctry");
    if(location.hostname == "www.waze.com") {
     var td = createElement(thead, "TD");
      createTextNode(td, "State");
   }
    var td = createElement(thead, "TD");
    createTextNode(td, "City");
    var td = createElement(thead, "TD");
    createTextNode(td, "Street");
    var td = createElement(thead, "TD");
    createTextNode(td, "Select");
   
   
    var tbody = createElement(tab, "TBODY");
   
    refreshTable(tab, tbody);
   
  }, 5000);
});
Last edited by Tim1987 on Thu Oct 06, 2011 1:39 pm, edited 1 time in total.
Tim1987
 
Posts: 55
Joined: Thu Mar 17, 2011 6:00 pm
Has thanked: 0 time
Been thanked: 0 time

PreviousNext

Return to Archives

Who is online

Users browsing this forum: No registered users