Skip to content

Commit bc81ef1

Browse files
committed
Blogs added but not visible by default
Just add the hash `#Blog` to enable to page. I'm keeping it off until I have more time to work on the page, I'd rather not spend my time writing prose at the moment
1 parent ddbe9b8 commit bc81ef1

27 files changed

+1292
-67
lines changed

Public/index.htm

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,11 @@
3939
</div>
4040
<div id="gitPageNav" class="gitPageNavStyle">
4141
<a class="pageLinkStyle" pxlRoomName="CampfireEnvironment" pxlCameraView="init" pageName="Init" alt="Link to Init...">Init.</a>
42-
<span> </span>
4342
<a class="pageLinkStyle" pxlRoomName="CampfireEnvironment" pxlCameraView="pxlNav" pageName="pxlNav" alt="Some info on this git.io site's backbone">pxlNav</a>
44-
<span> </span>
4543
<a class="pageLinkStyle" pxlRoomName="CampfireEnvironment" pxlCameraView="repos" pageName="Repos" alt="Info on some of my repos I like">Repos</a>
46-
<span> </span>
4744
<a class="pageLinkStyle" pxlRoomName="SaltFlatsEnvironment" pxlCameraView="Default" pageName="ProjectsLinks" alt="Real world projects">Projects<span class="squashInLowRes">&nbsp;/ Links</span></a>
48-
<span> </span>
45+
<a class="pageLinkStyle" pxlRoomName="CampfireEnvironment" pxlCameraView="Default" pageName="Blog" alt="My ramblings...">Blog</a>
4946
<a class="pageLinkStyle" pxlRoomName="CampfireEnvironment" pxlCameraView="aboutMe" pageName="AboutMe" alt="It's ah me! Marrr.... yeah"><span class="squashInLowRes">About&nbsp;</span>Me</a>
50-
<span> </span>
5147
</div>
5248
</div>
5349
<div id="gitPageContentParent" class="gitPageContentParentStyle gpcpVisibleStyle heightFader">
@@ -226,6 +222,15 @@
226222
</div>
227223
</div>
228224
<!-- -- -- -- -->
225+
<div name="gitPage" page-id="Blog" page-style="footerBar:blogPage_footerBar;gitPagesNavBlock:gitPageNav_blogStyle" class="gitPageContentStyle gitBlogPageStyle">
226+
<div class="gitPageInnerStyle">
227+
<span class="gitPageHeaderStyle">Blog -</span>
228+
<div id="blogEntryListing" class="blogEntryListStyle"></div>
229+
<div id="blogEntryContent" class="blogContentStyle"></div>
230+
<br><br>
231+
</div>
232+
</div>
233+
<!-- -- -- -- -->
229234
<div name="gitPage" page-id="AboutMe" page-style="footerBar:aboutMePage_footerBar;gitPagesNavBlock:gitPageNav_aboutMeStyle" class="gitPageContentStyle gitAboutMePageStyle">
230235
<div class="gitPageInnerStyle">
231236
<span class="gitPageHeaderStyle">About Me -</span>

Public/js/BlogManager.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// Simple blog manager for my procstack blog
2+
3+
4+
import { blogEntries } from './blog/blogEntries.js';
5+
6+
export class BlogManager {
7+
constructor( listParent, contentParent ){
8+
this.listParent = listParent;
9+
this.contentParent = contentParent;
10+
this.blogEntries = [];
11+
this.currentEntry = null;
12+
}
13+
init(){
14+
let blogEntryKeys = Object.keys(blogEntries);
15+
for( let i = 0; i < blogEntryKeys.length; i++ ){
16+
this.blogEntries.push( blogEntries[blogEntryKeys[i]] );
17+
}
18+
}
19+
setListParent( listParent ){
20+
this.listParent = listParent;
21+
}
22+
setContentParent( contentParent ){
23+
this.contentParent = contentParent;
24+
}
25+
addBlogEntry( title, date, tags, body ){
26+
let blogEntry = new blogEntries( this.parent, title, date, tags, body );
27+
this.blogEntries.push( blogEntry );
28+
}
29+
build( parent=null ){
30+
let parentObj = parent;
31+
if( parentObj == null ){
32+
if( this.contentParent == null ){
33+
console.error('No Parent Object set');
34+
return;
35+
}
36+
parentObj = this.contentParent;
37+
}
38+
39+
for( let i = 0; i < this.blogEntries.length; i++ ){
40+
// Content Prep
41+
this.blogEntries[i].setId( i );
42+
this.blogEntries[i].build( parentObj );
43+
this.blogEntries[i].hide();
44+
45+
// Listing Prep
46+
let curEntryName = this.blogEntries[i].title + ' :: ' + this.blogEntries[i].date;
47+
this.addListing( curEntryName, i );
48+
}
49+
}
50+
51+
addListing( name, index ){
52+
let entry = document.createElement('button');
53+
entry.textContent = name;
54+
entry.classList.add('blogEntryListingStyle');
55+
entry.addEventListener('click', () => {
56+
this.showEntry( index );
57+
});
58+
this.listParent.appendChild(entry);
59+
}
60+
61+
showEntry( index ){
62+
if( index == -1 || index >= this.blogEntries.length){
63+
index = this.blogEntries.length - 1;
64+
}
65+
if( this.currentEntry != null ){
66+
this.currentEntry.hide();
67+
}
68+
this.currentEntry = this.blogEntries[index];
69+
this.currentEntry.show();
70+
}
71+
}

Public/js/ProcPages.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export class ProcPages {
3333
this.defaultPage = "Init";
3434
this.pageListing = {};
3535

36+
this.navBarLinks = [];
37+
this.navBarObjs = {};
3638
this.resObjsVis = true;
3739
this.resBasedObjs = [];
3840
this.triggerEmitFunc = null;
@@ -41,11 +43,30 @@ export class ProcPages {
4143
this.pageStyleOverrides = {};
4244
this.runningTimeouts = {};
4345
}
46+
47+
hashListener() {
48+
let tmpThis = this;
49+
window.addEventListener("hashchange", (e) => {
50+
let newHash = this.getHash();
51+
if( newHash != this.curPageName){
52+
if( newHash == "Blog"){
53+
this.showPage("Blog");
54+
}
55+
this.changePage(newHash);
56+
}
57+
});
58+
}
59+
4460
init(){
4561
this.mainDiv = document.getElementById("procStackGitBlock");
4662
this.navBar = document.getElementById("gitPageNav");
4763
this.navBarLinks = [...this.navBar.getElementsByTagName("a")];
4864

65+
this.navBarLinks.forEach( (navLink)=>{
66+
let linkText = navLink.getAttribute("pageName");
67+
this.navBarObjs[linkText] = navLink;
68+
});
69+
4970
this.resBasedObjs = [...document.getElementsByClassName("squashInLowRes")];
5071
this.contentParent = document.getElementById("gitPageContentParent");
5172
let linkList = [...document.getElementById("gitPageNav").children];
@@ -82,6 +103,7 @@ export class ProcPages {
82103
this.pageListing[ pageId ]["room"] = null;
83104
this.pageListing[ pageId ]["view"] = null;
84105
if( pageId == pageHash ){
106+
this.curPageName = pageId;
85107
this.curPage = pageDiv;
86108
this.toggleFader( this.curPage, true );
87109
}else{
@@ -93,6 +115,9 @@ export class ProcPages {
93115
let linkText = navLink.getAttribute("pageName");
94116
let pxlRoomName = navLink.getAttribute("pxlRoomName");
95117
let pxlCameraView = navLink.getAttribute("pxlCameraView");
118+
if( !this.pageListing.hasOwnProperty(linkText) ){
119+
return;
120+
}
96121
this.pageListing[ linkText ]["room"] = pxlRoomName;
97122
this.pageListing[ linkText ]["view"] = pxlCameraView;
98123

@@ -119,6 +144,7 @@ export class ProcPages {
119144

120145

121146
this.setStyleOverrides();
147+
this.hashListener();
122148

123149
// Let the dom settle for a step
124150
setTimeout( ()=>{
@@ -217,6 +243,7 @@ export class ProcPages {
217243
}
218244

219245
// Set current page value
246+
this.curPageName = pageName;
220247
this.curPage = this.pageListing[pageName]["obj"];
221248

222249
// Trigger css animation to bring the new page in
@@ -383,4 +410,16 @@ export class ProcPages {
383410
}
384411
}
385412

413+
hidePage( pageName ){
414+
if( this.navBarObjs.hasOwnProperty(pageName) ){
415+
let pageObj = this.navBarObjs[pageName];
416+
pageObj.style.display = "none";
417+
}
418+
}
419+
showPage( pageName ){
420+
if( this.navBarObjs.hasOwnProperty(pageName) ){
421+
let pageObj = this.navBarObjs[pageName];
422+
pageObj.style.display = "block";
423+
}
424+
}
386425
}

Public/js/ProckStackGitio.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import { pxlNav, pxlNavVersion } from './pxlNav.js';
1313
import { ProcPages } from './ProcPages.js';
14+
import { BlogManager } from './BlogManager.js';
1415

1516

1617
// Console logging level
@@ -36,6 +37,24 @@ const procPages = new ProcPages();
3637
procPages.init();
3738
procPages.setPxlNavVersion(pxlNavVersion);
3839

40+
if (window.location.hash !== "#Blog") {
41+
procPages.hidePage("Blog");
42+
}
43+
44+
45+
// -- -- -- -- --
46+
47+
var blogEntryListing = document.getElementById('blogEntryListing');
48+
var blogEntryContent = document.getElementById('blogEntryContent');
49+
const procBlog = new BlogManager( blogEntryListing, blogEntryContent );
50+
procBlog.init();
51+
procBlog.build();
52+
procBlog.showEntry(-1);
53+
54+
55+
// -- -- -- -- --
56+
57+
3958
// Create the pxlNav environment manager
4059
const pxlNavr = new pxlNav( verbose, projectTitle, pxlRoomRootPath, procPages.curRoom, bootRoomList );
4160

Public/js/blog/2024-12-07_A.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { blogEntry } from './blogEntryBase.js';
2+
3+
let entryTitle = "Site Progress";
4+
let entryDate = "2024-12-07";
5+
let entryTags = ["pxlNav", "procstack", "github", "github.io", "javascript", "decemeber", "2024"];
6+
let entryBody = `
7+
Gettin this site online!
8+
<br>
9+
<br>It's been quite a bit of work, spread over a longer span of time than I was hoping.
10+
<br>&nbsp;&nbsp; But it's finally coming together nicely!
11+
12+
<div class="blogSpacer"></div>
13+
14+
It's been oddly enjoyable getting <span class="textNudge">pxlNav</span> refactored and accessible from outside of the module.
15+
<br>Cutting out nearly 7000 lines of code,
16+
<br>Comments always the bane of my existence,
17+
<br>&nbsp;&nbsp; But they seem to fill out in time.
18+
19+
<div class="blogSpacer"></div>
20+
21+
Currently general ambiance is my focus.
22+
<br>Things in 3d like to be dark when you introduce the idea of a "light" to them
23+
<br>&nbsp;&nbsp; So making sure shaders are matching textures and lighting takes some time.
24+
<br>
25+
<br>Then mix in modeling, rigging, texturing, animating, and scripting the rest of the site.
26+
<br>&nbsp;&nbsp; Since <span class="textNudge">pxlNav</span> is just what handles Three.js.
27+
<br>
28+
<br>All I can say is having drive for a passion project helps build your skills.
29+
<br>&nbsp;&nbsp; Get's you looking for more outlets to share your work.
30+
<br>&nbsp;&nbsp;&nbsp;&nbsp; And you end up finding other projects people have made that inspire you.
31+
<br>
32+
<br>So here's to future projects and sharing creativity with others!
33+
34+
<div class="blogSpacer"></div>
35+
36+
I just got the camera location warping working from outside of pxlNav.
37+
<br>Trigger a camera warp from a button press using a flag on your tag.
38+
<br>
39+
<br>This brought me to add optional camera positions in your 3d cgi program of choice.
40+
<br>Add a new group under your Camera_grp in your scene,
41+
<br>&nbsp;&nbsp; Just add a Position and lookAt locator/null/empty object in that group,
42+
<br>&nbsp;&nbsp;&nbsp;&nbsp; Then add a "pxlRoomName" & "pxlCameraView" tag to your link on your site.
43+
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "pxlRoomName" is your 'pxlRoom' name,
44+
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "pxlCameraView" is your group name under 'Camera_grp'.
45+
<br>&nbsp;&nbsp; Click your link and watch pxlNav warp your camera to that position!
46+
<br>
47+
<br>Only problem right now is the warping effect isn't running.
48+
<br>&nbsp;&nbsp; I'm likely just not enabling the post-process layer for the effect.
49+
<br>&nbsp;&nbsp;&nbsp;&nbsp; pxlCamera has been reworked a bit up to this point,
50+
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; More testing is required.
51+
<br>
52+
<br>&nbsp; -Kevin Edzenga
53+
`;
54+
55+
56+
const blogEntryObj = new blogEntry(null, entryTitle, entryDate, entryTags, entryBody);
57+
58+
export { blogEntryObj };

0 commit comments

Comments
 (0)