Skip to content

Instantly share code, notes, and snippets.

View royalsflush's full-sized avatar

Thomas Silva royalsflush

  • Developer's Cut/LabSynapse
  • London, UK
View GitHub Profile
@royalsflush
royalsflush / dialogView.js
Created November 21, 2012 15:37
dialogView centralize example
function DialogView() {
var contentView=null;
var show=false;
var me = this;
var dialogDiv = document.createElement('div');
$(dialogDiv).addClass("dialog");
var coverDiv = document.createElement('div');
//Based http://www.ilovecolors.com.ar/preserving-radio-button-checked-state-during-drag-and-drop-jquery/
$('#example').sortable({
(...)
start: function (e, ui) {
var radio_checked= {};
me.$el.find('input[type="radio"]', this).each(function(){
if($(this).is(':checked'))
radio_checked[$(this).attr('name')] = $(this).val();
$(document).data('radio_checked', radio_checked);
@royalsflush
royalsflush / Datatables fnAddTrAfter
Created January 10, 2013 06:29
An addon for Datatables – adds a new row after row with index provided; based on Allan Jardine's code for fnAddTr (I kept his code and comments)
$.fn.dataTableExt.oApi.fnAddTrAfter = function ( oSettings, nTr, prevRowIdx, bRedraw ) {
if ( typeof bRedraw == 'undefined' )
{
bRedraw = true;
}
var nTds = nTr.getElementsByTagName('td');
if ( nTds.length != oSettings.aoColumns.length )
{
alert( 'Warning: not adding new TR - columns and TD elements must match' );
@royalsflush
royalsflush / demo.html
Last active July 26, 2023 10:07
Two Level Grid SCSS SCSS script to make a grid that doesn't depend on the parent element, but on the container element. After it, it uses bootstrap's standard 12 column grid.
<html>
<head>
<title>Two Level Grid DEMO</title>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<link rel="stylesheet" href="two_level_grid.css">
<style>
.level1 {
height: 80px;
}
@royalsflush
royalsflush / demo.html
Last active January 3, 2016 06:29
No reset grid JS: This bootstrap plugin makes the bootstrap grid not reset when it goes down levels - it behaves exactly like the fixed grid in 2.3.2: the column divs inside a column div span-x should sum to x, not to 12 as it is in the current version. The reason is that sometimes you want to use a global grid and have everything align with it,…
<html>
<head>
<title>No Reset Grid DEMO</title>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<style>
.level1 {
height: 80px;
border: 1px solid;
}