New Userscript

try to take over the world!

  1. // ==UserScript==
  2. // @name New Userscript
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.101
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://graph-na02-useast1.api.smartthings.com/api/smartapps/installations/*/launch
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. // a function that loads jQuery and calls a callback function when jQuery has finished loading
  15. function addJQuery(callback) {
  16. var script = document.createElement("script");
  17. script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
  18. script.addEventListener('load', function() {
  19. var script = document.createElement("script");
  20. script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
  21. document.body.appendChild(script);
  22. }, false);
  23. document.body.appendChild(script);
  24. }
  25.  
  26. // the guts of this userscript
  27. function main() {
  28. $.getScript("https://maps.googleapis.com/maps/api/js?key=AIzaSyAlFR9IWx_HfMinS3mJZhAvGEtz-uz0aAs", function() {
  29.  
  30. //var e1 = $('<div class="video smv tile h2 w3"></div>')
  31. //$(e1).insertAfter("#3-2");
  32. var e2 = $('<div id="map" style="height:300px; width:400px; top: 200px; left: 200px;"></div>');
  33. $('body').append(e2);
  34.  
  35. var map = new google.maps.Map(document.getElementById('map'), {
  36. zoom: 11,
  37. center: {lat: 33.004994, lng: -117.161949}
  38. });
  39.  
  40. var trafficLayer = new google.maps.TrafficLayer();
  41. trafficLayer.setMap(map);
  42. });
  43. }
  44.  
  45. // load jQuery and execute the main function
  46. addJQuery(main);
  47. })();