Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
7ce2243
Common: add per-element flexibility for design-width
ascholerChemeketa Aug 18, 2025
08d6b11
HTML: new pubvar for design-width
ascholerChemeketa Aug 18, 2025
ffef517
HTML: use customizable design-width varaible
ascholerChemeketa Aug 18, 2025
6b742ee
HTML: expand max width on iframe standalone pages
ascholerChemeketa Aug 18, 2025
7c201ff
Assembly: generate interactive-platform identifier for all interactives
ascholerChemeketa Aug 18, 2025
df2da15
HTML: add resize-behavior pubvars for interactives and varients
ascholerChemeketa Aug 18, 2025
c4f1ab4
HTML: add get-resize-behavior templates for interactives
ascholerChemeketa Aug 18, 2025
0831735
HTML: custom design-width handling for interactives and slates
ascholerChemeketa Aug 18, 2025
e67dd0a
HTML: refactor size-pixels-style-attribute
ascholerChemeketa Aug 18, 2025
90e7361
HTML: interactives and slates use resize-behavior setting
ascholerChemeketa Aug 19, 2025
9d9d1e3
HTML: add container around interactives iframes
ascholerChemeketa Aug 19, 2025
62dc1e7
CSS: force wide interactives to scroll instead of stretching page width
ascholerChemeketa Aug 19, 2025
68ab84f
Localization: add "open in new tab"
ascholerChemeketa Aug 18, 2025
eadd749
HTML: add open in new window link button to interactives
ascholerChemeketa Aug 19, 2025
a73af9e
CSS: style open in new window link for interactives
ascholerChemeketa Aug 19, 2025
67ac59b
Sample article: set pubfile resize-behavior
ascholerChemeketa Aug 19, 2025
b5c9e67
Sample article: cleanup layouts from included js/css in interactives
ascholerChemeketa Aug 19, 2025
6be6133
Sample article: adjust interatives layouts
ascholerChemeketa Aug 19, 2025
f6cb92f
Sample article: add interactive layout examples
ascholerChemeketa Aug 19, 2025
1b72574
JS: lti_iframe_resizer updates height/width attribute and style
ascholerChemeketa Aug 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions css/components/_pretext.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ $navbar-breakpoint: 800px !default;
@use 'google-search';
@use 'pretext-search';
@use 'interactives/runestone';
@use 'interactives/other';
@use 'interactives/webwork';
@use 'interactives/sagecell';

Expand Down
34 changes: 34 additions & 0 deletions css/components/interactives/_other.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.interactive-iframe-container {
max-width: 100%;
overflow: auto;
& > iframe {
margin-left: auto;
margin-right: auto;
display: block;
}
}

.interactive-iframe-container__opener {
display: block;
margin-right: 5px;
margin-top: 11px;
margin-bottom: 5px;
font-size: 0.8rem;
& .icon {
font-size: 18px;
}

// if figcaption or instructions follow, this should float next to that
&:has(+ figcaption, + .instructions) {
float: left;
z-index: 1; // place above fig caption in render stack
position: relative; // for z-index
}

// and if both, the figcaption should clear
+ .instructions + figcaption {
clear: left;
}

+ .instructions { margin-top: .5em; }
}
3 changes: 2 additions & 1 deletion examples/sample-article/media/code/d3/collision.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ force.start();

var svg = d3.select("#d3-collision").append("svg")
.attr("width", width)
.attr("height", height);
.attr("height", height)
.attr("display", "block");

svg.selectAll("circle")
.data(nodes.slice(1))
Expand Down
15 changes: 10 additions & 5 deletions examples/sample-article/media/code/d3/graph-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,32 @@
main()

function main() {
var range = 50
setSize(data)

// Add more data when we have a larger canvas
var range = Math.pow(width, 1.3) / 50
var data = {
nodes:d3.range(0, range).map(function(d){ return {label: "l"+d ,r:~~d3.randomUniform(4, 16)()}}),
links:d3.range(0, range).map(function(){ return {source:~~d3.randomUniform(range)(), target:~~d3.randomUniform(range)()} })
}

setSize(data)
drawChart(data)
}

function setSize(data) {
width = document.querySelector("#d3-graph-layout").clientWidth
height = document.querySelector("#d3-graph-layout").clientHeight
// boundingRect provides true decimal values for dimensions.
// clientWidth/clientHeight are integer values that may have been rounded up
let boundingRect = document.querySelector("#d3-graph-layout").getBoundingClientRect()
width = Math.floor(boundingRect.width)
height = Math.floor(boundingRect.height)

margin = {top:0, left:0, bottom:0, right:0 }


chartWidth = width - (margin.left+margin.right)
chartHeight = height - (margin.top+margin.bottom)

svg.attr("width", width).attr("height", height)
svg.attr("width", width).attr("height", height).attr("display", "block")


chartLayer
Expand Down
3 changes: 2 additions & 1 deletion examples/sample-article/media/code/mcclure/slope.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ h1 {
svg {
background: white;
border: 1px solid darkslategray;
margin: 20px;
margin-top: 20px;
margin-bottom: 20px;
}

.function_radio_container {
Expand Down
2 changes: 1 addition & 1 deletion examples/sample-article/media/code/mcclure/slope.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

var body_width = 600;
$("body").css("width", body_width);
var svg_width = 580, svg_height = 400, graph_padding = 20;
var svg_width = 600, svg_height = 400, graph_padding = 20;
$("#the_graph").css("margin-left", (body_width-svg_width)/2);
var svg = d3.select("#the_graph")
.attr("width", svg_width)
Expand Down
19 changes: 19 additions & 0 deletions examples/sample-article/media/code/splice/splice-resize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const bodyEl = document.body;
bodyEl.style.background = 'red';

const growBtn = document.createElement('button');
growBtn.textContent = 'Grow';
document.currentScript.parentElement.appendChild(growBtn);

growBtn.addEventListener('click', () => {
const currentHeight = bodyEl.clientHeight;
const newHeight = currentHeight + 100;
bodyEl.style.height = `${newHeight}px`;
window.parent.postMessage(
{
subject: 'lti.frameResize',
height: newHeight,
},
'*'
)
});
2 changes: 1 addition & 1 deletion examples/sample-article/media/code/threejs/catenoid.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/sample-article/media/code/threejs/saddle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions examples/sample-article/publication.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
<feedback href="http://example.com/not-implemented.html"><!-- My Button Text --></feedback>
<!-- A "portable" build is meant to be a single file that is transportable -->
<!-- <platform portable="yes"/> -->
<interactives resize-behavior="responsive">
<javascript resize-behavior="fixed-height"/>
<jsxgraph resize-behavior="fixed-height"/>
<sage resize-behavior="fixed-height"/>
<circuitjs resize-behavior="fixed-height"/>
<d3 resize-behavior="fixed-height"/>
</interactives>
</html>

<!-- 10pt font is the default -->
Expand Down
Loading