-
Notifications
You must be signed in to change notification settings - Fork 4
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
1 parent
15e7313
commit 8508962
Showing
11 changed files
with
627 additions
and
241 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: sparklyr.nested | ||
Title: A sparklyr extension for nested data | ||
Version: 0.0.2 | ||
Version: 0.0.3 | ||
Authors@R: c( | ||
person("Matt", "Pollock", email = "[email protected]", role = c("aut", "cre")), | ||
person(family = "The MITRE Corporation", role = c("cph")) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,45 +1,110 @@ | ||
$(function() { | ||
$("#sidebar").stick_in_parent({offset_top: 40}); | ||
$('body').scrollspy({ | ||
target: '#sidebar', | ||
offset: 60 | ||
}); | ||
/* http://gregfranko.com/blog/jquery-best-practices/ */ | ||
(function($) { | ||
$(function() { | ||
|
||
$("#sidebar") | ||
.stick_in_parent({offset_top: 40}) | ||
.on('sticky_kit:bottom', function(e) { | ||
$(this).parent().css('position', 'static'); | ||
}) | ||
.on('sticky_kit:unbottom', function(e) { | ||
$(this).parent().css('position', 'relative'); | ||
}); | ||
|
||
$('body').scrollspy({ | ||
target: '#sidebar', | ||
offset: 60 | ||
}); | ||
|
||
var cur_path = paths(location.pathname); | ||
$("#navbar ul li a").each(function(index, value) { | ||
if (value.text == "Home") | ||
return; | ||
if (value.getAttribute("href") === "#") | ||
return; | ||
|
||
var path = paths(value.pathname); | ||
if (is_prefix(cur_path, path)) { | ||
// Add class to parent <li>, and enclosing <li> if in dropdown | ||
var menu_anchor = $(value); | ||
$('[data-toggle="tooltip"]').tooltip(); | ||
|
||
var cur_path = paths(location.pathname); | ||
var links = $("#navbar ul li a"); | ||
var max_length = -1; | ||
var pos = -1; | ||
for (var i = 0; i < links.length; i++) { | ||
if (links[i].getAttribute("href") === "#") | ||
continue; | ||
var path = paths(links[i].pathname); | ||
|
||
var length = prefix_length(cur_path, path); | ||
if (length > max_length) { | ||
max_length = length; | ||
pos = i; | ||
} | ||
} | ||
|
||
// Add class to parent <li>, and enclosing <li> if in dropdown | ||
if (pos >= 0) { | ||
var menu_anchor = $(links[pos]); | ||
menu_anchor.parent().addClass("active"); | ||
menu_anchor.closest("li.dropdown").addClass("active"); | ||
} | ||
}); | ||
}); | ||
|
||
function paths(pathname) { | ||
var pieces = pathname.split("/"); | ||
pieces.shift(); // always starts with / | ||
function paths(pathname) { | ||
var pieces = pathname.split("/"); | ||
pieces.shift(); // always starts with / | ||
|
||
var end = pieces[pieces.length - 1]; | ||
if (end === "index.html" || end === "") | ||
pieces.pop(); | ||
return(pieces); | ||
} | ||
|
||
function prefix_length(needle, haystack) { | ||
if (needle.length > haystack.length) | ||
return(0); | ||
|
||
// Special case for length-0 haystack, since for loop won't run | ||
if (haystack.length === 0) { | ||
return(needle.length === 0 ? 1 : 0); | ||
} | ||
|
||
for (var i = 0; i < haystack.length; i++) { | ||
if (needle[i] != haystack[i]) | ||
return(i); | ||
} | ||
|
||
var end = pieces[pieces.length - 1]; | ||
if (end === "index.html" || end === "") | ||
pieces.pop(); | ||
return(pieces); | ||
} | ||
return(haystack.length); | ||
} | ||
|
||
function is_prefix(needle, haystack) { | ||
if (needle.length > haystack.lengh) | ||
return(false); | ||
/* Clipboard --------------------------*/ | ||
|
||
for (var i = 0; i < haystack.length; i++) { | ||
if (needle[i] != haystack[i]) | ||
return(false); | ||
function changeTooltipMessage(element, msg) { | ||
var tooltipOriginalTitle=element.getAttribute('data-original-title'); | ||
element.setAttribute('data-original-title', msg); | ||
$(element).tooltip('show'); | ||
element.setAttribute('data-original-title', tooltipOriginalTitle); | ||
} | ||
|
||
return(true); | ||
} | ||
if(Clipboard.isSupported()) { | ||
$(document).ready(function() { | ||
var copyButton = "<button type='button' class='btn btn-primary btn-copy-ex' type = 'submit' title='Copy to clipboard' aria-hidden='true' data-toggle='tooltip' data-placement='left auto' data-trigger='hover' data-clipboard-copy><i class='fa fa-copy' aria-hidden='true'></i></button>"; | ||
|
||
$(".examples, div.sourceCode").addClass("hasCopyButton"); | ||
|
||
// Insert copy buttons: | ||
$(copyButton).prependTo(".hasCopyButton"); | ||
|
||
// Initialize tooltips: | ||
$('.btn-copy-ex').tooltip({container: 'body'}); | ||
|
||
// Initialize clipboard: | ||
var clipboardBtnCopies = new Clipboard('[data-clipboard-copy]', { | ||
text: function(trigger) { | ||
return trigger.parentNode.textContent; | ||
} | ||
}); | ||
|
||
clipboardBtnCopies.on('success', function(e) { | ||
changeTooltipMessage(e.trigger, 'Copied!'); | ||
e.clearSelection(); | ||
}); | ||
|
||
clipboardBtnCopies.on('error', function() { | ||
changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); | ||
}); | ||
}); | ||
} | ||
})(window.jQuery || window.$) |
Oops, something went wrong.