fancy transitions

This commit is contained in:
John Bintz 2009-10-04 22:37:22 -04:00
parent ec3619ec2a
commit 6f8b2269f9
5 changed files with 50 additions and 20 deletions

View File

@ -26,7 +26,8 @@ class WhatDidTheySayAdmin {
'hide_transcript' => array(
'home' => true,
'single' => false
)
),
'transcript_effects' => false
);
var $capabilities = array();
@ -193,6 +194,7 @@ class WhatDidTheySayAdmin {
function template_redirect() {
wp_enqueue_script('wdts-script', get_bloginfo('url') . '?wdts[script]=true', array('prototype'));
wp_enqueue_script('toggle-transcript', plugin_dir_url(dirname(__FILE__)) . 'js/toggle-transcript.js', array('prototype', 'wdts-script'), false, true);
if (current_user_can('submit_transcriptions')) {
wp_enqueue_script('scriptaculous-effects');
wp_enqueue_script('edit-transcripts', plugin_dir_url(dirname(__FILE__)) . 'js/edit-transcripts.js', array('scriptaculous-effects', 'wdts-script'));
@ -203,6 +205,10 @@ class WhatDidTheySayAdmin {
if (!empty($options['load_default_styles'])) {
wp_enqueue_style('wdts-defaults', plugin_dir_url(dirname(__FILE__)) . 'css/wdts-defaults.css');
}
if ($options['transcript_effects']) {
wp_enqueue_script('scriptaculous-effects');
}
}
/**
@ -565,9 +571,9 @@ class WhatDidTheySayAdmin {
if (current_user_can('edit_themes')) {
$options = get_option('what-did-they-say-options');
$options['load_default_styles'] = isset($info['default_styles']);
$options['use_nl2br'] = isset($info['use_nl2br']);
$options['excerpt_distance'] = !empty($info['excerpt_distance']) ? $info['excerpt_distance'] : 30;
foreach (array('load_default_styles', 'use_nl2br', 'transcript_effects') as $field) {
$options[$field] = isset($info[$field]);
}
update_option('what-did-they-say-options', $options);
$updated = __('Default styles option updated.', 'what-did-they-say');

View File

@ -14,12 +14,20 @@
<label>
<input type="checkbox"
name="wdts[default_styles]"
name="wdts[load_default_styles]"
value="yes"
<?php echo ($options['load_default_styles'] ? 'checked="checked"' : '') ?> />
<?php _e('Include default CSS styles for transcripts', 'what-did-they-say') ?>
</label>
<label>
<input type="checkbox"
name="wdts[transcript_effects]"
value="yes"
<?php echo ($options['transcript_effects'] ? 'checked="checked"' : '') ?> />
<?php _e('Enable fancy transcript open/close transitions. Increases page download size.', 'what-did-they-say') ?>
</label>
<label>
<input type="checkbox"
name="wdts[use_nl2br]"

View File

@ -37,3 +37,5 @@ WhatDidTheySay.can_approve = <?php echo current_user_can('approve_transcriptions
WhatDidTheySay.languages = { <?php echo implode(",", $language_output) ?> };
WhatDidTheySay.default_language = '<?php echo $language_options->get_default_language() ?>';
WhatDidTheySay.use_transcript_effects = <?php echo ($options['transcript_effects'] ? "true" : "false") ?>;

View File

@ -35,3 +35,7 @@ div.wdts-transcript div.wdts-dialog span.wdts-name {
div.wdts-transcript div.wdts-dialog span.wdts-speech {
margin: 0.5em 1em 0
}
.wdts-transcript-opener {
margin: 0.5em 0;
}

View File

@ -20,10 +20,18 @@ WhatDidTheySay.build_bundle_header = function(bundle) {
var show_only_this_code = function(code) {
transcript_holders.each(function(t) {
if (t.hasClassName(code)) {
if (WhatDidTheySay.use_transcript_effects) {
new Effect.BlindDown(t, { duration: 0.25 });
} else {
t.show();
}
} else {
if (WhatDidTheySay.use_transcript_effects) {
new Effect.BlindUp(t, { duration: 0.25 });
} else {
t.hide();
}
}
});
};
@ -72,26 +80,28 @@ $$('.wdts-transcript-container').each(function(d) {
if (opener && closer) {
opener.observe('click', function(e) {
opener.hide();
closer.show();
opener.hide(); closer.show();
if (WhatDidTheySay.use_transcript_effects) {
new Effect.BlindDown(bundle, { duration: 0.25 });
} else {
bundle.show();
}
});
closer.observe('click', function(e) {
closer.hide();
opener.show();
closer.hide(); opener.show();
if (WhatDidTheySay.use_transcript_effects) {
new Effect.BlindUp(bundle, { duration: 0.25 });
} else {
bundle.hide();
}
});
}
if (d.hasClassName('wdts-start-hidden')) {
bundle.hide();
closer.hide();
opener.show();
bundle.hide(); closer.hide(); opener.show();
} else {
bundle.show();
closer.show();
opener.hide();
bundle.show(); closer.show(); opener.hide();
}
}
});