fix edit buttons for ie

This commit is contained in:
John Bintz 2009-09-30 22:33:17 -04:00
parent 12ad221d29
commit c970934553
5 changed files with 20 additions and 19 deletions

View File

@ -1,4 +1,4 @@
<div class="queued-transcript-holder" id="wdts-<?php echo $id = md5(rand()) ?>">
<?php include(dirname(__FILE__) . '/_queued-transcript-contents.inc') ?>
</div>
<script type="text/javascript">WhatDidTheySay.setup_transcript_action_buttons('wdts-<?php echo $id ?>', 'wdts-<?php echo $approved_editor_id ?>')</script>
<script type="text/javascript">queued_editors_to_attach.push('wdts-<?php echo $id ?>');</script>

View File

@ -22,7 +22,7 @@
'dialog': '<?php _e('Dialog') ?>',
'approve': '<?php _e('Approve') ?>',
'delete': '<?php _e('Delete') ?>',
'edit': '<?php _e('Edit') ?>',
'edit': '<?php _e('Edit') ?>'
};
WhatDidTheySay.can_approve = <?php echo current_user_can('approve_transcriptions') ? "true" : "false" ?>;

View File

@ -7,7 +7,7 @@
?>
<?php } ?>
<?php if (current_user_can('submit_transcriptions')) { ?>
<div id="wdts-<?php echo $new_transcript_id ?>" <?php echo (!$transcript_options->are_new_transcripts_allowed() ? 'style="display:none"' : '') ?>>
<div id="wdts-<?php echo $new_transcript_id ?>" style="zoom:1<?php echo (!$transcript_options->are_new_transcripts_allowed() ? ';display:none' : '') ?>">
<h3 class="wdts"><?php _e('Submit a new transcript:', 'what-did-they-say') ?></h3>
<form method="post">
<input type="hidden" name="wdts[_nonce]" value="<?php echo wp_create_nonce('what-did-they-say') ?>" />

View File

@ -4,13 +4,15 @@
<input type="hidden" name="wdts[_nonce]" value="<?php echo $nonce ?>" />
<?php } ?>
<label>
<input id="wdts-<?php echo $checkbox_id = md5(rand()) ?>" type="checkbox" name="wdts[allow_on_post]" value="yes" <?php echo ($transcript_options->are_new_transcripts_allowed()) ? 'checked="checked"' : '' ?> />
<?php _e('Allow new transcripts to be submitted for this post', 'what-did-they-say') ?>
</label>
<?php $approved_editor_id = md5(rand()) ?>
<script type="text/javascript">
var queued_editors_to_attach = [];
</script>
<?php if (!is_admin()) { ?>
<?php include(dirname(__FILE__) . '/_manage-queued-transcripts.inc') ?>
<?php } ?>
@ -55,6 +57,10 @@
</div>
<script type="text/javascript">
queued_editors_to_attach.each(function(q) {
WhatDidTheySay.setup_transcript_action_buttons(q, 'wdts-<?php echo $approved_editor_id ?>')
});
WhatDidTheySay.setup_transcript_editor('wdts-<?php echo $approved_editor_id ?>');
<?php if (!is_admin()) { ?>
<?php

View File

@ -44,7 +44,7 @@ WhatDidTheySay.setup_transcript_editor = function(container) {
if (document.selection) {
var range = document.selection.createRange();
var stored_range = range.duplicate();
stored_range.moveToElementText(current_transcript);
stored_range.moveToElementText(transcript);
stored_range.setEndPoint('EndToEnd', range);
transcript.selectionStart = stored_range.text.length - range.text.length;
transcript.selectionEnd = current_transcript.selectionStart + range.text.length;
@ -140,7 +140,7 @@ WhatDidTheySay.setup_transcript_editor = function(container) {
'method': 'post',
'parameters': parameters,
'onSuccess': function() { update_update_message(WhatDidTheySay.messages.transcripts_updated); },
'onFailure': function() { update_update_message(WhatDidTheySay.messages.transcripts_failure); },
'onFailure': function() { update_update_message(WhatDidTheySay.messages.transcripts_failure); }
}
);
});
@ -259,8 +259,8 @@ WhatDidTheySay.setup_transcript_action_buttons = function(container, approved_ed
var transcript = container.select('.transcript').pop();
var editor = new Element("div", { class: 'wdts-transcript-editor' });
var button_holder = new Element("div", { class: 'wdts-button-holder' });
var editor = new Element("div", { className: 'wdts-transcript-editor' });
var button_holder = new Element("div", { className: 'wdts-button-holder' });
var textnode = new Element('textarea', { style: 'height: 200px; width: 99%' });
textnode.value = container.select('.queued-transcript-raw').pop().innerHTML;
@ -293,7 +293,7 @@ WhatDidTheySay.setup_transcript_action_buttons = function(container, approved_ed
},
'onComplete': function() {
new Effect.Highlight(container);
WhatDidTheySay.setup_transcript_action_buttons(container);
WhatDidTheySay.setup_transcript_action_buttons(container, approved_editor_container);
}
});
}
@ -317,14 +317,11 @@ WhatDidTheySay.setup_allow_new_transcripts = function(checkbox, editor) {
if (checkbox) {
checkbox = $(checkbox);
checkbox.observe('change', function(e) {
Event.stop(e);
checkbox.observe('click', function(e) {
if (editor) { editor = $(editor); }
var p = $(checkbox.parentNode.parentNode);
var p = $(checkbox.parentNode);
if (p) {
top.console.log(p);
var post_id = p.select("input[name*=[post_id]]").pop();
if (post_id) {
@ -345,8 +342,6 @@ WhatDidTheySay.setup_allow_new_transcripts = function(checkbox, editor) {
'method': 'post',
'parameters': parameters,
'onSuccess': function() {
new Effect.Highlight(checkbox.parentNode);
if (editor) {
if (checkbox.checked) {
new Effect.BlindDown(editor, { duration: 0.5 });