Search thousands of free JavaScript snippets that you can quickly copy and paste into your web pages. Get free JavaScript tutorials, references, code, menus, calendars, popup windows, games, and much more.
function set(key,y){
var curTime=new Date().getTime();
//存储一个当时存储时候的时间
localStorage.setItem(key,JSON.stringify({data:v,time:curTime}));
}
function get(key,exp) {
var data=localStorage.getItem(key);
var dataObj=JSON.parse(data);
if(new Date().getTime()-dataObj.time>exp) {//get出来的时间减去当时存储的时间大于过期时间,那么就认为过期
console.log("过期");
}else {
//否则,返回值
console.log("data="+dataObj.data);
}
}
.social-menu li a:before {
font-family: 'Fontawesome';
-webkit-font-smoothing: antialiased;
content: '\f08e';
}
.social-menu li a[href*="dribbble.com"]::before { content: '\f17d'; }
.social-menu li a[href*="facebook.com"]::before { content: '\f09a'; }
.social-menu li a[href*="flickr.com"]::before { content: '\f16e'; }
.social-menu li a[href*="foursquare.com"]::before { content: '\f180'; }
.social-menu li a[href*="github.com"]::before { content: '\f09b'; }
.social-menu li a[href*="plus.google.com"]::before { content: '\f0d5'; }
.social-menu li a[href*="instagram.com"]::before { content: '\f16d'; }
.social-menu li a[href*="jsfiddle.com"]::before { content: '\f1cc'; }
.social-menu li a[href*="linkedin.com"]::before { content: '\f0e1'; }
.social-menu li a[href*="pinterest.com"]::before { content: '\f0d2'; }
.social-menu li a[href*="reddit.com"]::before { content: '\f1a1'; }
.social-menu li a[href*="soundcloud.com"]::before { content: '\f1be'; }
.social-menu li a[href*="stackoverflow.com"]::before { content: '\f16c'; }
.social-menu li a[href*="tumblr.com"]::before { content: '\f173'; }
.social-menu li a[href*="twitter.com"]::before { content: '\f099'; }
.social-menu li a[href*="vimeo.com"]::before { content: '\f194'; }
.social-menu li a[href*="vine.co"]::before { content: '\f1ca'; }
.social-menu li a[href*="yelp.com"]::before { content: '\f1e9'; }
.social-menu li a[href*="youtube.com"]::before { content: '\f167'; }
.social-menu li a[href*="wordpress.com"]::before { content: '\f19a'; }
/* Flexbox stuff */
.social-menu ul {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
}
/* Base styles that apply to all menus */
.menu-section {
padding-bottom: 2em;
margin-bottom: 2em;
border-bottom: 1px solid hsl(0, 0%, );
}
.menu ul {
list-style-type: none;
padding: 0;
margin: 0;
background: hsl(0, 0%, 15%);
}
.menu li a {
display: block;
text-decoration: none;
color: white;
padding: .6em 1em;
}
.menu li a:hover {
background: hsl(0, 0%, 25%);
}
var input = document.getElementById('Files');var files = input.files;for(var i =0; i < files.length; i++){var file = files[0];var reader =new FileReader;// use HTML5 file reader to get the file
reader.onloadend=function(){// get EXIF datavar exif = EXIF.readFromBinaryFile(new BinaryFile(this.result));var lat = exif.GPSLatitude;var lon = exif.GPSLongitude;//Convert coordinates to WGS84 decimalvar latRef = exif.GPSLatitudeRef||"N";var lonRef = exif.GPSLongitudeRef||"W";
lat =(lat[0]+ lat[1]/60+ lat[2]/3600)*(latRef =="N"?1:-1);
lon =(lon[0]+ lon[1]/60+ lon[2]/3600)*(lonRef =="W"?-1:1);//Send the coordinates to your map
Map.AddMarker(lat,lon);}
reader.readAsBinaryString(file);} https://developers.arcgis.com/javascript/3/sandbox/sandbox.html?sample=fl_featureCollection