Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Hotspot Map</title>
- <meta content="en" http-equiv="content-language">
- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.4/jquery.mobile-1.4.4.min.css"/>
- <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
- <script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
- <script type="text/javascript" src="js/jquery.leanModal.min.js"></script>
- <script src="http://code.jquery.com/mobile/1.4.4/jquery.mobile-1.4.4.min.js"></script>
- <script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3&sensor=false&language=en"></script>
- <script type="text/javascript" src="js/myJS.js"></script>
- <link rel="stylesheet" type="text/css" href="css/index.css"/>
- <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
- <script type="text/javascript">
- $(document).on("pageinit", "#map_page", function () {
- initialize();
- });
- //Variables
- var geocoder;
- var journal;
- var tubeArray = [
- ['UQ', -27.495134, 153.013502, "http://www.youtube.com/embed/uZ2SWWDt8Wg",
- [
- ["http://www.brisbanetimes.com.au/queensland/brisbane-students-protest-university-fee-hikes-20140521-zrk8o.html", "Brisbane students protest university fee hikes"],
- ["http://www.abc.net.au/pm/content/2012/s3578878.htm", "Angry protests over UQ student union election"],
- ]
- ],
- ['New York', 40.715520, -74.002036, "http://www.youtube.com/embed/JG0wmXyi-Mw",
- [
- ["http://nypost.com/2014/10/19/ny-taxpayers-risky-wall-street-bet-why-the-comptroller-race-matters/" , "NY taxpayers’ risky Wall Street bet: Why the comptroller race matters"]
- ]
- ],
- ['To The Skies', 47.09399, 15.40548, "http://www.youtube.com/embed/tfEjTgUmeWw",
- [
- ["http://www.abc.net.au/news/2014-10-19/battle-for-kobane-intensifies/5825324","Battle for Kobane intensifies as Islamic State uses car bombs, Syrian fighters execute captives"],
- ["http://news.yahoo.com/kurds-thwart-jihadist-bid-cut-off-syria-town-091610878.html","Jihadists take heavy losses in battle for Syria's Kobane"]
- ]
- ],
- ['Fallujah', 33.101509, 44.047308, "http://www.youtube.com/embed/V2EOMzZsTrE",
- [
- ["http://www.abc.net.au/news/2014-05-15/cat-saves-boy-from-dog-attack/5454226","Video captures family cat saving California boy from dog attack"],
- ["http://www.telegraph.co.uk/lifestyle/pets/11170604/Fines-of-20000-for-dogs-that-chase-the-postman.html","Fines of £20,000 for dogs that chase the postman"]
- ]
- ]
- ];
- var usersArray = [
- ["UQ", -27.47201, 153.02445, "http:////www.youtube.com/embed/R5j-Vbt_vmg",]
- ];
- var superArray;
- superArray = [];
- for(i=0;i<tubeArray.length ; i++)superArray.push(tubeArray[i]);
- for(i=0;i<usersArray.length ; i++)superArray.push(usersArray[i]);
- var markerArray = [];
- function initialize() {
- for(i=0;i<superArray.length ; i++)console.log(superArray[i]);
- getCurrentLocation();
- var zoom = Math.floor(($('body').width() / 512) + 2);
- var mapCenter = new google.maps.LatLng(-27.4073899,153.0028595);
- //FOR SEARCH FUNCTIONALITY
- geocoder = new google.maps.Geocoder();
- var myOptions = {
- zoom: zoom,
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- center: mapCenter
- }
- map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
- var getmap = $('body').width();
- var setheight = ($(document).height()/4);
- for (i = 0; i < superArray.length; i++) {
- var source = superArray[i][3];
- var id = superArray[i][0];
- var contentString = '<div id="content">' +
- '<div id="siteNotice">' +
- '</div>' +
- '<h1 id="firstHeading" class="firstHeading">' + superArray[i][0] + '</h1>' +
- '<div id="bodyContent">' +
- '<iframe id="windowframe" width="100%" height="' + setheight + '" src="' + source + '" frameborder="0" allowfullscreen></iframe>' +
- '<div id="articlesDiv">' +
- '<a href="#articles" data-rel="popup" data-position-to="window" data-role="button" data-inline="true" data-transition="flip" data-icon="info" data-theme="e">' +
- '<img class="newsImg" src="img/newspaper1.png" onclick="myFunctionId(this.id);" id="' + id + '" >' +
- '</a>' +
- '</div>' +
- '<div id="reportDiv">' +
- '<a href="#">' +
- '<img id="reportImg" src="img/flag1.png" onclick="reportResponse()">' +
- '</a>' +
- '</div>' +
- '</div>' +
- '</div>';
- var infowindow = new google.maps.InfoWindow({
- content: contentString });
- var image = new google.maps.MarkerImage(
- 'http://maps.gpsvisualizer.com/google_maps/icons/blankcircle/red.png',
- //'http://plebeosaur.us/etc/map/bluedot_retina.png',
- null, // size
- null, // origin
- new google.maps.Point( 8, 8 ), // anchor (move to center of marker)
- new google.maps.Size( 17, 17 ) // scaled size (required for Retina display icon)
- );
- marker = new google.maps.Marker({
- flat: true,
- icon: image,
- optimized: false,
- visible: true,
- position: new google.maps.LatLng(superArray[i][1], superArray[i][2]),
- map: map,
- title: 'Hotspot'
- });
- google.maps.event.addListener(marker, 'click', (function (content) {
- return function () {
- // map.setCenter(marker.getPosition());
- map.setZoom(10);
- infowindow.setContent(content);
- infowindow.open(map, this);
- }
- })(contentString));
- }homepos();
- }
- //SEARCH FUNCTIONALITY
- /*function geocode() {
- var address = document.getElementById("address").value;
- geocoder.geocode({
- 'address': address,
- 'partialmatch': true}); */
- function getCurrentLocation() {
- navigator.geolocation.getCurrentPosition(locationSuccess, onError);
- }
- function locationSuccess(position) {
- var lat = position.coords.latitude;
- var long = position.coords.longitude;
- console.log( position.coords.latitude);
- console.log(position.coords.longitude) ;
- }
- function onError(position) {
- console.log( "fail");
- }
- function homepos(){
- navigator.geolocation.getCurrentPosition(setPos, onError);
- }
- function setPos(position) {
- var lat = position.coords.latitude;
- var long = position.coords.longitude;
- var center1 = new google.maps.LatLng( lat, long);
- map.setCenter(center1);
- map.setZoom(5);
- }
- function myFunctionId (id) {
- journal = id;
- $('#articleLinks').append("<a href='"+innerArray[0]+"'>"+innerArray[1]+'</a>'); // use CSS to break lines
- }
- window.onload = function() {
- var changeMarkersInput1 = document.getElementById("changeMarkers1");
- changeMarkersInput1.addEventListener('click', function(e) {
- var type = "all";
- displayMapMarkers(type);
- }, false);
- var changeMarkersInput2 = document.getElementById("changeMarkers2");
- changeMarkersInput2.addEventListener('click', function(e) {
- var type = "tube";
- displayMapMarkers(type);
- }, false);
- var changeMarkersInput2 = document.getElementById("changeMarkers3");
- changeMarkersInput2.addEventListener('click', function(e) {
- var type = "users";
- displayMapMarkers(type);
- }, false);
- }
- function displayMapMarkers(type) {
- if (type== "all")
- { superArray = [];
- for(i=0;i<tubeArray.length ; i++)superArray.push(tubeArray[i]);
- for(i=0;i<usersArray.length ; i++)superArray.push(usersArray[i]);
- initialize();
- }
- if (type== "tube")
- { superArray = [];
- for(i=0;i<tubeArray.length ; i++)superArray.push(tubeArray[i]);
- initialize();
- }
- if (type== "users")
- { superArray = [];
- for(i=0;i<usersArray.length ; i++)superArray.push(usersArray[i]);
- initialize();
- }
- }
- function showMarkers() {
- google.maps.event.trigger(map, 'resize');
- }
- function reportResponse() {
- alert("Your report has been received, thank you for making HotSpot a better place!");
- }
- //SEARCH FUNCTIONALITY
- //NEED
- function geocode() {
- var address = document.getElementById("address").value;
- geocoder.geocode({
- 'address': address,
- 'partialmatch': true}, geocodeResult);
- }
- //NEED
- function geocodeResult(results, status) {
- if (status == 'OK' && results.length > 0) {
- map.fitBounds(results[0].geometry.viewport);
- } else {
- alert("Geocode was not successful for the following reason: " + status);
- }
- }
- //NEED
- function addMarkerAtCenter() {
- var marker = new google.maps.Marker({
- position: map.getCenter(),
- map: map
- });
- }
- ;
- </script>
- </head onload="initialize()">
- <div data-role="page" id="map_page">
- <div data-role="panel" id="navpanel" data-theme="b" data-display="overlay" data-position="left">
- <div data-role="controlgroup" data-corners="false">
- <!-- Navigation Buttons //-->
- <!-- Search -->
- <div class="panelitem" data-role="collapsible" data-collapsed="true">
- <!-- Set Location -->
- <h4>Search Region</h4>
- <ul data-role="listview">
- <li><a href="#"><input type="text" id="address"/><input type="button" value="Go" onclick="geocode()"></a></li>
- </ul>
- </div>
- <!-- /TEST -->
- <!-- Set Location -->
- <div class="panelitem" data-role="collapsible" data-collapsed="true">
- <h4>Quick Location</h4>
- <ul data-role="listview">
- <li><a href="#" class="posSelector" >North America</a></li>
- <li><a href="#" class="posSelector" >South America</a></li>
- <li><a href="#" class="posSelector">Africa</a></li>
- <li><a href="#" class="posSelector">Southeast Asia</a></li>
- <li><a href="#" class="posSelector">Middle East</a></li>
- <li><a href="#" class="posSelector">Europe</a></li>
- </ul>
- <script>
- $('.posSelector').click(function () {
- var posName = $(this).text();
- if( posName =="North America"){
- var center1 = new google.maps.LatLng( 41.5008195,-99.680902 );
- map.setCenter(center1);
- map.setZoom(4);
- }
- if( posName =="South America"){
- var center1 = new google.maps.LatLng( -21.7351043,-63.28125 );
- map.setCenter(center1);
- map.setZoom(4);
- }
- if( posName =="Africa"){
- var center1 = new google.maps.LatLng( 0.2136714,16.98485 );
- map.setCenter(center1);
- map.setZoom(4);
- }
- if( posName =="Southeast Asia"){
- var center1 = new google.maps.LatLng( 8.7197676,116.607154 );
- map.setCenter(center1);
- map.setZoom(4);
- }
- if( posName =="Middle East"){
- var center1 = new google.maps.LatLng( 27.0821,44.0150557 );
- map.setCenter(center1);
- map.setZoom(4);
- }
- if( posName =="Europe"){
- var center1 = new google.maps.LatLng(49.5,22);
- map.setCenter(center1);
- map.setZoom(4);
- }
- });
- </script>
- </div>
- <!-- Filter -->
- <div class="panelitem" data-role="collapsible" data-collapsed="true">
- <h4>Filter</h4><ul data-role="listview">
- <li><a id="changeMarkers1" href="#">All</a></li>
- <li><a id="changeMarkers2" href="#">Youtube</a></li>
- <li><a id="changeMarkers3" href="#">User Video</a></li>
- </ul>
- </div>
- <!-- Upload -->
- <a href="addvideo.html" data-role="button" rel="external" data-transition="flip">Add Video</a>
- </div>
- </div>
- <!-- Title -->
- <div id="header" data-role="header" data-position="fixed" data-theme="b">
- <a id="bars-button" data-icon="bars" class="ui-btn-left" style="margin-top:10px;" href="#navpanel">Menu</a>
- <br><div id="container"> <img src="img/hotspot.png" id="hotspotlogo"/><h1 id="heading"> HOTSPOT</h1></div>
- </div>
- <!-- Google Maps -->
- <div id="frame" data-role="content">
- <div>
- <div id="map_canvas"></div>
- </div>
- </div>
- <!-- Footer -->
- <div id="footer" data-role="footer" data-position="fixed" data-theme="b" class="ui-bar">
- <a href="#about" data-rel="popup" data-position-to="window" data-role="button" data-inline="true"
- data-transition="flip" data-icon="info" data-theme="e">About</a>
- </div>
- <!-- /About -->
- <div data-role="popup" id="about" data-overlay-theme="a" data-theme="c" data-dismissible="false"
- style="max-width:300px;" class="ui-corner-all">
- <div data-role="header" class="ui-header ui-bar-c"><a href="#" data-rel="back" data-role="button" data-theme="a"
- data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a>
- <h1>HotSpot<br></h1>
- </div>
- <div data-role="content" data-theme="d" class="ui-corner-bottom ui-content">
- <p>A Team 27 Application <b>2014</b>
- </div>
- </div>
- <!-- /Articles -->
- <div data-role="popup" id="articles" data-overlay-theme="b" data-theme="b" data-dismissible="false" style="max-width:400px;">
- <div data-role="header" data-theme="a"><a href="#" data-rel="back" data-role="button" data-theme="a"
- data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a>
- <h1>Articles</h1>
- </div>
- <div role="main" class="ui-content">
- <!--<h3 class="ui-title">Are you sure you want to delete this page?</h3>
- <p>This action cannot be undone.</p>-->
- <a href="addvideo.html" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-btn-b" >Upload Article</a><br>
- <div id="articleLinks">
- <a href="http:/www.google.com">Dummy Link</a><br><br>
- </div>
- </div>
- </div>
- </div>
- </body>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
- <script type="text/javascript" src="cordova.js"></script>
- <script type="text/javascript" src="js/index.js"></script>
- <script type="text/javascript">
- app.initialize();
- </script>
- <script type="text/javascript">
- /* $(document).ready(function(){
- alert("Jquery is working");
- });*/
- </script>
- <script>
- var getmap = $('body').width();
- console.log(getmap);
- var check = $(document).height();
- var check2 = $('#header').height();
- var check3 = $('#footer').height();
- var setHeight = check - (check2 + check3);
- $("#map_canvas").css({'height': setHeight + "px" });
- </script>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement