Sunday, October 28, 2018

Why i love what i do

# Project Name: MultiPager

Well i like to treat my projects/code/scripts/ideas as some thing a little bit more than just simple text lines.
Every bit of thinking energy i spent on even a typical [HELLO WORLD] hides something behind it way more than 34 chars. System.out.println("Hello World");

Hence why i'm writing this , while i was making a backup of my files i came across a source file (created 8 years ago) with the following code and all of a sudden , memories , feelings and a weird smile were fulfilling me. That source code had something more than just lines. Something deeper than a spaghetti code. It was a sum-up of an old idea with all of its pros & cons , expectations and memories of the whole process.
That is why i love what i do , and that is why everyday in my continuous learning journey i'm enjoying every part of it.
Every bit and byte.

That is the interpretation of a small project i've always had in mind since high-school which i've decided to post online as a blog rather than a repo. on github to preserve it as a memory.
Some KEY variables:
My high-school time dates back to 2009 => So if we put it in an equation:
NOW - THEN = 9 years ago.
Since then lots of things obv. have changed in matter of RAM , processing power , multiple monitor setups so basically the idea behind it applied to today standards doesn't really have any use.
BUT back then we were rocking (at least me) one VGA monitor and between 128-512mb of ram. So that basically sums up when and why the idea was born.

Functionality:
To be able to access multiple websites and being able to view/access them at the same time in one window. No tabs , no other windows. All the webpages inside one ~ (1024X768 was the most used monitor resolution)
Thats really what got me in to looking on how to create via javascript dynamically objects (in this scenario iframes and buttons in order to load the desired url destination in a small defined iframe inside my parent page).

Why the ship had sunk before it was ever created:

Well creating dynamically objects was very interesting as a task but then i came across the Cross-Origin policy which basically made me lose any interest into bringing-to-life the whole idea. I had the whole structure and some of the core functions implemented but in the end the journey was a great experience even though i didn't reach the destination.

Last but not least , it made me smile. An abandoned idea, 8 years after , gave me a moment , a flash back , and that's the value of it. It cannot be defined. A worth-less , priceless moment of joy.

<script language="JavaScript" type="text/javascript">
    var id = 0;
        <!-- Zoom Function-->
        function sliderChange(val)
        {
            var zoomlvl = val;
            if (val<80)
            {
                zoomlvl = 80;
            }

            // Use Ajax post to send the adjusted value to PHP or MySQL storage
            document.getElementById('sliderStatus').innerHTML = val + "%";
            document.body.style.zoom = zoomlvl + "%";
        }
    function frameremove()
    {
        var elem2 = document.getElementById('id');
        elem2.parentNode.removeChild(elem2)
        
        var elem3 = document.getElementById('id');
        elem3.parentNode.removeChild(elem3)
    }
    
    function makeFrame()
    {   //////////////////////////////////////////////////////////
        //Get the value from txtbox
        var webinput = document.getElementById('inputurl').value;
        /////////////////////////////////////////////////////////
        
        /////////////////////////////////////////////////////////
        //Create the iframe element
        ifrm = document.createElement("IFRAME");
        /////////////////////////////////////////////////////////
        
        //Error page that shows up on blank searches
        if (!webinput)
        {
            webinput = "test.html";
            ifrm.setAttribute("src",webinput);
            ifrm.setAttribute("id","id");
        }
        else //Normal Search Function
        {   
            //PROXY SERVER
            //ifrm.setAttribute("src","http://proxy2974.my-addr.org/myaddrproxy.php/http://" + webinput);
            ifrm.setAttribute("src",webinput);
            ifrm.setAttribute("id","id");
        }
        
        //////////////////////////////////////
        // IFRAME WIDTH & HEIGHT //
        /////////////////////////////////////
        ifrm.style.width = 600+"px";
        ifrm.style.height = 480+"px";
        var counter = 0;
        counter++;
        /////////////////////////////////////

        var beforeitem = document.getElementById('social');
        var main = document.getElementById('main');
        main.insertBefore(ifrm, main.beforeitem);
        
        ///////////////////////////////////////////////////////
        //Creation of the remove button
     btnremove = document.createElement("INPUT");
        btnremove.setAttribute("type","submit");
        btnremove.setAttribute("value","X");        
        btnremove.setAttribute("onClick","frameremove();");
        btnremove.setAttribute("id","id");
        btnremove.setAttribute("class","button");
        id = id+1;
        main.insertBefore(btnremove, main.beforeitem);
        document.getElementById('inputurl').value = ""
        ///////////////////////////////////////////////////////
    }
    
    function erase(html_id)
    {
        var elem = document.getElementById('btnadd');
        elem.parentNode.removeChild(elem)
        var main = document.getElementById('main');
        main.appendChild(elem);
    }