<script type="application/javascript">
function resizeIFrameToFitContent( iFrame ) {
iFrame.width = iFrame.contentWindow.document.body.scrollWidth;
iFrame.height = iFrame.contentWindow.document.body.scrollHeight;
}
window.addEventListener('DOMContentLoaded', function(e) {
var iFrame = document.getElementById( 'iFrame1' );
resizeIFrameToFitContent( iFrame );
// or, to resize all iframes:
var iframes = document.querySelectorAll("iframe");
for( var i = 0; i < iframes.length; i++) {
resizeIFrameToFitContent( iframes[i] );
}
} );
</script>
<iframe src="usagelogs/default.aspx" id="iFrame1"></iframe>
recently I stumbled upon a script which is able to adjust the size of an Iframe to the content.
Because I like to work with external files like etherpads for interaction, this would make a lot of things possible.
Here's a Demo https://css-tricks.com/examples/iFrameResize/crossdomain.php#
<script type="application/javascript">
function resizeIFrameToFitContent( iFrame ) {
iFrame.width = iFrame.contentWindow.document.body.scrollWidth;
iFrame.height = iFrame.contentWindow.document.body.scrollHeight;
}
window.addEventListener('DOMContentLoaded', function(e) {
var iFrame = document.getElementById( 'iFrame1' );
resizeIFrameToFitContent( iFrame );
// or, to resize all iframes:
var iframes = document.querySelectorAll("iframe");
for( var i = 0; i < iframes.length; i++) {
resizeIFrameToFitContent( iframes[i] );
}
} );
</script>
I wonder if this could be implemented to tiddlywiki.
Two things to change
-It needs to have flexible Ids to allow multiple instances.
-width should be fixed only the height should adapt.
What do you think, is this possible?
/*\
title: ResizeIFrame
type: application/javascript
module-type: startup
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
// Export name and synchronous status
exports.name = "resizeIFrame";
exports.platforms = ["browser"];
exports.after = ["startup"];
exports.synchronous = true;
exports.startup = function() {
$tw.hooks.addHook("th-page-refreshed",function() {
setTimeout(function() {
var iframes = document.querySelectorAll("iframe");
for( var i = 0; i < iframes.length; i++) {
iframes[i].height = iframes[i].contentWindow.document.body.scrollHeight;
}
}, 100);
});
$tw.hooks.addHook("th-navigating",function(event) {
setTimeout(function() {
var iframes = document.querySelectorAll("iframe");
for( var i = 0; i < iframes.length; i++) {
iframes[i].height = iframes[i].contentWindow.document.body.scrollHeight;
}
}, 100);
return event;
});
};
})();
<iframe src="somefile.html" width="100%" height="480"></iframe>
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/8ec7c9eb-3277-4594-bae7-3832547b7497o%40googlegroups.com.
Jan,
I just had a look at etherpad, and reminds me of document part the now defunct Google Wave, but various google and Microsoft products have similar editing opportunities.
I see why you value having a iframe to access such documents. In addition to multi-user documents it gives rise to a WYSIWYG editor.
Always wishing to extend the functionality within tiddlywiki, I can see how this may be away to address some of out multi-user issues with tiddlywiki.
Given it is an open source environment, and tiddlywiki is too, perhaps this is an opportunity to bring the two projects together. Either read only or read/write tiddlywikis could delegate shared documents to etherpad as a special kind of tiddler, but tiddlywiki is in an ideal position to manage the multiple document view into multiple etherpad documents.
Much of this may already be the case with the iframe solution you are working on, so thanks for raising it here. But I think a little deeper integration would help both projects.
What may deeper integration look like?
- Create a new etherpad document from within a special tiddler
- Seed it with the content of the tiddler before conversion
- Be able to use the wiki to manage/wrap multiple etherpads
- Includes searchable and other features
- Be able to import.export cut/copy and paste between etherpad and tiddlers
- Include drag and drop and handle conversions if needed.
- Perhaps the etherpad client component can be made a plugin in tiddlywiki
- and the etherpad server component deployed with the tiddlywiki node server install
If the technology or the etherpad community is not open to this valuable contribution, perhaps the tiddlywiki community could build a method for collaborative and external tiddler by tiddler server. Kind of taking the external tiddler model further. If we took this path we may be able to designer even tighter integration to the extent that once implemented interactive "shared" tiddlers could become a feature.
just thinking.
RegardsTones
so far it does not work yet...thought I took a really small but long page and gave it a 1000 milliseconds.
But at least it does not throw an error-message like my brute first attempt did.
If you want to inspect the installation look here:
https://www.szen.io/Kunstgeschichte/#FlexframeTest
* Set the tiddler's type field to a value of "application/javascript" and create a "module-type" field with value of "startup"
You need to edit $:/plugins/es/FlexFrame.js and add that field. Then save-and-reload.
-e
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/f845ffda-6d33-4571-bf25-85b33a8cdab2o%40googlegroups.com.
it's marvelous. Your instruction was perfect. (...and I see that I was not really awake this morning.)
This is a great help to integrate external content into tiddlywiki, thanks a lot!
* IMPORTANT NOTE: the src="..." file must be from the *same domain* as your TiddlyWiki file because, for security reasons, modern browsers do not permit "cross-domain" access to the "document" object of another file.
exports.startup = function() {
$tw.hooks.addHook("th-page-refreshed",function() {
setTimeout(function() {
try { var iframes = document.querySelectorAll("iframe");
for( var i = 0; i < iframes.length; i++) {
iframes[i].height = iframes[i].contentWindow.document.body.scrollHeight;
} catch(e) { /* do nothing */; } }, 1000);
});
$tw.hooks.addHook("th-navigating",function(event) {
setTimeout(function() {
try { var iframes = document.querySelectorAll("iframe");
for( var i = 0; i < iframes.length; i++) {
iframes[i].height = iframes[i].contentWindow.document.body.scrollHeight;
} catch(e) { /* do nothing */; } }, 1000);
return event;
});
};
I remember someone dropped social Calc spreadsheets into tiddlywiki ages and ages ago.