Hello,
I'd like to propose adding a macro to the TW core functionality that
returns the viewport dimensions
The use-cases can be many - there's no such thing in the core right now,
I'd be happy if you can proof me wrong
I already use this small set of code:
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.name = "viewport";
exports.params = [
{ name: "property" }
];
/*
Run the macro
*/
exports.run = function(property) {
var viewPortWidth = Math.max(document.documentElement.clientWidth,
window.innerWidth || 0);
var viewPortHeight = Math.max(document.documentElement.clientHeight,
window.innerHeight || 0);
if (property === "height") {
return viewPortHeight.toString();
} else if (property === "width") {
return viewPortWidth.toString();
} else {
return false;
}
};
})();
How are my chances? I'd like to create a PR with documentation
Simon
--
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywikidev/1ee22497-006c-44be-830d-fa63e316e4c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.