Immodem

Testing

目前為 2018-10-08 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Immodem
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description Testing
  6. // @author You
  7. // @match https://immodem.poste-immo.intra.laposte.fr/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. var css = document.createTextNode("html{box-sizing:border-box}body{background:linear-gradient(to bottom,#fff 0,#ddd 100%)!important}div vertilize-container{justify-content:space-between}#wrap{display:-webkit-flex;display:-moz-flex;display:-ms-flex;display:-o-flex;display:flex;flex-flow:row nowrap}.entete{width:100%;height:48px;text-align:center;font-size:1.5em;color:#fff;text-shadow:0 1px solid #aaa}.bucket{padding:24px 8px 8px;margin:0 10px;display:flex;flex-flow:column nowrap;flex:1 100%;background:#ddd}.bucket>div{width:100%!important}.taskCard{border-radius:2px!important;border:none;box-shadow:0 1px 2px 0 rgba(0,0,0,.5);transition:box-shadow .25s linear}.taskCard:hover{box-shadow:0 2px 4px 1px rgba(0,0,0,.5)}p{margin-bottom:6px}@font-face{font-family:Roboto;font-style:normal;font-weight:400;src:local('Roboto Regular'),local('Roboto-Regular'),url(https://themes.googleusercontent.com/static/fonts/roboto/v11/2UX7WLTfW3W8TclTUvlFyQ.woff) format('woff')}*{font-family:roboto}"),
  12. initLaunch,
  13. hash,
  14. url = [],
  15. buckets = {};
  16.  
  17. window.onhashchange = function(event) {
  18. url = event.newURL.split("/");
  19. hash = url[url.length - 1];
  20.  
  21. if (hash == "cartTasks") {
  22. initLaunch = setTimeout(init, 500);
  23. } else {
  24. console.log("Pas de modification sur cette url")
  25. };
  26. }
  27.  
  28. function init() {
  29. var wrap = document.querySelectorAll("[vertilize-container]")[0],
  30. style = document.createElement('style');
  31. style.type = 'text/css';
  32. style.appendChild(css);
  33. document.head.appendChild(style);
  34.  
  35. wrap.id = "wrap";
  36.  
  37. var cards = wrap.children;
  38. for (var i = 0; i < cards.length; i++) {
  39. var label = cards[i].getElementsByClassName("itemStep")[0].firstElementChild.innerHTML;
  40. if (buckets[label]) {
  41. buckets[label].push(cards[i]);
  42. } else {
  43. buckets[label] = [];
  44. buckets[label].push(cards[i]);
  45. }
  46. }
  47. makeEnv(buckets, wrap);
  48. // wrap.appendChild(environnement);
  49. }
  50.  
  51. function makeEnv(buckets, wrap) {
  52. // console.log(el);
  53. var step = Object.keys(buckets);
  54. for (var i = 0; i < step.length; i++) {
  55. var bucket = document.createElement("div");
  56. bucket.classList.add('bucket');
  57. bucket.id = step[i];
  58. for (var j = 0; j < buckets[step[i]].length; j++){
  59. bucket.appendChild(buckets[step[i]][j]);
  60. }
  61. console.log(bucket);
  62. wrap.appendChild(bucket);
  63. }
  64. }