Skip to content

Commit

Permalink
Fixed indentation
Browse files Browse the repository at this point in the history
Changed full-screen check box to toggle button
  • Loading branch information
ubershmekel committed Jul 19, 2015
1 parent db75e5a commit 88ba12a
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 80 deletions.
18 changes: 7 additions & 11 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ a:hover {

.navbox ul li a {
cursor:pointer;
}
}
.numberButtonList ul li a:hover { background:#888; color:#000; border: 0; }
.numberButtonList ul li a.active:hover {
color: #00f;
Expand Down Expand Up @@ -123,13 +123,9 @@ label.checkbox { font-weight: bold; }
cursor: hand; cursor: pointer;
}


/*
__ _ _ _
/ _| | (_) | |
_ __ ___ __ _ _ __ ___ ___ | |_ ___ | |_ ___ _ __ ___| |_
| '_ ` _ \ / _` | '__/ __/ _ \| _/ _ \| | |/ _ \ | '_ \ / _ \ __|
| | | | | | (_| | | | (_| (_) | || (_) | | | (_) || | | | __/ |_
|_| |_| |_|\__,_|_| \___\___/|_| \___/|_|_|\___(_)_| |_|\___|\__|
*/
#fullScreenButton {
width: 20px;
padding-left: 10px;
cursor:pointer;
}
}
1 change: 1 addition & 0 deletions images/1437338478_screen-full.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/fullscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</li>
<li>
<input class="checkbox" type="checkbox" name="nsfw" id="nsfw" value="Auto" checked="true" /><label class="checkbox over18" for="nsfw"> nsfw</label>
<input class="checkbox" type="checkbox" name="fullscreen" id="fullscreen" value="Auto" checked="false" /><label class="checkbox" for="fullscreen"> FullScreen</label>
<img src="/images/fullscreen.png" id="fullScreenButton" alt="Fullscreen"></img>
</li>
</ul>
<ul class="nbmenu">
Expand Down
122 changes: 54 additions & 68 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,44 +221,30 @@ $(function () {
resetNextSlideTimer();
}

var updateFullScreen = function () {
if ($("#fullscreen").is(':checked')) {
var elem = document.getElementById("page");
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
} else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) {
elem.webkitRequestFullscreen();
}
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
}
}

// This is really only needed to handle the case where the user
// presses ESC to exit fullscreen mode
var eventFullScreen = function () {
var checked = $("#fullscreen").is(':checked');
if (checked &&
!document.fullscreenElement && // alternative standard method
// current working methods
!document.mozFullScreenElement &&
!document.webkitFullscreenElement &&
!document.msFullscreenElement) {
// Clear checkbox
$("#fullscreen").click();
}
var toggleFullScreen = function() {
var elem = document.getElementById('page')
if (document.fullscreenElement || // alternative standard method
document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement) { // current working methods
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
} else {
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
} else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) {
elem.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
}
}
}

nsfwCookie = "nsfwCookie";
Expand Down Expand Up @@ -300,14 +286,13 @@ $(function () {
timeToNextSlide = parseFloat(timeByCookie) * 1000;
$('#timeToNextSlide').val(timeByCookie);
}
$('#fullscreen').change(updateFullScreen);
eventFullScreen();
$('#fullScreenButton').click(toggleFullScreen);

$('#timeToNextSlide').keyup(updateTimeToNextSlide);

$('#prevButton').click(prevSlide)
$('#nextButton').click(nextSlide)
$(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange', eventFullScreen);
}

var addNumberButton = function (numberButton) {
Expand Down Expand Up @@ -423,9 +408,9 @@ $(function () {
case R_KEY:
open_in_background("#navboxCommentsLink");
break;
case F_KEY:
$("#fullscreen").click();
break;
case F_KEY:
toggleFullScreen();
break;
case PAGEUP:
case arrow.left:
case arrow.up:
Expand Down Expand Up @@ -506,10 +491,10 @@ $(function () {
//
var animateNavigationBox = function (imageIndex) {
var photo = rp.photos[imageIndex];
var subreddit = '/r/' + photo.subreddit;
var subreddit = '/r/' + photo.subreddit;

$('#navboxTitle').html(photo.title);
$('#navboxSubreddit').attr('href', rp.redditBaseUrl + subreddit).html(subreddit);
$('#navboxSubreddit').attr('href', rp.redditBaseUrl + subreddit).html(subreddit);
$('#navboxLink').attr('href', photo.url).attr('title', photo.title);
$('#navboxCommentsLink').attr('href', photo.commentsLink).attr('title', "Comments on reddit");

Expand Down Expand Up @@ -596,27 +581,28 @@ $(function () {


var tryConvertUrl = function (url) {
if (url.indexOf('imgur.com') > 0 || url.indexOf('/gallery/') > 0) {
// special cases with imgur

if (url.indexOf('gifv') >= 0) {
if (url.indexOf('i.') == 0) {
url = url.replace('imgur.com', 'i.imgur.com')
}
return url.replace('.gifv', '.gif');
}

if (url.indexOf('/a/') > 0 || url.indexOf('/gallery/') > 0) {
// albums aren't supported yet
//console.log('Unsupported gallery: ' + url);
return '';
}
// imgur is really nice and serves the image with whatever extension
// you give it. '.jpg' is arbitrary
// regexp removes /r/<sub>/ prefix if it exists
// E.g. http://imgur.com/r/aww/x9q6yW9
return url.replace(/r\/[^ \/]+\/(\w+)/, '$1') + '.jpg';
}
if (url.indexOf('imgur.com') > 0 || url.indexOf('/gallery/') > 0) {
// special cases with imgur

if (url.indexOf('gifv') >= 0) {
if (url.indexOf('i.') == 0) {
url = url.replace('imgur.com', 'i.imgur.com')
}
return url.replace('.gifv', '.gif');
}

if (url.indexOf('/a/') > 0 || url.indexOf('/gallery/') > 0) {
// albums aren't supported yet
//console.log('Unsupported gallery: ' + url);
return '';
}

// imgur is really nice and serves the image with whatever extension
// you give it. '.jpg' is arbitrary
// regexp removes /r/<sub>/ prefix if it exists
// E.g. http://imgur.com/r/aww/x9q6yW9
return url.replace(/r\/[^ \/]+\/(\w+)/, '$1') + '.jpg';
}

return '';
}
Expand Down Expand Up @@ -701,7 +687,7 @@ $(function () {
url: item.data.url,
title: item.data.title,
over18: item.data.over_18,
subreddit: item.data.subreddit,
subreddit: item.data.subreddit,
commentsLink: rp.redditBaseUrl + item.data.permalink
});
});
Expand Down

0 comments on commit 88ba12a

Please sign in to comment.
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy