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
$(document).ready( function() { | |
/* | |
* This code will on load go through the entire "Rutinebeskrivelse" and find every occurance | |
* of keyword (in this example "#trinn") and locate the trailing numbers. This is matched to | |
* an unique id on a table at another location in the source code. This chunk of html is fetched | |
* and moved inside the "Rutinebeskrivelse". | |
* | |
* Thus, Editors can inject related content into their text - happy days =) | |
* |
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
// Function that RutineBiblioteket uses to create small popups/previews for Rutine ingresser. | |
// Called when Ajax-request for menu filtered listing of Rutiner is done. | |
function ingresspopup() { | |
var timer; | |
var denna; | |
$("#rutine-list td > a.popup").hover( function() { | |
denna = $(this); |
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
function createImagePreview() { | |
// Create one element to hold the popup image | |
var $popup = $("<div>"); | |
$popup.attr("class","img-popup"); | |
$popup.mouseover( function() { | |
$(this).mouseout( function() { | |
$(this).fadeOut(); | |
}); |
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
// 1. Use the placeholder attribute just as normal on html5 elements, most browsers will understand | |
// 2. The code checks if placeholder is supported, if not it will mimic the behaviour | |
// 3. The class ".placeholder" is added to the mimiced text, so you can style it "color: gray" in your CSS to make it all be just like in modern browsers =D | |
// Source: http://www.cssnewbie.com/cross-browser-support-for-html5-placeholder-text-in-forms#.U3styFiSzck | |
jQuery(function() { | |
jQuery.support.placeholder = false; | |
test = document.createElement('input'); | |
if('placeholder' in test) jQuery.support.placeholder = true; |
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
function equalHeightAdjacents( elems ) { | |
// Make Tema cards equal height per row so we don't get holes when using float | |
var odd = true; | |
var cardleft = 0; | |
var cardright = 0; | |
var cardleft_h = 0; | |
var cardright_h = 0; | |
$(elems).each( function() { |
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
// Setup: Just send your DataTables object (oTable) into this function onclick on some button. | |
// Inspired by this source, but more or less completely re-written because we need to respect filters on tables | |
// http://datatables.net/forums/discussion/11984/simple-csv-export-with-jquery-php | |
function table2csv(oTable) { | |
var csv = ''; | |
var text; | |
var headers = []; | |
var columns = []; |
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
// Divs (or whatever) floating side by side on rows of 2 or 3 each need to have equal height to float pretty. Majsonry-plugins doesn't make them equal height even though they handle the float-issues. This snippet makes all boxes on the same row equal height by finding the tallest box and setting the others to the same height. | |
// Disclaimer: should have been rewritten to arrays to support any amount of columns ... but yeah, "tomorrow" right? ;P | |
// If you toggle visibility on elements, re-call this function again like so: | |
// equalHeightAdjacents( $(".cards:visible") ); | |
function equalHeightAdjacents( elems ) { | |
// Make Tema cards equal height per row so we don't get holes when using float | |
var cardleft, cardmid, cardright; | |
var cardleft_h = 0; |
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
// Rotate image | |
// http://stackoverflow.com/questions/15191058/css-rotation-cross-browser-with-jquery-animate | |
// Call: $('#loadmore span').animateRotate( 360, 500, 'swing', null ); | |
$.fn.animateRotate = function(angle, duration, easing, complete) { | |
var args = $.speed(duration, easing, complete); | |
var step = args.step; | |
return this.each(function(i, e) { | |
args.step = function(now) { |
OlderNewer