Initial commit master
authorBrian Flowers <git-admn@bsflowers.net>
Thu, 6 May 2021 23:03:08 +0000 (19:03 -0400)
committerBrian Flowers <git-admn@bsflowers.net>
Thu, 6 May 2021 23:03:08 +0000 (19:03 -0400)
13 files changed:
gsvg.js [new file with mode: 0644]
gsvg_testing.js [new file with mode: 0644]
guns/m9/crosshair.png [new file with mode: 0644]
guns/m9/fire.mp3 [new file with mode: 0644]
guns/m9/fire.wav [new file with mode: 0644]
guns/m9/gun.png [new file with mode: 0644]
guns/m9/hit.gif [new file with mode: 0644]
guns/m9/muzzleFlash.png [new file with mode: 0644]
hit.gif [new file with mode: 0644]
index.html [new file with mode: 0755]
old/gsvg.0.2.js [new file with mode: 0644]
preview.jpg [new file with mode: 0644]
soundEmbed.html [new file with mode: 0644]

diff --git a/gsvg.js b/gsvg.js
new file mode 100644 (file)
index 0000000..d48448e
--- /dev/null
+++ b/gsvg.js
@@ -0,0 +1,131 @@
+// Google Street View Gun (GSVG) 0.3 Javascript
+// Created by Brian Flowers
+//
+// javascript:{{ var svjs=document.createElement("script"); svjs.src = "http://personal.psu.edu/bsf5033/shootview/shootview.js"; svjs.type="text/javascript"; document.getElementsByTagName("body")[0].appendChild(svjs);} stub(); }
+// M9 Gunshot sound effect from: http://soundbible.com/1906-Barreta-M9.html
+
+var svXscale = 1;
+var svYscale = 1;
+var hitNum = 0;
+var selectedGun = "m9";
+
+function run()
+{ 
+  document.body.style.cursor = "none";
+  
+  var overlay = document.createElement("img");
+  overlay.setAttribute("src", "http://www.personal.psu.edu/bsf5033/gsvg/guns/"+selectedGun+"/crosshair.png");
+  overlay.setAttribute("id", "crosshair");
+  overlay.style.width  = "50px";
+  overlay.style.height = "50px";
+  overlay.style.position = "absolute";
+  overlay.style.left   = "100px";
+  overlay.style.top    = "100px";
+  overlay.style.zIndex = "1000";
+  overlay.onclick = fire;
+  document.body.appendChild(overlay);
+  
+  var gunImage = document.createElement("img");
+  gunImage.setAttribute("src", "http://www.personal.psu.edu/bsf5033/gsvg/guns/"+selectedGun+"/gun.png");
+  gunImage.setAttribute("id", "gunImage");
+  gunImage.style.width  = "400px";
+  gunImage.style.height = "300px";
+  gunImage.style.position = "absolute";
+  gunImage.style.right = "0px";
+  gunImage.style.bottom        = "0px";
+  gunImage.style.zIndex = "1000";
+  document.body.appendChild(gunImage);
+  
+  document.onmousemove = UpdateCrosshairPosition;
+  
+  fire(null);
+  reFocus();
+}
+
+function UpdateCrosshairPosition(e)
+{
+  document.getElementById("crosshair").style.left = (e.pageX-25)+"px";
+  document.getElementById("crosshair").style.top  = (e.pageY-25)+"px";
+  
+  var gunImage = document.getElementById("gunImage");
+  
+  xDist = (window.innerWidth - parseInt(gunImage.style.width)) - e.pageX;
+  svXscale = xDist*2 / window.innerWidth;
+  
+  yDist = window.innerHeight - e.pageY;
+  svYscale = yDist / window.innerHeight;
+  
+  gunImage.style.width = (150+250*svXscale)+"px";
+  gunImage.style.bottom = (-100+100*svYscale)+"px";
+}
+
+function drawMuzzleFlash()
+{
+  var flash = document.createElement("img");
+  flash.setAttribute("src", "http://www.personal.psu.edu/bsf5033/gsvg/guns/"+selectedGun+"/muzzleFlash.png");
+  flash.setAttribute("id", "muzzleFlash");
+  
+  if(svXscale < 0)
+    svXscale = 0.01;
+  
+  flash.style.width  = (800*(svXscale/2))+"px";
+  flash.style.height = (200)+"px";
+  flash.style.position = "absolute";
+  flash.style.right    = ((150+225*svXscale)-(400*(svXscale/2)))+"px";
+  flash.style.bottom   = ((75+100*svYscale))+"px";
+  flash.style.zIndex   = "900";
+  document.body.appendChild(flash);
+  setTimeout("remove('muzzleFlash');", 25);
+}
+
+function fire(e)
+{ 
+  var hitDiv = document.createElement("div")
+  var hitDivId = "hitDiv"+hitNum;
+  var hitImgId = "hitImg"+hitNum
+  hitNum++;
+  hitDiv.setAttribute("id", hitDivId);
+  
+  var shotSound = document.createElement("embed");
+  shotSound.setAttribute("src", "http://www.personal.psu.edu/bsf5033/gsvg/guns/"+selectedGun+"/fire.mp3");
+  shotSound.setAttribute ("autostart", "true");
+  shotSound.setAttribute("id", "shotSound");
+  shotSound.setAttribute("enablejavascript", "true");
+  hitDiv.appendChild(shotSound);
+  
+  var hitImage = document.createElement("img");
+  hitImage.setAttribute("src", "http://www.personal.psu.edu/bsf5033/gsvg/guns/"+selectedGun+"/hit.gif");
+  hitImage.setAttribute("id", hitImgId);
+  hitImage.style.width  = "15px";
+  hitImage.style.height = "15px";
+  hitImage.style.position = "absolute";
+  hitImage.style.top   = (e.pageY-7)+"px";
+  hitImage.style.left  = (e.pageX-10)+"px";
+  hitImage.style.zIndex = "1000";
+  hitDiv.appendChild(hitImage);
+  document.body.appendChild(hitDiv);
+  drawMuzzleFlash();
+  hitNum++;
+
+  setTimeout("remove('"+hitImgId+"')", 350);
+  setTimeout("remove('"+hitDivId+"')", 1000);
+  
+  reFocus();
+}
+
+function reFocus()
+{
+    document.getElementById("panoflash1").focus() 
+}
+
+function remove(id)
+{
+  element = document.getElementById(id);
+ element.parentNode.removeChild(element);
+}
+
+function stub()
+{}
+
+alert("GSVG will start in 5 seconds -- take this time to hide the maps side pane. And if you haven't selected your street view location yet, better hurry up!");
+setTimeout("run();", 5000);
\ No newline at end of file
diff --git a/gsvg_testing.js b/gsvg_testing.js
new file mode 100644 (file)
index 0000000..3e13da5
--- /dev/null
@@ -0,0 +1,128 @@
+// Google Street View Gun (GSVG) 0.2 Javascript
+// Created by Brian Flowers
+//
+// javascript:{{ var svjs=document.createElement("script"); svjs.src = "http://personal.psu.edu/bsf5033/shootview/shootview.js"; svjs.type="text/javascript"; document.getElementsByTagName("body")[0].appendChild(svjs);} stub(); }
+// M9 Gunshot sound effect from: http://soundbible.com/1906-Barreta-M9.html
+
+var svXscale = 1;
+var svYscale = 1;
+var hitNum = 0;
+var selectedGun = "m9";
+
+function run()
+{ 
+  document.body.style.cursor = "none";
+  
+  var overlay = document.createElement("img");
+  overlay.setAttribute("src", "http://www.personal.psu.edu/bsf5033/gsvg/guns/"+selectedGun+"/crosshair.png");
+  overlay.setAttribute("id", "crosshair");
+  overlay.style.width  = "50px";
+  overlay.style.height = "50px";
+  overlay.style.position = "absolute";
+  overlay.style.left   = "100px";
+  overlay.style.top    = "100px";
+  overlay.style.zIndex = "1000";
+  overlay.onclick = fire;
+  document.body.appendChild(overlay);
+  
+  var gunImage = document.createElement("img");
+  gunImage.setAttribute("src", "http://www.personal.psu.edu/bsf5033/gsvg/guns/"+selectedGun+"/gun.png");
+  gunImage.setAttribute("id", "gunImage");
+  gunImage.style.width  = "400px";
+  gunImage.style.height = "300px";
+  gunImage.style.position = "absolute";
+  gunImage.style.right = "0px";
+  gunImage.style.bottom        = "0px";
+  gunImage.style.zIndex = "1000";
+  document.body.appendChild(gunImage);
+  
+  document.onmousemove = UpdateCrosshairPosition;
+  
+  fire(null);
+  reFocus();
+}
+
+function UpdateCrosshairPosition(e)
+{
+  document.getElementById("crosshair").style.left = (e.pageX-25)+"px";
+  document.getElementById("crosshair").style.top  = (e.pageY-25)+"px";
+  
+  var gunImage = document.getElementById("gunImage");
+  
+  xDist = (window.innerWidth - parseInt(gunImage.style.width)) - e.pageX;
+  svXscale = xDist*2 / window.innerWidth;
+  
+  yDist = window.innerHeight - e.pageY;
+  svYscale = yDist / window.innerHeight;
+  
+  gunImage.style.width = (150+250*svXscale)+"px";
+  gunImage.style.bottom = (-100+100*svYscale)+"px";
+}
+
+function drawMuzzleFlash()
+{
+  var flash = document.createElement("img");
+  flash.setAttribute("src", "http://www.personal.psu.edu/bsf5033/gsvg/guns/"+selectedGun+"/muzzleFlash.png");
+  flash.setAttribute("id", "muzzleFlash");
+  flash.style.width  = (800*(svXscale/2))+"px";
+  flash.style.height = (200)+"px";
+  flash.style.position = "absolute";
+  flash.style.right    = ((150+225*svXscale)-(400*(svXscale/2)))+"px";
+  flash.style.bottom   = ((75+100*svYscale))+"px";
+  flash.style.zIndex   = "900";
+  document.body.appendChild(flash);
+  setTimeout("remove('muzzleFlash');", 25);
+}
+
+function fire(e)
+{ 
+  var hitDiv = document.createElement("div")
+  var hitDivId = "hitDiv"+hitNum;
+  var hitImgId = "hitImg"+hitNum
+  hitNum++;
+  hitDiv.setAttribute("id", hitDivId);
+  
+  var shotSound = document.createElement("embed");
+  shotSound.setAttribute("src", "http://www.personal.psu.edu/bsf5033/gsvg/guns/"+selectedGun+"/fire.mp3");
+  shotSound.setAttribute ("autostart", "true");
+  shotSound.setAttribute("id", "shotSound");
+  shotSound.setAttribute("enablejavascript", "true");
+  hitDiv.appendChild(shotSound);
+  
+  var hitImage = document.createElement("img");
+  hitImage.setAttribute("src", "http://www.personal.psu.edu/bsf5033/gsvg/guns/"+selectedGun+"/hit.gif");
+  hitImage.setAttribute("id", hitImgId);
+  hitImage.style.width  = "15px";
+  hitImage.style.height = "15px";
+  hitImage.style.position = "absolute";
+  hitImage.style.top   = (e.pageY-7)+"px";
+  hitImage.style.left  = (e.pageX-10)+"px";
+  hitImage.style.zIndex = "1000";
+  hitDiv.appendChild(hitImage);
+  document.body.appendChild(hitDiv);
+  drawMuzzleFlash();
+  hitNum++;
+
+  setTimeout("remove('"+hitImgId+"')", 350);
+  setTimeout("remove('"+hitDivId+"')", 1000);
+  
+  reFocus();
+}
+
+function reFocus()
+{
+    document.getElementById("panoflash1").focus() 
+}
+
+function remove(id)
+{
+  element = document.getElementById(id);
+ element.parentNode.removeChild(element);
+}
+
+function stub()
+{}
+
+//alert("GSVG will start in 5 seconds -- take this time to hide the maps side pane. And if you haven't selected your street view location yet, better hurry up!");
+//setTimeout("run();", 5000);
+run();
\ No newline at end of file
diff --git a/guns/m9/crosshair.png b/guns/m9/crosshair.png
new file mode 100644 (file)
index 0000000..0c2774a
Binary files /dev/null and b/guns/m9/crosshair.png differ
diff --git a/guns/m9/fire.mp3 b/guns/m9/fire.mp3
new file mode 100644 (file)
index 0000000..f734303
Binary files /dev/null and b/guns/m9/fire.mp3 differ
diff --git a/guns/m9/fire.wav b/guns/m9/fire.wav
new file mode 100644 (file)
index 0000000..0228460
Binary files /dev/null and b/guns/m9/fire.wav differ
diff --git a/guns/m9/gun.png b/guns/m9/gun.png
new file mode 100644 (file)
index 0000000..99385a0
Binary files /dev/null and b/guns/m9/gun.png differ
diff --git a/guns/m9/hit.gif b/guns/m9/hit.gif
new file mode 100644 (file)
index 0000000..413f4c1
Binary files /dev/null and b/guns/m9/hit.gif differ
diff --git a/guns/m9/muzzleFlash.png b/guns/m9/muzzleFlash.png
new file mode 100644 (file)
index 0000000..d47da86
Binary files /dev/null and b/guns/m9/muzzleFlash.png differ
diff --git a/hit.gif b/hit.gif
new file mode 100644 (file)
index 0000000..9c8614a
Binary files /dev/null and b/hit.gif differ
diff --git a/index.html b/index.html
new file mode 100755 (executable)
index 0000000..3772e52
--- /dev/null
@@ -0,0 +1,57 @@
+<html>
+<head>
+  <title>Google Street View Gun (GSVG)</title>
+</head>
+
+<body>
+<h2>Google Street View Gun (GSVG) 0.3</h2>
+<p>This project is a reaction to Google's shutdown of <a href="http://www.businessinsider.com/google-shoot-view-shoot-em-up-game-killed-by-google-2011-12?op=1">Google Shoot View</a></p>
+<img src="preview.jpg" height="250px" />
+<p>
+To "install" Google Street view Gun, drag this link onto your Firefox bookmarks menu:<br/>
+<a href='javascript:{{ var svjs=document.createElement("script"); svjs.src = "http://personal.psu.edu/bsf5033/gsvg/gsvg.js"; svjs.type="text/javascript"; document.getElementsByTagName("body")[0].appendChild(svjs);} stub(); }'>GSVG</a>
+<br/>
+Then, open a google maps street view window, and click the bookmark!<br/><br/>
+<b>Controls:</b>
+<ul><li>Click to shoot</li>
+    <li>arrow up/down to move</li>
+    <li>WASD or left/right and page up/page down to look</li></ul>
+<b>Compatibility</b>
+<ul><li>This script has been tested on Mozilla Firefox 3.6 and later on Windows, Linux, and Mac.</li>
+    <li>Older browser versions (including FF 3.6) will likely be slow and "lag"</li>
+    <li><b>Audio requires a plugin: <a href="soundEmbed.html" style="font-size: smaller">test it here</a></b>
+    <ul><li>Windows: You probably already have it (Quicktime I think)</li>
+       <li>Linux users: mplayer, gstreamer, or any similar browser plugin media should do</li>
+       <li>Mac users: You're on your own. Quicktime maybe?</li></ul>
+    </ul>
+<b>Known bugs:</b><br/>
+<ul><li>You can shoot outside the maps window -- like the Google logo (arguably, this could be a 'feature', not a bug... :)</li>
+    <li>The graphics are ATROCIOUS and the animation is cheesy. (Any artists wanna help out? See below)</li>
+    <li>Gun image, muzzle flash are off if you aim far right (like government, GSVG fails at the extreme right!)</li></ul>
+
+<h3>Want to help out?</h3>
+<p>Right now I'm looking for artwork. Need to replace most of the existing pictures/animations with something better.
+Also looking to expand this to multiple guns -- will need new artwork and sounds for any of those. All work must be freely licensed (creative commons,
+public domain, etc.) Contact me if you have any suggestions or would like to help out: gsvg-admn@bsflowers.net<br/>
+Also, feel free to contact me with any bugs or issues!</p>
+
+<h3>Thanks to:</h3>
+<p>M9 sound effect from: <a href="http://soundbible.com/1906-Barreta-M9.html">SoundBible.com</a></p>
+
+<p align="center">
+<!-- Start of StatCounter Code for Default Guide -->
+<script type="text/javascript">
+var sc_project=7527168; 
+var sc_invisible=0; 
+var sc_security="f4ed8d93"; 
+</script>
+<script type="text/javascript"
+src="http://www.statcounter.com/counter/counter.js"></script>
+<noscript><div class="statcounter"><a title="tumblr
+counter" href="http://statcounter.com/tumblr/"
+target="_blank"><img class="statcounter"
+src="http://c.statcounter.com/7527168/0/f4ed8d93/0/"
+alt="tumblr counter"></a></div></noscript>
+<!-- End of StatCounter Code for Default Guide -->
+</p>
+</body>
\ No newline at end of file
diff --git a/old/gsvg.0.2.js b/old/gsvg.0.2.js
new file mode 100644 (file)
index 0000000..9c1f5dc
--- /dev/null
@@ -0,0 +1,111 @@
+// Google Street View Gun (GSVG) 0.2 Javascript
+// Created by Brian Flowers
+//
+// javascript:{{ var svjs=document.createElement("script"); svjs.src = "http://personal.psu.edu/bsf5033/shootview/shootview.js"; svjs.type="text/javascript"; document.getElementsByTagName("body")[0].appendChild(svjs);} stub(); }
+// M9 Gunshot sound effect from: http://soundbible.com/1906-Barreta-M9.html
+
+var svXscale = 1;
+var svYscale = 1;
+var hitNum = 0;
+var selectedGun = "m9";
+
+function run()
+{ 
+  document.body.style.cursor = "none";
+  
+  var overlay = document.createElement("img");
+  overlay.setAttribute("src", "http://www.personal.psu.edu/bsf5033/gsvg/guns/"+selectedGun+"/crosshair.png");
+  overlay.setAttribute("id", "crosshair");
+  overlay.style.width  = "50px";
+  overlay.style.height = "50px";
+  overlay.style.position = "absolute";
+  overlay.style.left   = "100px";
+  overlay.style.top    = "100px";
+  overlay.style.zIndex = "1000";
+  overlay.onclick = fire;
+  document.body.appendChild(overlay);
+  
+  var gunImage = document.createElement("img");
+  gunImage.setAttribute("src", "http://www.personal.psu.edu/bsf5033/gsvg/guns/"+selectedGun+"/gun.png");
+  gunImage.setAttribute("id", "gunImage");
+  gunImage.style.width  = "400px";
+  gunImage.style.height = "300px";
+  gunImage.style.position = "absolute";
+  gunImage.style.right = "0px";
+  gunImage.style.bottom        = "0px";
+  gunImage.style.zIndex = "1000";
+  document.body.appendChild(gunImage);
+  
+  document.onmousemove = UpdateCrosshairPosition;
+  
+  fire(null);
+  reFocus();
+}
+
+function UpdateCrosshairPosition(e)
+{
+  document.getElementById("crosshair").style.left = (e.pageX-25)+"px";
+  document.getElementById("crosshair").style.top  = (e.pageY-25)+"px";
+  
+  var gunImage = document.getElementById("gunImage");
+  
+  xDist = (window.innerWidth - parseInt(gunImage.style.width)) - e.pageX;
+  svXscale = xDist*2 / window.innerWidth;
+  
+  yDist = window.innerHeight - e.pageY;
+  svYscale = yDist / window.innerHeight;
+  
+  gunImage.style.width = (150+250*svXscale)+"px";
+  gunImage.style.bottom = (-100+100*svYscale)+"px";
+}
+
+function fire(e)
+{ 
+  var hitDiv = document.createElement("div")
+  var hitDivId = "hitDiv"+hitNum;
+  var hitImgId = "hitImg"+hitNum
+  hitNum++;
+  hitDiv.setAttribute("id", hitDivId);
+  
+  var shotSound = document.createElement("embed");
+  shotSound.setAttribute("src", "http://www.personal.psu.edu/bsf5033/gsvg/guns/"+selectedGun+"/fire.mp3");
+  shotSound.setAttribute ("autostart", "true");
+  shotSound.setAttribute("id", "shotSound");
+  shotSound.setAttribute("enablejavascript", "true");
+  hitDiv.appendChild(shotSound);
+  
+  var hitImage = document.createElement("img");
+  hitImage.setAttribute("src", "http://www.personal.psu.edu/bsf5033/gsvg/guns/"+selectedGun+"/hit.gif");
+  hitImage.setAttribute("id", hitImgId);
+  hitImage.style.width  = "15px";
+  hitImage.style.height = "15px";
+  hitImage.style.position = "absolute";
+  hitImage.style.top   = (e.pageY-7)+"px";
+  hitImage.style.left  = (e.pageX-10)+"px";
+  hitImage.style.zIndex = "1000";
+  hitDiv.appendChild(hitImage);
+  document.body.appendChild(hitDiv);
+  hitNum++;
+
+  setTimeout("remove('"+hitImgId+"')", 350);
+  setTimeout("remove('"+hitDivId+"')", 1000);
+  
+  reFocus();
+}
+
+function reFocus()
+{
+    document.getElementById("panoflash1").focus() 
+}
+
+function remove(id)
+{
+  element = document.getElementById(id);
+ element.parentNode.removeChild(element);
+}
+
+function stub()
+{}
+
+alert("GSVG will start in 5 seconds -- take this time to hide the maps side pane. And if you haven't selected your street view location yet, better hurry up!");
+setTimeout("run();", 5000);
\ No newline at end of file
diff --git a/preview.jpg b/preview.jpg
new file mode 100644 (file)
index 0000000..372a27b
Binary files /dev/null and b/preview.jpg differ
diff --git a/soundEmbed.html b/soundEmbed.html
new file mode 100644 (file)
index 0000000..b852a6b
--- /dev/null
@@ -0,0 +1,4 @@
+If the audio clip embedded below plays, sound in GSVG should work properly. If it shows a broken plugin, you'll need to fix that first.
+<embed src="guns/m9/fire.mp3" height="30px" width="300px" autostart="true" /><br/><br/>
+
+<a href="index.html">Back to GSVG</a>
\ No newline at end of file