VEFSÍÐA 101

Sindri Jóhannsson

Sölvi Logason


<!DOCTYPE html>
<html class="no-js" lang="is-IS">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>Aflatíðindi | VOOT BEITA</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">

	
<!--Plugin Global Hide Admin Tool Bar 1.6.1 Build 2014-04-16 Active - Tag 74be16979710d4c4e7c6647856088456-->

<!-- This website is patched against a big problem not solved from WordPress 3.3+ to date -->

<meta name='robots' content='noindex,follow' />
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css?ver=3.9.2">
<link rel="stylesheet" href="/wp-content/themes/voot/assets/css/main.min.css?ver=e75a734ec392f88d8f5a5bd44517fa82">
<script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'></script>
<script>window.jQuery || document.write('<script src="http://voot.optimus.is/wp-content/themes/voot/assets/js/vendor/jquery-1.11.0.min.js"><\/script>')</script>
<script type='text/javascript' src='/wp-content/themes/voot/assets/js/vendor/modernizr-2.7.0.min.js'></script>
<style type="text/css">
.wccs-field-class {
float:left;
width: 47%;
}
.wccs-field-class:nth-child(2n+2) {
padding-right: 3.4% !important;
}
.add_info_wccs {
clear: both;
}
</style>	<link rel="canonical" href="http://voot.optimus.is/aflatidindi/">

	<script type="text/javascript" src="/wp-content/themes/voot/assets/js/plugins/persist-min.js"></script>

	<link href='http://fonts.googleapis.com/css?family=Open+Sans:300,400,700' rel='stylesheet' type='text/css'>
	<link href='http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css' rel='stylesheet' type='text/css'>

	<link rel="alternate" type="application/rss+xml" title="VOOT BEITA Feed" href="http://voot.optimus.is/feed/">


	<link rel="stylesheet" href="/wp-content/themes/voot/assets/js/plugins/spinnach/spinnach.min.css">
	<script src="/wp-content/themes/voot/assets/js/plugins/spinnach/spinnach.min.js"></script>

	<link rel="stylesheet" href="/wp-content/themes/voot/assets/js/plugins/jquery-ui-1.11.1.custom/jquery-ui.min.css">
	<script src="/wp-content/themes/voot/assets/js/plugins/jquery-ui-1.11.1.custom/jquery-ui.min.js"></script>

	<script src="http://code.highcharts.com/highcharts.js"></script>
	<script src="http://code.highcharts.com/highcharts-more.js"></script>
	<script src="http://code.highcharts.com/maps/modules/map.js"></script>
	<script src="http://code.highcharts.com/maps/modules/data.js"></script>
	<script src="http://code.highcharts.com/mapdata/countries/is/is-all.js"></script>



</head>
<body class="page page-id-80 page-template page-template-template-afli-php aflatidindi" class="">

  <!--[if lt IE 8]>
    <div class="alert alert-warning">
      You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.    </div>
  <![endif]-->

  <div class="fw-container  fullwidth "></div>
<header class="banner  sub " role="banner">
  <div class="container">
    <div class="navbar-header">
      <a class="navbar-brand" href="http://voot.optimus.is/"> 
          <img src="/wp-content/themes/voot/assets/img/logo.png"></img>
      </a>
    </div>
    <nav class="navigation hidenav" role="navigation">
      <div class="menu-header">
        <div class="menu-head-logo">
          <a class="navbar-brand burgerontop" href="http://voot.optimus.is/"> 
            <img src="/wp-content/themes/voot/assets/img/logo_blue.png"></img>
          </a>
        </div>
        <div class="menu-head-exit">Loka <span>X</span></div>

      </div>
      <ul id="menu-primary-navigation" class="nav navbar-nav"><li class="menu-vorur"><a href="/flokkar/">Vörur</a></li>
<li class="active menu-aflatidindi"><a href="/aflatidindi/">Aflatíðindi</a></li>
<li class="menu-um-okkur"><a href="/um-okkur/">Um okkur</a></li>
</ul>    </nav>
    <div class="burger burgerontop">
      <div class="label">Valmynd</div>
      <div class="line"></div>
      <div class="line"></div>
      <div class="line"></div>
    </div>
  </div>
</header>


  <div class="wrap container" role="document">
    <div class="content row">
      <main class="main col-sm-8 " role="main">
      
      

<div class="container afli">
	<!-- <div><a href="/">Forsíða</a> <span class="blue">/</span> <a href="/aflatidindi">Aflatíðindi</a></div>
	<div class="infoSelector">
		<div class="days">
			 <div class="label">SÍÐUSTU <span id="dayAmount">20</span> DAGAR</div> 
			<div class="slider"></div>
		</div>

	</div>
	-->
	
	<h1>AFLATÍÐINDI</h1>
	<ul class="dateSelector">
		<li id="30">30 dagar</li>
		<li id="7" class="active">7 dagar</li>
		<li id="1">Í dag</li>
	</ul>

	<select name="tonn" class="tonnSelector">
		<option value = "10">< 10 tonn</option>
		<option selected="selected" value = "20">< 20 tonn</option>
		<option value = "50">< 50 tonn</option>
		<option value = "100">< 100 tonn</option>
		<option value = "999999999">Allar</option>
	</select>

	<label for="tonn" class="tonnSelectorLabel">Stærð báta:</label>
	<div class="mostrecent">
		<div class="box recentlist list">
			<h2>Allar landanir</h2>
			<div class="recentLandanirContainer">
				<table class="recentLandanir">
				</table>
			</div>

			<div class="mostrecentLoader loader">
			  <svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
			     width="40px" height="40px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
			  <path fill="#0078AE" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z">
			    <animateTransform attributeType="xml"
			      attributeName="transform"
			      type="rotate"
			      from="0 25 25"
			      to="360 25 25"
			      dur="0.6s"
			      repeatCount="indefinite"/>
			    </path>
			  </svg>
			</div>
		</div>


		<div class="box mapcontainer">
			<div class="mapLoader loader">
			  <svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
			     width="40px" height="40px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
			  <path fill="#0078AE" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z">
			    <animateTransform attributeType="xml"
			      attributeName="transform"
			      type="rotate"
			      from="0 25 25"
			      to="360 25 25"
			      dur="0.6s"
			      repeatCount="indefinite"/>
			    </path>
			  </svg>
			</div>
			<div class="map"></div>
		</div>



		<div style="clear:both;"></div>

		<div class="box londunDetails">

			<div class="londundetailsLoader loader">
			  <svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
			     width="40px" height="40px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
			  <path fill="#0078AE" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z">
			    <animateTransform attributeType="xml"
			      attributeName="transform"
			      type="rotate"
			      from="0 25 25"
			      to="360 25 25"
			      dur="0.6s"
			      repeatCount="indefinite"/>
			    </path>
			  </svg>
			</div>

			<table class="tegundirTable">
					
			</table>

			<div class="afliPie">
			</div>
			<div style="clear:both;"></div>

		</div>
	</div>
	
	<h2>TOPPLISTINN</h2>
	<div class="topBoats">
		<div class="box toplist list">
			<table class="topLandanir">
				
			</table>

			<div class="topLandanaLoader loader">
			  <svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
			     width="40px" height="40px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
			  <path fill="#0078AE" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z">
			    <animateTransform attributeType="xml"
			      attributeName="transform"
			      type="rotate"
			      from="0 25 25"
			      to="360 25 25"
			      dur="0.6s"
			      repeatCount="indefinite"/>
			    </path>
			  </svg>
			</div>
		</div>

		<div class="box topinfo">
			<div class="topinfoLoader loader">
			  <svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
			     width="40px" height="40px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
			  <path fill="#0078AE" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z">
			    <animateTransform attributeType="xml"
			      attributeName="transform"
			      type="rotate"
			      from="0 25 25"
			      to="360 25 25"
			      dur="0.6s"
			      repeatCount="indefinite"/>
			    </path>
			  </svg>
			</div>
		</div>
		<div style="clear:both;"></div>
	</div>
</div>

<script>
    $(document).ready(function(){
    	updateRecentList(7,20);
    	updateTopList(7,20);
    });

    var toplistData;
    Highcharts.theme = {
	    colors: ['#0079AA', '#005B7F', '#002D40', '#00A3E5']
    };
    Highcharts.setOptions(Highcharts.theme);


    function updateRecentList(days,tons){
    	$('.recentLandanir').html('');

    	$('.tegundirTable').html('');
    	$('.londunDetails h2').remove();
    	$('.afliPie').hide();
    	$('.londundetailsLoader').show();

    	$('.mapcontainer .map').hide();
    	$('.mostrecentLoader').show();
    	$('.mapLoader').show();
    	var towns = [ { x: 400, y: -924, name: 'Reykjavík', z: 0 },
			        { x: 681, y: -640, name: 'Vestmannaeyjar', z: 0 },
			        { x: 1638, y: -660, name: 'Gámur\/Sigling', z: 0 },
			        { x: 1484, y: -1025, name: 'Hornafjörður', z: 0 },
			        { x: 319, y: -814, name: 'Grindavík', z: 0 },
			        { x: 296, y: -867, name: 'Keflavík', z: 0 },
			        { x: 497, y: -811, name: 'Þorlákshöfn', z: 0 },
			        { x: 566, y: -1406, name: 'Hvammstangi', z: 0 },
			        { x: 664, y: -1561, name: 'Skagaströnd', z: 0 },
			        { x: 382, y: -982, name: 'Akranes', z: 0},
			        { x: 92, y: -1475, name: 'Patreksfjörður', z: 0 },
			        { x: 266, y: -867, name: 'Sandgerði', z: 0 },
			        { x: 664, y: -1498, name: 'Blönduós', z: 0 },
			        { x: 773, y: -1521, name: 'Sauðárkrókur', z: 0 },
			        { x: 1086, y: -1617, name: 'Húsavík', z: 0 },
			        { x: 1641, y: -1169, name: 'Djúpivogur', z: 0 },
			        { x: 92, y: -1219, name: 'Rif', z: 0 },
			        { x: 1418, y: -1735, name: 'Þórshöfn', z: 0 },
			        { x: 934, y: -1614, name: 'Dalvík', z: 0 },
			        { x: 1671, y: -1337, name: 'Eskifjörður', z: 0 },
			        { x: 273, y: -1265, name: 'Stykkishólmur', z: 0 },
			        { x: 184, y: -1219, name: 'Grundarfjörður', z: 0 },
			        { x: 128, y: -1212, name: 'Ólafsvík', z: 0 },
			        { x: 484, y: -1502, name: 'Drangsnes', z: 0 },
			        { x: 1319, y: -1827, name: 'Raufarhöfn', z: 0 },
			        { x: 391, y: -883, name: 'Hafnarfjörður', z: 0 },
			        { x: 227, y: -1660, name: 'Bolungarvík', z: 0 },
			        { x: 1717, y: -1367, name: 'Neskaupstaður', z: 0 },
			        { x: 105, y: -1508, name: 'Tálknafjörður', z: 0 },
			        { x: 875, y: -1686, name: 'Siglufjörður', z: 0 },
			        { x: 793, y: -1587, name: 'Hofsós', z: 0 },
			        { x: 1664, y: -1410, name: 'Seyðisfjörður', z: 0 },
			        { x: 918, y: -1660, name: 'Ólafsfjörður', z: 0 },
			        { x: 1516, y: -1571, name: 'Vopnafjörður', z: 0 },
			        { x: 1701, y: -1235, name: 'Stöðvarfjörður', z: 0 },
			        { x: 1648, y: -709, name: 'Ýmsir staðir', z: 0 },
			        { x: 1678, y: -1219, name: 'Breiðdalsvík', z: 0 },
			        { x: 158, y: -1656, name: 'Flateyri', z: 0 },
			        { x: 247, y: -1630, name: 'Ísafjörður', z: 0 },
			        { x: 961, y: -1623, name: 'Hrísey', z: 0 },
			        { x: 1500, y: -1676, name: 'Bakkafjörður', z: 0 },
			        { x: 1247, y: -1755, name: 'Kópasker', z: 0 },
			        { x: 174, y: -1581, name: 'Þingeyri', z: 0 },
			        { x: 444, y: -1498, name: 'Hólmavík', z: 0 },
			        { x: 993, y: -1544, name: 'Akureyri', z: 0 },
			        { x: 1681, y: -1278, name: 'Fáskrúðsfjörður', z: 0 },
			        { x: 168, y: -1683, name: 'Suðureyri', z: 0 },
			        { x: 968, y: -1594, name: 'Hauganes', z: 0 },
			        { x: 270, y: -1620, name: 'Súðavík', z: 0 },
			        { x: 951, y: -1877, name: 'Grímsey', z: 0 },
			        { x: 148, y: -1508, name: 'Bíldudalur', z: 0 },
			        { x: 1645, y: -1308, name: 'Reyðarfjörður', z: 0 },
			        { x: 1688, y: -1505, name: 'Borgarfjörður Eystri', z: 0 },
			        { x: 128, y: -1160, name: 'Arnarstapi', z: 0 },
			        { x: 980, y: -1577, name: 'Hjalteyri', z: 0 },
			        { x: 1697, y: -1383, name: 'Mjóifjörður', z: 0 },
			        { x: 398, y: -900, name: 'Kópavogur', z: 0 },
			        { x: 993, y: -1600, name: 'Grenivík', z: 0 },
			        { x: 474, y: -1637, name: 'Norðurfjörður' , z: 0},
			        { x: 964, y: -1607, name: 'Árskógssandur', z: 0 },
			        { x: 211, y: -1442, name: 'Brjánslækur', z: 0 },
			        { x: 1585, y: -689, name: 'Þýskaland' , z: 0},
			        { x: 835, y: -1652, name: 'Haganesvík', z: 0 },
			        { x: 1572, y: -640, name: 'Færeyjar', z: 0 },
			        { x: 1553, y: -676, name: 'Noregur', z: 0 },
			        { x: 143, y: -1423, name: 'Haukabergsvaðall', z: 0 },
			        { x: 1604, y: -731, name: 'Reykjavík', z: 0 }];

    	
    	$.getJSON( '/wp-content/themes/voot/request.php', { url: 'http://ort.is/landanir.fish?a=allarlandanir&day=' + days + '&tonn=' + tons}, function(data){
    		
    		var mapData = [];
    		var recentlist = ' \
					<tr> \
						<th>DAGS</th> \
						<th>NAFN</th> \
						<th>AFLI</th> \
						<th>HÖFN</th> \
					</tr> \
					';

			var counter = 0;
			var classes = '';
    		for(key in data.items){
    			//if(counter > 9) break;
    			var londun = data.items[key];
    			if(counter == 0) classes = 'active';
    			else classes =  '';

    			recentlist += ' \
					<tr class="'+ classes +'" id="'+ londun.id +'"> \
						<td>' + londun.dagsetning.split('-')[2] + '.' + londun.dagsetning.split('-')[1] + '</td> \
						<td>' + londun.skip.name + '</td> \
						<td>' + Math.round((londun.heildarafli/1000) * 10) / 10 + '</td> \
						<td>' + londun.hofn.name + '</td> \
					</tr>';

				towns[londun.hofn.id-3].z += Math.round((londun.heildarafli/1000) * 10) / 10;

				counter++;
    		}

    		var chartData = [];

    		for(key in towns){
    			if(towns[key].z != 0) chartData.push(towns[key]);
    		}



    		$('.mostrecentLoader').hide();
    		$('.recentLandanir').append(recentlist).hide().fadeIn(300);
    		
    		if(data.items.length == 0){
    			$('.mapLoader').hide();
    			$('.londundetailsLoader').hide();
    			$('.topinfoLoader').hide();
    			return;
    		}

    		showLondunDetails(data.items[0].id);
    		updateRecentMap(chartData);

    	});
	}


	function updateRecentMap(chartData){
		$('.mapLoader').hide();
		$('.mapcontainer .map').show();
			var mapData = Highcharts.geojson(Highcharts.maps['countries/is/is-all']);
			$('.map').highcharts('Map', {
				title : {
				    text : ''
				},
				chart : {
					height: 342
				},
				mapNavigation: {
				    enabled: true,
				    buttonOptions: {
				        verticalAlign: 'bottom'
				    }
				},
				series : [{
				    mapData: mapData,
				    color: '#0079AA',
				},{
					name: "Heildarafli",
					type: "mapbubble",
					color: '#0079AA',
					data: chartData,
				   	dataLabels: {
				    	enabled: false,
				        style: {
				            fontSize: '10px'
				        }
				    },
				}],
					legend: {
						enabled: false
					},
					credits:{
						enabled: false
					}
			});
	}




    function showLondunDetails(id){
    	$('.londunDetails h2').remove();
    	$('.tegundirTable').html('');
    	$('.londundetailsLoader').show();
    	$('.afliPie').hide();
    	$.getJSON( '/wp-content/themes/voot/request.php', { url: 'http://ort.is/landanir.fish?a=londun&id=' + id}, function(data){
    		$('.londundetailsLoader').show();
    		var slaegtSum = 0;
			var oslaegtSum = 0;
			var tilkvotaSum = 0;
			var totalSum = 0;
			var tegundirChart = [];
    		var tegundirlist = ' \
					<tr> \
						<th>Tegund</th> \
						<th>Þorskígildi</th> \
						<th>Slægt</th> \
						<th>Óslægt</th> \
						<th>Til kvóta</th> \
						<th>%</th> \
					</tr> \
					';


			for(key in data.item.tegundir){
				tilkvotaSum += data.item.tegundir[key].tilkvota;
				totalSum += data.item.tegundir[key].oslaegt;
			}		

    		for(key in data.item.tegundir){
    			var tegund = data.item.tegundir[key];
    			slaegtSum += tegund.slaegt;
    			oslaegtSum += tegund.oslaegt;
    			tegundirChart.push({'name': tegund.fish.name, 'data': [tegund.tilkvota]});
    			tegundirlist += ' \
					<tr> \
						<td>'+ tegund.fish.name +'</td> \
						<td>'+ tegund.fish.thorskigildi +'</td> \
						<td>'+ tegund.slaegt +'</td> \
						<td>'+ tegund.oslaegt +'</td> \
						<td>'+ tegund.tilkvota +'</td> \
						<td>'+ Math.round((tegund.oslaegt/totalSum*100) * 10) / 10 + '%' +'</td> \
					</tr> \
					';
    		}

    		tegundirChart.reverse();

    		tegundirlist += ' \
				<tr> \
					<td></td> \
					<td></td> \
					<td>'+ slaegtSum +'</td> \
					<td>'+ oslaegtSum +'</td> \
					<td>'+ tilkvotaSum +'</td> \
					<td></td> \
				</tr> \
				';

			$('.londundetailsLoader').hide();
			$('.londunDetails h2').remove();
    		$('.tegundirTable').html('');
			$('.londunDetails').prepend('<h2>Skipting afla<span><i class="fa fa-calendar-o"></i>'+ data.item.dagsetning.split('-')[2] + '.' + data.item.dagsetning.split('-')[1] + '.' + data.item.dagsetning.split('-')[0] +'</span><span><i class="fa fa-map-marker"></i>'+ data.item.hofn.name +'</span><span>'+ data.item.veidarfaeri.name +'</span><span>'+ data.item.skip.name +'</span></h2>');
			$('.tegundirTable').append(tegundirlist).hide().fadeIn(300);

			
			$('.afliPie').show();
			$('.afliPie').highcharts({
		        chart: {
					margin: [0, 0, 0, 0],
					spacingTop: 0,
					spacingBottom: 0,
					spacingLeft: 0,
					spacingRight: 0,
					type: 'bar',
					renderTo: $('.afliPie'),
					margin: 0
		        },
		        title: {
		            text: ''
		        },
		        xAxis: {
		           lineWidth: 0,
				   minorGridLineWidth: 0,
				   lineColor: 'transparent',
				   labels: {
				       enabled: false
				   },
				   minorTickLength: 0,
				   tickLength: 0
		        },
		        yAxis: {
					lineWidth: 0,
					minorGridLineWidth: 0,
					lineColor: 'transparent',
					labels: {
						enabled: false
					},
					minorTickLength: 0,
					tickLength: 0,
					gridLineWidth: 0,
					tickLength: 0,
					tickWidth: 0,
					tickPosition: 'outside',
					lineWidth:0,
					title: {
		                        text: '',
		                        align: 'high'
		                    }
		        },
		        legend: {
		            enabled: false
		        },
		        plotOptions: {
		            series: {
		            	pointPadding: 0,
		        groupPadding: 0,  
		            	size:'100%',
		                stacking: 'percent',
		                dataLabels: {
		                    enabled: true,
		                    color: '#fff',
		                    formatter: function(){
		                    	if(this.y/tilkvotaSum > 0.08) return this.series.name;
		                    	else return '';
		                    }
		                },
		            },
		        },
		        series: tegundirChart,
		        credits: {
		        	enabled: false,
		        }
		    });

    	});
    }






    function updateTopList(days, tons){
    	console.log('http://ort.is/landanir.fish?a=aflahaestubatar&day='+ days +'&tonn=' + tons);
    	$('.topLandanir').html('');
    	$('.showmore').remove();
    	$('.showless').remove();
    	$('.topLandanaLoader').show();

    	$('.infoContent').remove();
    	$('.chart').remove();
    	$('.topinfoLoader').show();


    	$.getJSON( '/wp-content/themes/voot/request.php', { url: 'http://ort.is/landanir.fish?a=aflahaestubatar&day='+ days +'&tonn=' + tons}, function(data){
			toplistData = data;
			var toplist = ' \
				<tr> \
					<th>SÆTI</th> \
					<th>NAFN</th> \
					<th>AFLI</th> \
					<th>LANDANIR</th> \
					<th>MEÐALAFLI</th> \
				</tr>' 

			var place = 1;
			var classes = ''
			for(key in data.items){
				var londun = data.items[key];

				if(place==1) classes = 'active';
				else classes = '';

				toplist += ' \
					<tr class="'+ classes +'" id="'+ londun.skip.id +'"> \
						<td>' + place + '</td> \
						<td>' + londun.skip.name + '</td> \
						<td>' + Math.round((londun.magn/1000) * 10) / 10 + '</td> \
						<td>' + londun.landanir + '</td> \
						<td>' + Math.round((londun.medaltal/1000) * 100) / 100 + '</td> \
					</tr>';
				place++;
			}
			$('.topLandanaLoader').hide();
			$('.topLandanir').append(toplist).hide().fadeIn(300);
			$('.toplist').append('<div class="showmore">SÝNA FLEIRI</div>').hide().fadeIn(300);
			
			if(data.items.length == 0){
				$('.topinfoLoader').hide();
				return;
			}
			updateInfoBox(days, data.items[0].skip.id, data);
		});
    }







    function updateInfoBox(days,boatId, toplist){
    	var item = toplist.items[ $('#'+ boatId + ' td:first-child').html()-1];
    	$('.infoContent').remove();
    	$('.chart').remove();
    	$('.topinfo').prepend($(' \
    		<div class="infoContent"> \
	    		<h2>' + $('#'+ boatId + ' td:first-child').html() + '. ' + item.skip.name + '</h3> \
				<table> \
					<tr> \
						<th>AFLI</th> \
						<th>LANDANIR</th> \
						<th>MEÐALAFLI</th> \
						<th>HEIMAHÖFN</th> \
					</tr> \
					<tr> \
						<td>' + Math.round((item.magn/1000) * 10) / 10 + '</td> \
						<td>' + item.landanir + '</td> \
						<td>' + Math.round((item.medaltal/1000) * 100) / 100 +'</td> \
						<td>' + item.skip.heimahofn + '</td> \
					</tr> \
				</table> \
			</div> \
			<div class="chart"></div>').hide().fadeIn(300));

    	$('.topinfoLoader').show();

    	$.getJSON( '/wp-content/themes/voot/request.php', { url: 'http://ort.is/landanir.fish?a=allarlandanir&day=' + days + '&id=' + boatId}, function(data){
    		var dates = [];
    		var afli = [];
    		for(key in data.items){
    			var londun = data.items[key];
    			dates.push(londun.dagsetning.split('-')[2] + '.' + londun.dagsetning.split('-')[1]);
    			afli.push(londun.heildarafli/1000);
    		}

    		dates.reverse();
    		afli.reverse();

    		$('.topinfoLoader').hide();

    		$('.chart').highcharts({
			       title: {
		            text: 'Landanir',
		            x: -20 //center
		        },
		        chart: {
		        	height: 290
		        },
		        xAxis: {
		            categories: dates,
		            labels: {
              		 rotation: -45,
              		}
		        },
		        yAxis: {
		            title: {
		                text: 'Tonn'
		            },
		            plotLines: [{
		                value: 0,
		                width: 1,
		                color: '#0078AE'
		            }],
		        },
		        tooltip: {
		            valueSuffix: ''
		        },
		        legend: {
		        	enabled: false,
		            layout: 'vertical',
		            align: 'right',
		            verticalAlign: 'middle',
		            borderWidth: 0
		        },
		        series: [{
		            name: 'Löndun',
		            data: afli,
		            color: '#0078AE',
		        }],
		        credits: {
			      enabled: false
			  },
		    });

    	});
    }

	$(document).on('click', '.toplist .showmore', function(){ 
		$(this).remove();
		$('.toplist table tr').fadeIn(400);
		$('.toplist').append('<div class="showless">SÝNA FÆRRI</div>').hide().fadeIn(300);;
	}); 

	$(document).on('click', '.toplist .showless', function(){ 
		$(this).remove();
		$('.toplist table tr:nth-child(n+12)').hide();
		$('.toplist').append($('<div class="showmore">SÝNA FLEIRI</div>').fadeIn(300));

	}); 

	$(document).on('click', '.toplist tr', function(){ 
		$('.toplist tr').removeClass('active');
		$(this).addClass('active');
		updateInfoBox($('#dayAmount').html(), $(this).attr('id'), toplistData);
	}); 

	$(document).on('click', '.recentlist tr', function(){ 
		$('.recentlist tr').removeClass('active');
		$(this).addClass('active');
		showLondunDetails($(this).attr('id'));
	}); 

	$('.dateSelector li').click(function(){
		updateAll($(this).attr('id'), $('.tonnSelector').val());
		$('.dateSelector li').removeClass('active');
		$(this).addClass('active');
	});

	$('.tonnSelector').change(function(){
		updateAll($('.dateSelector .active').attr('id'), $('.tonnSelector').val());
	});

	function updateAll(days,tons){
		updateRecentList(days,tons);
		updateTopList(days,tons);
	}


</script>


      </main><!-- /.main -->
    </div><!-- /.content -->
  </div><!-- /.wrap -->

  <!--

<footer class="content-info" role="contentinfo">
  <div class="container">
        <p>© 2014 VOOT BEITA</p>
  </div>
</footer>


<!--Plugin Global Hide Admin Tool Bar 1.6.1 Build 2014-04-16 Active - Tag 74be16979710d4c4e7c6647856088456-->

<!-- This website is patched against a big problem not solved from WordPress 3.3+ to date -->

<script type='text/javascript' src='/wp-includes/js/jquery/ui/jquery.ui.core.min.js?ver=1.10.4'></script>
<script type='text/javascript' src='/wp-includes/js/jquery/ui/jquery.ui.datepicker.min.js?ver=1.10.4'></script>
<script type='text/javascript' src='/wp-content/themes/voot/assets/js/scripts.min.js?ver=3391c6dde3c319990b6def1c688e014f'></script>

</body>
</html>

Tilbúnar lausnir

Wix.com

Wordpress.com

...

 

 

www.optimus.is

VEFSÍÐA 101

By Sölvi Logason

VEFSÍÐA 101

  • 863