mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-21 20:25:51 +00:00
parse_pages - refactor for external config and output to target dir
This commit is contained in:
37
assets/js/expandcode.js
Normal file
37
assets/js/expandcode.js
Normal file
@@ -0,0 +1,37 @@
|
||||
var toggle_cs = function(eo) {
|
||||
//eo = $("#"+id);
|
||||
var wrapper = $(eo.target).parent();
|
||||
var code_el = wrapper.find("code");
|
||||
code_el.toggleClass('expanded');
|
||||
var placeholders = wrapper.find(".code-placeholder");
|
||||
if (placeholders.length) {
|
||||
console.log("bye bye placeholders");
|
||||
placeholders.remove();
|
||||
} else {
|
||||
console.log("makin' a placeholder");
|
||||
code_el.after("<div class='code-placeholder' style='width:"
|
||||
+ code_el.width()
|
||||
+ "px; height:"
|
||||
+ code_el.height()
|
||||
+ "px;'> </div>");
|
||||
}
|
||||
current_button_text = wrapper.find(".code_toggler").val();
|
||||
$(eo.target).val(current_button_text == 'Expand' ? "Collapse" : "Expand");
|
||||
}
|
||||
|
||||
function make_code_expandable() {
|
||||
var newid = 0;
|
||||
$(".content > pre > code").parent().wrap(function() {
|
||||
newid = newid+1;
|
||||
return "<div class='code_sample' id='code_autoid_"+newid+"'>";
|
||||
});
|
||||
|
||||
var cs = $('.code_sample');
|
||||
cs.find("code").dblclick(toggle_cs);
|
||||
cs.find("code").attr('title', 'Double-click to expand/collapse');
|
||||
var newbtn = $("<input type='button' class='code_toggler' value='Expand' />");
|
||||
newbtn.appendTo(cs);
|
||||
$(".code_toggler").click(toggle_cs);
|
||||
}
|
||||
|
||||
$(document).on('flatdoc:ready', make_code_expandable);
|
||||
Reference in New Issue
Block a user