Skip to content

Commit

Permalink
Fix startpage auto height and width
Browse files Browse the repository at this point in the history
  • Loading branch information
kkremitzki authored and yorikvanhavre committed Mar 11, 2017
1 parent ea2ed34 commit 78b986a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 20 deletions.
1 change: 0 additions & 1 deletion src/Mod/Start/StartPage/StartPage.css
Expand Up @@ -67,7 +67,6 @@ ul {
padding: 8px;
margin-bottom: 10px;
color: #windowtextcolor;
width: 47% !important;
}

.options {
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Start/StartPage/StartPage.html
Expand Up @@ -4,7 +4,7 @@
<script language="javascript">startpage_js</script>
<style type="text/css">startpage_css</style>
</head>
<body onload="load()">
<body onload="load()" onresize="resize()">
<h1><img src="images/FreeCAD.png">&nbsp;text01<div id=versionbox>&nbsp</div></h1>
<div id="description">
&nbsp;
Expand Down
52 changes: 35 additions & 17 deletions src/Mod/Start/StartPage/StartPage.js
Expand Up @@ -67,7 +67,6 @@ function load() {
var script = document.createElement('script');
script.src = 'http://www.freecadweb.org/version.php?callback=checkVersion';
document.body.appendChild(script);

}

function stripTags(text) {
Expand All @@ -88,7 +87,7 @@ function showTweets(data) {
ddiv = document.getElementById('news');
ddiv.innerHTML = "Received";
var html = ['<ul>'];
for (var i = 0; i < 5; i++) {
for (var i = 0; i < 4; i++) {
html.push('<li><img src="images/web.png">&nbsp;<a href="ext', data.data[i].commit.url, '" onMouseOver="showDescr(', i+1, ')" onMouseOut="showDescr()">', data.data[i].commit.message, '</a></li>');
if ("message" in data.data[i].commit) {
linkDescriptions.push(stripTags(data.data[i].commit.message)+'<br/>'+data.data[i].commit.author.name+'<br/>'+data.data[i].commit.author.date);
Expand All @@ -100,21 +99,7 @@ function showTweets(data) {
html.push('</ul>');
html.push('<a href="exthttp://github.com/FreeCAD/FreeCAD/commits/master">text63<a/>');
ddiv.innerHTML = html.join('');
var commits = document.getElementById("commits");
var examples = document.getElementById("examples");
var files = document.getElementById("files");
var description = document.getElementById("description");

var commitsHeight = commits.offsetHeight;
var examplesHeight = examples.offsetHeight;
var filesHeight = files.offsetHeight;

var biggerHeight = commitsHeight > examplesHeight ? commitsHeight : examplesHeight;

var totalHeight = biggerHeight + filesHeight + 145 + 36;
commits.style.height = biggerHeight + 'px';
examples.style.height = biggerHeight + 'px';
description.style.height = totalHeight + 'px';
resize();
}

function showDescr(d) {
Expand All @@ -136,4 +121,37 @@ function scroller() {
}
}

function resize() {
var halfblocks = document.getElementsByClassName('half-block');
var commits = document.getElementById("commits");
var examples = document.getElementById("examples");
var files = document.getElementById("files");
var newproj = document.getElementById('newproject');
var ontheweb = document.getElementById('ontheweb');
var description = document.getElementById("description");

var w = files.offsetWidth;
var filesHeight = files.offsetHeight;
var h1 = newproj.getElementsByTagName('ul')[0].offsetHeight;
var h2 = ontheweb.getElementsByTagName('ul')[0].offsetHeight;
var h3 = examples.getElementsByTagName('ul')[0].offsetHeight;
var h4 = commits.getElementsByTagName('ul')[0].offsetHeight;

var rowTwoHeight = h1 > h2 ? h1 : h2;
var rowThreeHeight = h3 > h4 ? h3 : h4;
rowTwoHeight = rowTwoHeight + 40;
rowThreeHeight = rowThreeHeight + 80;
var totalHeight = rowTwoHeight + rowThreeHeight + filesHeight + 36;

w = w - 52;
for (var i = 0; i < halfblocks.length; i++) {
halfblocks[i].style.width = w/2 + 'px';
}
newproj.style.height = rowTwoHeight + 'px';
ontheweb.style.height = rowTwoHeight + 'px';
examples.style.height = rowThreeHeight + 'px';
commits.style.height = rowThreeHeight + 'px';
description.style.height = totalHeight + 'px';
}

document.onmousemove=scroller;
2 changes: 1 addition & 1 deletion src/Mod/Start/StartPage/TranslationTexts.py
Expand Up @@ -78,7 +78,7 @@ def translate(context,text):
text21 = translate("StartPage", "Example workflow")
text22 = translate("StartPage", "Part Design")
text23 = translate("StartPage", "Designing architectural elements")
text24 = translate("StartPage", "The <b>Architectural Design</b> workbench is specially designed for working with architectural elements such as walls or windows. Start by drawing 2D shapes, and use them as guides to build architecutral objects.")
text24 = translate("StartPage", "The <b>Architectural Design</b> workbench is specially designed for working with architectural elements such as walls or windows. Start by drawing 2D shapes, and use them as guides to build architectural objects.")
text25 = translate("StartPage", "Architectural Design")
text26 = translate("StartPage", "Working with Meshes")
text27 = translate("StartPage", "The <b>Mesh Workbench</b> is used to work with Mesh objects. Meshes are simpler 3D objects than Part objects, but they are often easier to import and export to/from other applications.")
Expand Down

0 comments on commit 78b986a

Please sign in to comment.