/* appjet:version 0.1 */

// I'm Urdna- you may know me from Wikipedia, Xbox live, or anything else related to computers (I have yet to find anyone else by this name)
// You can leave me a comment at http://en.wikipedia.org/wiki/user:urdna/notes if you want!

// Thanks for looking at my source; its kinda crazy as this is my first expirence with real programing.

// Most of the code is orriginaly mine (I had help with the page.head.write and post_main sections)


// Thanks for looking here!

// Urdna


page.head.write("""
<style>
    .notes {
        background-color: #FFF7C0;
        border-bottom: 1px solid #e5da91;
        font-size: 12px;
        padding-bottom: 2px;
        padding-left: 10px;
        padding-top: 2px;
        width: 100%;
    }
    
    #contractedNotes {
        cursor: pointer;
    }
    
    #expandedNotes {
        display: none;
        left: 0px;
        padding-bottom: 20px;
        position: absolute;
        top: 0px;
    }
    
    .external {
        height: 90%;
        width: 100%;
    }
    
    #appjetfooter {
        margin: 5px !important;
    }
    
    /* Browser reset */
    
    html {
        height: 100%;
        overflow: hidden;
    }
    
    body {s
        height: 100%;
        margin: 0px;
        overflow: hidden;
        padding: 0px;
    }
    
    body * {
        border: 0px;
        margin: 0px;
        padding: 0px;
    }
</style>

<script>
    function expandNotes() {
        var expanded = document.getElementById('expandedNotes');
        
        if (expanded) {
            expanded.style.display = "block";
        }
    }
    
    function contractNotes() {
        var expanded = document.getElementById('expandedNotes');
                
        if (expanded) {
            expanded.style.display = "none";
        }
    }
</script>
""");
printp(link("/about","About Notes"), "  • ", link("/google"," Google"), "  • ", link("/en"," Wikipedia"), "  •", link("/source", "Source"), "  • ", link("/chat","Chat about this app"), "                           •", link("/add", "Sponsor")/*, " ", link("/comment"," Comment on Notes")*/);


import("quickforms");
import("storage");
import("lib-urdna");

page.setTitle("Notes by Urdna")
page.showRenderTime(false)

if (! storage.counternotes)
    storage.counternotes = 0;
    
storage.counternotes++;

if (! storage.counternotesmain)
    storage.counternotesmain= 0;
 

if (! storage.counternotesadd)
    storage.counternotesadd = 0;
    
if (! storage.reasons)
     storage.reasons = new StorableCollection();
     
function get_main() {
    if (request.cookies['auth'] == "yes") {
        response.redirect("/cookiecheck");
}
    print(H1("                            Notes"));
    printp("Welcome to Notes!!! Notes is an Appjet Aplication made by Urdna, It uses Appjet's persistant storage to allow users to store or take notes in their browser, above a webpage. Notes typed in the text box will be deleted when a user changes iframes (clicking 'Google' or 'Wikipedia' at the top of the page) or if a webpage does not allow itself to be shown in an iframe. Notes is not responsible for any 'notes' lost while using this service.   ~Urdna ((",link("http://email.appjet.net/urdna","Email Urdna"),"))")
    br();
    printp(link("/cookiecheck", "Continue to Notes"));    
    storage.counternotesmain;
}

function get_cookiecheck() {

    if (request.cookies['auth'] == "yes") {
      response.redirect("/home");
}
      // If the cookies haven't been given already give them with google as the page
      // If they have (auth = yes) don't mess with the cookies!


response.setCookie({
  name: "url",
  value: "http://google.com",
  secure: false,
  expires: 1 
});
response.setCookie({
  name: "auth",
  value: "yes",
  secure: false,
  expires: 1
});
// ^^ something with page and auth cookie, if auth doesn't exist set cookie to google.com

response.redirect("/home")
}


function get_home() {
    
    // thanks to user "Terhorst" for this sections original code
    
print(raw("""
<div onclick="expandNotes();" class="notes" id="contractedNotes">
    <p><i>Edit notes</i></p>
</div>
    
<div class="notes" id="expandedNotes">
<iframe 
   src="http://note.appjet.com/myipnotes" 
   margin="10" 
   border="1" 
   scrolling="auto" 
   width="1000" 
   height="248">
</iframe>
</br></br>
    <a onclick="contractNotes(); return false;" href="#">Hide Notes</a>
</div>

"""));

// end of "terhorst"'s code
}

function get_about() {
    print(H1("                            Notes"));
    print("Notes is an Appjet app made by Urdna. Notes allows users to take 'notes' in their web browser, and save them to appjet servers. This allows users to access their notes from anywhere. This page is currently undergoing updates.  Notes has had "+storage.counternotes+" hits.")
    printp(link("/home","Return to Notes"));
 

}

function get_delete() {
    print("This will delete all notes from your IP address. Are you sure you wish to continue?");
     var form=new QuickForm({action: "http://note.appjet.com/delete", method: "post"});
  form.addSubmit("submit","Delete my notes");
  print(form);    
print(link("/","Don't delete my notes"));
          
    
}

function get_add() {
storage.counternotesadd++
response.redirect("http://carsri.com")   
    }

function get_google() {
response.setCookie({
  name: "url",
  value: "http://google.com",
  secure: false,
  expires: 1 
});    
response.setCookie({
  name: "auth",
  value: "yes",
  secure: false,
  expires: 1
});    
response.redirect("/")        

}
function get_chat() {
response.setCookie({
  name: "url",
  value: "http://notes-chat.appjet.com/",
  secure: false,
  expires: 1 
});
response.setCookie({
  name: "auth",
  value: "yes",
  secure: false,
  expires: 1
});    
  response.redirect("/")  
    
}

function get_en() {
response.setCookie({
  name: "url",
  value: "http://en.wikipedia.org",
  secure: false,
  expires: 1 
});    
response.setCookie({
  name: "auth",
  value: "yes",
  secure: false,
  expires: 1
});    
response.redirect("/")    
}

function get_source() {
response.setCookie({
  name: "url",
  value: "http://appjet.com/app/789141261/source",
  secure: false,
  expires: 1 
});    
response.setCookie({
  name: "auth",
  value: "yes",
  secure: false,
  expires: 1
});    
response.redirect("/")
}

    dispatch();

    if (request.cookies['url'] == "http://appjet.com/app/789141261/source") {
print(raw("""
<iframe 
src ="http://appjet.com/app/789141261/source"
frameborder=0
scrolling="auto"
height=700
width="100%">

      </iframe>
      """));  
}
    if (request.cookies['url'] == "http://en.wikipedia.org") {
print(raw("""
<iframe 
src ="http://en.wikipedia.org/"
frameborder=0
scrolling="auto"
height=700
width="100%">

      </iframe>
      """));  

}
    if (request.cookies['url'] == "http://google.com") {
print(raw("""
<iframe 
src ="http://google.com/"
frameborder=0
scrolling="auto"
height=700
width="100%">

      </iframe>
"""));  
}

    if (request.cookies['url'] == "http://notes-chat.appjet.com/") {
print(raw("""
<iframe 
src ="http://notes-chat.appjet.com"
frameborder=0
scrolling="auto"
height=700
width="100%">

      </iframe>
"""));  
}    




































© Copyright 2007-2008 AppJet Inc.