示例#1
0
javascript.do_before_body('''
window.elidupree.show_transcript = function() {
  remove_class(document.documentElement, 'transcripts_hidden');
  delete_cookie('transcripts_hidden');
};
window.elidupree.hide_transcript = function() {
  document.documentElement.className += ' transcripts_hidden';
  set_cookie('transcripts_hidden', 'true', 30);
};

window.elidupree.handle_content_warnings = function(id, default_on) {
  window.elidupree.enable_content_warnings = function() {
    remove_class(document.documentElement, 'content_warnings_disabled');
    if (default_on) {
      delete_cookie('content_warnings_disabled_'+id);
    }
    else {
      set_cookie('content_warnings_enabled_'+id, 'true', 30);
    }
  };
  window.elidupree.disable_content_warnings = function() {
    document.documentElement.className += ' content_warnings_disabled';
    if (default_on) {
      set_cookie('content_warnings_disabled_'+id, 'true', 30);
    }
    else {
      delete_cookie('content_warnings_enabled_'+id);
    }
  };
  if (default_on && read_cookie('content_warnings_disabled_'+id)) {
    window.elidupree.disable_content_warnings();
  }
  if ((!default_on) && !read_cookie('content_warnings_enabled_'+id)) {
    window.elidupree.disable_content_warnings();
  }
  if (read_cookie('transcripts_hidden')) {
    window.elidupree.hide_transcript();
  }
};

''')
示例#2
0
.scrutiny { background-color: #c0ffff; color: black; text-decoration: underline; }
.skepticism { background-color: #ffc0c0; }

html.restricted_user .hidden_from_restricted_users {display: none;}
''')

javascript.do_before_body (r'''
window.elidupree.transcripts = [];
window.elidupree.handle_transcript = function (ID) {
  var show = function () {
    remove_class (document.documentElement, 'transcript_hidden_' + ID);
    set_cookie ('transcript_shown_' + ID, 'true', 30);
  };
  var hide = function () {
    document.documentElement.className += ' transcript_hidden_'+ ID;
    delete_cookie ('transcript_shown_'+ ID);  
  };
  if (!read_cookie ('transcript_shown_' + ID)) {
    hide ();
  }
  window.elidupree.transcripts.push ([ID, show, hide]);
};
if (read_cookie ('restricted')) {
  document.documentElement.className += ' restricted_user';
}  
''')
javascript.do_after_body(r'''
var comments = document.getElementsByClassName("user_comment");
var all_comments_divs = document.getElementsByClassName("all_comments");
var random_post_link = document.getElementById("random_post");
var index_entries = document.getElementsByClassName("index_entry_link");
var random_entry;
示例#3
0
  utils.make_page (page_dict,
    '/stories',
      "Stories ⊂ Eli Dupree's website",
      '',
      '''<a class="skip" href="#content">Skip to content</a>
      '''+ utils.background_image () +'''
      '''+bars.bars_wrap({"stories":True}, '''<main>
  <div id="content">'''+ blog_posts.stories_index (True) +'''
    <div class="category_page_bottom"></div>
  </div>
</main>''')
  )

javascript.do_before_body (r'''
if (read_cookie ("debug_mode")) {document.documentElement.className += " debug_mode";}
''')

def add_secrets (page_dict, orphaned_pages):
  utils.make_page (page_dict,
    '/secrets',
    "Secrets ⊂ Eli Dupree's website",
    "",
      '''<a class="skip" href="#content">Skip to content</a>
      '''+ utils.background_image () +'''
      '''+bars.bars_wrap({"games":True}, '''<main>
  <div id="content">
    '''
    + exhibit (None, "", None, '''<h1> Secrets </h1> <p>Congratulations! You've arrived at the secret page. You probably got here by supporting <a href="https://www.patreon.com/EliDupree">my Patreon page</a>. (Thank you so much!) Or maybe you found it by snooping through <a href="https://github.com/elidupree">my code on GitHub</a>. (You're very clever!) Either way, welcome! Enjoy the secrets below.</p> ''', None)
    + exhibit (None, "", None, '''<p>When I work on designing this website, I use a debug mode that displays some extra information. Right now, the only hidden information is an estimate of the reading difficulty (in US grade level) of each post.</p> <p><a class="debug" id="disable_debug_mode" href=" javascript:;">Disable debug mode</a><a class="not_debug" id="enable_debug_mode" href=" javascript:;">Enable debug mode</a></p> ''', None)
    + exhibit (None, "", None, '''<p>Not all of my posts are accessible from the main page. Sometimes, I create a temporary page for testing purposes, or a game that is still a work-in-progress. Sometimes, I write things to share with specific fandoms, which wouldn't necessarily be interesting to a general audience (or I might want to avoid recommending a show even by mentioning it). You, dear reader, have special access.</p> <p>All currently inaccessible pages are listed below. If you start from this page and follow links, you can reach everything on elidupree.com.</p> <p>'''+ "".join (['''<a class="orphaned_page_link" href="'''+ page +'''">'''+ page +'''</a>''' for page in orphaned_pages]) + "</p> ", None)