diff --git a/inc/class.page.php b/inc/class.page.php --- a/inc/class.page.php +++ b/inc/class.page.php @@ -138,7 +138,7 @@ class page $this->headCode['outputPrintStyle'] = ''; $this->headCode['outputStyle'] = ''; $this->headCode['gliderHeadcode'] = ''; - $this->headCode['uiTabsKeyboard'] = ''; + $this->headCode['uiTabsKeyboard'] = ''; $this->headCode['displayTables'] = ''; $this->pagetitle = $ntitle; diff --git a/inc/class.schedule.php b/inc/class.schedule.php --- a/inc/class.schedule.php +++ b/inc/class.schedule.php @@ -462,6 +462,10 @@ class Schedule $outputPage = page::page_create(htmlentities($this->getName()), $headcode, array('school' => $this->school_get(), 'semester' => $this->semester_get())); + $outputPage->headcode_add('schedule_share_links', $outputPage->script_wrap( + 'var share_facebook_template = ' . json_encode('https://facebook.com/sharer.php?t=' . rawurlencode($this->scheduleName) . '&u=' . $outputPage->gen_share_url($this->id_get())) . ";\n" + . 'var share_url_template = ' . json_encode($outputPage->gen_share_url($this->id_get())) . ';'), + TRUE); $outputPage->conversion(); if (!empty($this->created)) $outputPage->meta('dcterms.created', gmdate(DATE_W3C, $this->created)); @@ -495,10 +499,6 @@ class Schedule echo ' jQuery.address.change(function(event){'; echo ' jQuery("#tabs").tabs( "select" , window.location.hash );'; echo ' });'; - echo ' jQuery("#tabs").bind("tabsselect", function(event, ui) {'; - echo ' window.location.hash = ui.tab.hash;'; - echo ' });'; - echo ' jQuery("#sharedialog").dialog({ modal: true, width: 550, resizable: false, draggable: false, autoOpen: false });'; echo ' jQuery("#share").click( function() { @@ -516,8 +516,8 @@ class Schedule . ' ' . PHP_EOL; echo '
' . PHP_EOL - . '

[fb] Share on Facebook

-

[sp]Share with URL

Copy the share URL below:
' . htmlentities($outputPage->gen_share_url($this->id_get())) . '

' . PHP_EOL + . '

[fb] Share on Facebook

+

[sp]Share with URL

Copy the share URL below:
' . htmlentities($outputPage->gen_share_url($this->id_get())) . '

' . PHP_EOL . '
' . PHP_EOL . '

' . PHP_EOL . ' Edit' . PHP_EOL diff --git a/scripts/uiTabsKeyboard.js b/scripts/uiTabsKeyboard.js --- a/scripts/uiTabsKeyboard.js +++ b/scripts/uiTabsKeyboard.js @@ -1,5 +1,5 @@ -/* - * Copyright 2010 Nathan Gelderloos, Ethan Zonca, Nathan Phillip Brink +/* -*- tab-width: 4; -*- + * Copyright 2012 Nathan Gelderloos, Ethan Zonca, Nathan Phillip Brink * * This file is part of SlatePermutate. * @@ -18,6 +18,8 @@ */ jQuery(document).ready( function() { + var share_facebook_a_obj = jQuery('#share-fb-a'); + var share_url_em_obj = jQuery('#share-url-em'); jQuery(document).keydown(function(e) { @@ -45,4 +47,20 @@ jQuery(document).ready( function() { } } }); + + function share_update_uris(hash) + { + share_facebook_a_obj.attr('href', share_facebook_template + hash.replace('#', '%23')); + share_url_em_obj.text(share_url_template + hash); + } + share_update_uris(window.location.hash); + + jQuery('#tabs').bind('tabsselect', function(event, ui) { + window.location.hash = ui.tab.hash; + /* + * Update some links to be specific to the current bug (bug + * #92). + */ + share_update_uris(ui.tab.hash); + }); });