forked from samdutton/simpl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
|
||
var img = document.querySelector('img'); | ||
var imgSrc = document.querySelector('#imgSrc'); | ||
var imgNaturalWidth = document.querySelector('#imgNaturalWidth'); | ||
var imgWidth = document.querySelector('#imgWidth'); | ||
|
||
var dpr = document.querySelector('#devicePixelRatio'); | ||
var viewportWidth = document.querySelector('#viewportWidth'); | ||
var availableWidth = document.querySelector('#availableWidth'); | ||
|
||
function displayData(){ | ||
imgSrc.innerHTML = '<a href="' + img.currentSrc + '">' + | ||
img.currentSrc.replace(/^.*[\\\/]/, '') + '</a>'; | ||
imgNaturalWidth.textContent = img.naturalWidth; | ||
imgWidth.textContent = img.width; | ||
dpr.textContent = window.devicePixelRatio; | ||
viewportWidth.textContent = document.documentElement.clientWidth; | ||
availableWidth.textContent = window.screen.availWidth; | ||
} | ||
|
||
img.onload = window.onresize = displayData; | ||
|
||
// in case image already loaded -- is there a better way? | ||
displayData(); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
|
||
var img = document.querySelector('img'); | ||
var imgSrc = document.querySelector('#imgSrc'); | ||
var imgNaturalWidth = document.querySelector('#imgNaturalWidth'); | ||
var imgWidth = document.querySelector('#imgWidth'); | ||
|
||
var dpr = document.querySelector('#devicePixelRatio'); | ||
var minimumWidth = document.querySelector('#minimumWidth'); | ||
var viewportWidth = document.querySelector('#viewportWidth'); | ||
var availableWidth = document.querySelector('#availableWidth'); | ||
|
||
function displayData(){ | ||
imgSrc.innerHTML = '<a href="' + img.currentSrc + '">' + | ||
img.currentSrc.replace(/^.*[\\\/]/, '') + '</a>'; | ||
imgNaturalWidth.textContent = img.naturalWidth; | ||
imgWidth.textContent = img.width; | ||
dpr.textContent = window.devicePixelRatio; | ||
minimumWidth.textContent = img.width * window.devicePixelRatio; | ||
viewportWidth.textContent = document.documentElement.clientWidth; | ||
availableWidth.textContent = window.screen.availWidth; | ||
} | ||
|
||
img.onload = window.onresize = displayData; | ||
|
||
// in case image already loaded -- is there a better way? | ||
displayData(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
|
||
var img = document.querySelector('img'); | ||
var imgSrc = document.querySelector('#imgSrc'); | ||
var imgNaturalWidth = document.querySelector('#imgNaturalWidth'); | ||
var imgWidth = document.querySelector('#imgWidth'); | ||
|
||
var dpr = document.querySelector('#devicePixelRatio'); | ||
var minimumWidth = document.querySelector('#minimumWidth'); | ||
var viewportWidth = document.querySelector('#viewportWidth'); | ||
var availableWidth = document.querySelector('#availableWidth'); | ||
|
||
function displayData(){ | ||
imgSrc.innerHTML = '<a href="' + img.currentSrc + '">' + | ||
img.currentSrc.replace(/^.*[\\\/]/, '') + '</a>'; | ||
imgNaturalWidth.textContent = img.naturalWidth; | ||
imgWidth.textContent = img.width; | ||
dpr.textContent = window.devicePixelRatio; | ||
minimumWidth.textContent = img.width * window.devicePixelRatio; | ||
viewportWidth.textContent = document.documentElement.clientWidth; | ||
availableWidth.textContent = window.screen.availWidth; | ||
} | ||
|
||
img.onload = window.onresize = displayData; | ||
|
||
// in case image already loaded -- is there a better way? | ||
displayData(); |