// Just change these values
var haveFiles = true; // TRUE or FALSE
// Where the magic happens
setTimeout(function() {
showFiles();
}, 1000);
// Setup Listeners
$('li.linked').on('click', function() {
if ( $(this).hasClass('downloading') ) {
$('.popup-wrapper').addClass('single');
$('.popup-content').html('<p class="popup-title">Download in progress</p><p>The file will open when the download is finished.</p>');
$('.popup-screen').addClass('ready');
} else if ( $(this).hasClass('update') ) {
$('.popup-wrapper').addClass('double');
$('.popup-content').html('<p class="popup-title">Update in progress</p><p>A newer version of the file is being downloaded.</p>');
$('.popup-screen').addClass('ready');
} else {
alert('This will open the file now.');
}
});
$('#close-popup').on('click', function() {
$('.popup-screen').removeClass('ready');
$('.popup-wrapper').removeClass('single');
});
$('#open-file').on('click', function() {
$('.popup-screen').removeClass('ready');
$('.popup-wrapper').removeClass('double');
alert('This will open the file in it\'s current version.');
});
$('#update-file').on('click', function() {
$('.popup-screen').removeClass('ready');
$('.popup-wrapper').removeClass('double');
});
// Setup of functions
function showFiles() {
if (haveFiles) {
$('.loading-message').removeClass('ready');
$('.list').addClass('ready');
} else {
showNoFiles();
}
}
function showNoFiles( message ) {
$('.loading-message').removeClass('ready');
$('.no-files').addClass('ready');
}
function showOfflineNotif() {
$('.offline-notification').addClass('ready');
// Time to remove the notification of the screen
setTimeout(function() {
$('.offline-notification').removeClass('ready');
}, 6000);
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.