# HG changeset patch # User Franck Deroche # Date 1279285355 -7200 # Node ID a54d04d765549b3d969d95bba5368665bce1df73 # Parent af6627970bc4ec2babaab7a9a1d58632a1c6a3cb# Parent b9cd179a30a8f31246846db769922fd5c80311c1 Merge old changeset to get back to a single head diff -r b9cd179a30a8 -r a54d04d76554 css/dnd-library.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/css/dnd-library.css Fri Jul 16 15:02:35 2010 +0200 @@ -0,0 +1,7 @@ +.tooltip .tooltip { + position: absolute; + top: 0; + left: 0; + z-index: 3; + display: none; +} diff -r b9cd179a30a8 -r a54d04d76554 dnd-library.tpl.php --- a/dnd-library.tpl.php Wed Apr 01 15:49:44 2009 +0200 +++ b/dnd-library.tpl.php Fri Jul 16 15:02:35 2010 +0200 @@ -1,11 +1,3 @@
-
- -
-
- -
- +
diff -r b9cd179a30a8 -r a54d04d76554 dnd.module --- a/dnd.module Wed Apr 01 15:49:44 2009 +0200 +++ b/dnd.module Fri Jul 16 15:02:35 2010 +0200 @@ -30,7 +30,7 @@ */ function dnd_theme() { return array( - 'dnd_library' => array('arguments' => array('element' => NULL, 'settings' => NULL), 'template' => 'dnd-library'), + 'dnd_library_wrapper' => array('arguments' => array('settings' => NULL, 'element' => NULL)), ); } @@ -43,10 +43,6 @@ function dnd_elements() { $type = array(); $type['textarea'] = array( - '#input' => TRUE, - '#cols' => 60, - '#rows' => 5, - '#resizable' => TRUE, '#dnd-enabled' => FALSE, '#dnd-settings' => NULL, '#process' => array('form_expand_ahah', 'dnd_process_textarea'), @@ -56,8 +52,7 @@ /** * Settings array: - * What should it take, if anything? Probably a source... - * maybe editor specific configuration shit? + * What should it take, if anything? Probably a source * maybe editor specific configuration shit? * * - source for library json/ajax shit * - target selector @@ -74,15 +69,12 @@ * configuration options * callback should be smart about attachment and detachment */ -function dnd_process_textarea($element, $form_state) { +function dnd_process_textarea($element, $edit, $form_state, $form) { if ($element['#dnd-enabled']) { - drupal_add_js(drupal_get_path('module', 'dnd') .'/js/dnd.js', 'footer'); - drupal_add_js(drupal_get_path('module', 'dnd') .'/js/dnd-library.js', 'footer'); - $settings = array(); - // We take a string or an + // We take a string or an object or an array if (is_string($element['#dnd-settings'])) { // @TODO load settings } @@ -93,53 +85,67 @@ $settings = $element['#dnd-settings']; } - // Set some important defaults $settings = array('library_id' => $element['#id'] . DND_ID_SUFFIX) + $settings; - // Add enabled libraries to settings for tracking + // BeautyTips + drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/other_libs/excanvas_0002/excanvas-compressed.js'); + drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/other_libs/jquery.hoverIntent.minified.js'); + drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/jquery.bt.js'); + + // Dependencies + drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.url.packed.js'); + drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.fieldselection.js'); + drupal_add_js('misc/jquery.form.js'); + + // Drag and drop + drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.draganddrop.js'); + drupal_add_js(drupal_get_path('module', 'dnd') .'/js/dnd-library.js'); + drupal_add_js(array( 'dndEnabledLibraries' => array($element['#id'] => $settings), ), 'setting'); - $element['#prefix'] = theme('dnd_library', $element, $settings); + // Generate + $element['#prefix'] .= '
'; + $element['#suffix'] = '
'; + if (module_exists('mee')) { + drupal_add_css(drupal_get_path('module', 'mee') .'/css/mee.css'); + } + } return $element; } -function template_preprocess_dnd_library(&$variables) { - global $base_url; - list($element, $settings) = array($variables['element'], $variables['settings']); +/** + * Implementation of hook_wywiwyg_plugin(). + */ +function dnd_wysiwyg_plugin($editor, $version=0) { + $plugins = array(); + switch ($editor) { + case 'tinymce': + if ($version > 3) { + $plugins['forcecontainer'] = array( + 'title' => t('Force Container Plugin'), + 'description' => t('A custom plugin to forces a selection up to the outer container of a given element.'), + 'extensions' => array('forcecontainer' => t('Force Container')), + 'path' => drupal_get_path('module', 'dnd') .'/js/tinymce/forcecontainer/editor_plugin_src.js', + 'load' => TRUE, + 'options' => array( + 'forcecontainer_class' => 'dnd-drop-wrapper', + 'forcecontainer_trigger_dnd' => TRUE, + ), + ); + } + break; + } + return $plugins; +} - // Get library via a backdoor HTTP request. This is plenty fast for this - // application and keeps things nice and consistent. - if (!($url = parse_url($settings['url']))) { - return t('This library is not available'); - } - $headers = array(); - // Handle both relative and absolute urls - if (!isset($url['scheme'])) { - $settings['url'] = $base_url .'/'. $settings['url']; - $headers['Cookie'] = session_name() .'='. session_id(); - } +/** + * Theme the markup that will surround a library loaded via JSON. + */ +function theme_dnd_library_wrapper($settings, $element = NULL) { + return '
'; +} - $request = drupal_http_request($settings['url'], $headers); - - // We must remove some Drupal escaping - $json = json_decode(str_replace(array('\x3c', '\x3e', '\x26'), array("<", ">", "&"), $request->data), TRUE); - - // Generate an array of editor representations to add - if (is_array($json['editor_representations'])) { - foreach ($json['editor_representations'] as $editor_id=>$editor_item) { - $editor_representations[$editor_id] = filter_xss_admin($editor_item); - } - } - - // Store editor representations in Drupal setting - drupal_add_js(array('dndEditorRepresentations' => $editor_representations,), 'setting'); - - $variables['library_id'] = $settings['library_id']; - $variables['header'] = filter_xss_admin($json['header']); - $variables['library'] = filter_xss_admin($json['library']); - $variables['footer'] = filter_xss_admin($json['footer']); -} diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/dnd-editor-item.tpl.php --- a/dnd_test/dnd-editor-item.tpl.php Wed Apr 01 15:49:44 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ - - - diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/dnd-library-item.tpl.php --- a/dnd_test/dnd-library-item.tpl.php Wed Apr 01 15:49:44 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -
-
- -
- -
-
-
-
-
- -
- -
-
diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/dnd_test.css --- a/dnd_test/dnd_test.css Wed Apr 01 15:49:44 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/* This is bad stuff! */ -.body-field-wrapper { - float: left; - width: 100%; -} -.dnd-library-wrapper { - float: left; - width: 220px; - margin-right: 20px; - margin-top: 1em; - border: 1px solid #aaa; -} -.dnd-library-wrapper .header { - padding: 1px 4px; - background-color: #ccc; -} -.dnd-library-wrapper .header h3 { - font-size: 12px; - font-weight: bold; -} -.dnd-library-wrapper .footer { - float: left; - width: 100%; - border-top: 1px solid #aaa; - background-color: #ccc; -} -.dnd-library-wrapper .pager { - font-weight: bold; - padding: 0 5px; -} -#edit-body-wrapper { - float: left; - width: 700px; -} -.dnd-library-wrapper .editor-item { - float: left; - width: 220px; - border-top: 1px solid #aaa; - margin-bottom: 1px; -} -.dnd-library-wrapper .editor-item > div { - padding: 5px 4px; -} -.dnd-library-wrapper div.image { - float: left; - width: 64px; - padding-left: 6px; - line-height: 1; -} -.dnd-library-wrapper div.meta { - float: left; - width: 110px; -} -.dnd-library-wrapper .title { - font-weight: bold; -} -.dnd-library-wrapper .date, .dnd-library-wrapper .author { - font-size: .75em; -} -.dnd-library-wrapper .editor-item .sizes { - float: left; - width: 18px; -} -.dnd-library-wrapper .editor-item .sizes ul { - list-style-type: none; - margin: 0; -} -.dnd-library-wrapper .editor-item .sizes ul li { - background: none; - list-style-type: none; - padding: 0; - margin: 0; -} -.dnd-library-wrapper .editor-item .sizes a { - float: left; - display: block; - font-size: 9px; - line-height: 9px; - margin-bottom: 2px; - width: 19px; - text-align: center; -} -.dnd-library-wrapper .editor-item .sizes a:link, -.dnd-library-wrapper .editor-item .sizes a:visited, -.dnd-library-wrapper .editor-item .sizes a:active { - border: 1px solid #888; - color: #fff; - cursor: move; - text-align: center; -} -.dnd-library-wrapper .editor-item .sizes a:hover, -.dnd-library-wrapper .editor-item .sizes a.dnd-inserted:link, -.dnd-library-wrapper .editor-item .sizes a.dnd-inserted:visited, -.dnd-library-wrapper .editor-item .sizes a.dnd-inserted:active { - border: 1px solid #555; - color: #fff; - text-decoration: none; -} -.dnd-library-wrapper .editor-item .sizes a:hover span, -.dnd-library-wrapper .editor-item .sizes a.dnd-inserted span { - background-color: #555; -} - -.dnd-library-wrapper .editor-item .sizes a span { - display: block; - background-color: #888; -} -.dnd-library-wrapper .editor-item .sizes a.size-S span { - margin: 3px; - padding: 2px 0; -} -.dnd-library-wrapper .editor-item .sizes a.size-M span { - margin: 2px; - padding: 3px 0; -} -.dnd-library-wrapper .editor-item .sizes a.size-L span { - margin: 1px; - padding: 4px 0; -} -.dnd-library-wrapper .editor-item.dnd-child-inserted { - background-color: #ffd; -} diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/dnd_test.info --- a/dnd_test/dnd_test.info Wed Apr 01 15:49:44 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -; $Id$ -name = DnD Library Tests -package = User interface -description = Defines some menu callbacks and form alterations which test the drag and drop plugin. -dependencies[] = dnd -core = 6.x - diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/dnd_test.module --- a/dnd_test/dnd_test.module Wed Apr 01 15:49:44 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ - 'Drag and drop test library', - 'page callback' => 'dnd_test_library', - 'access arguments' => array('access dnd test library'), - ); - return $items; -} - -/** - * Implementation of hook_perm(). - */ -function dnd_test_perm() { - return array('access dnd test library'); -} - - -/** - * Implementation of hook_form_alter(). - * - * This demonstrates how to attach Drag and Drop to a given textarea. - */ -function dnd_test_form_alter(&$form, &$form_state) { - if ($form['#id'] == 'node-form' && $form['type']['#value'] == 'page') { - drupal_add_css(drupal_get_path('module', 'dnd_test') .'/dnd_test.css'); - $form['body_field']['body']['#dnd-enabled'] = TRUE; - $form['body_field']['body']['#dnd-settings'] = array( - 'drop_selector' => '#edit-body-dnd-library .drop', - 'url' => 'dnd-test/library', - ); - $form['body_field']['body']['#rows'] = 28; - } -} - -/** - * Implementation of hook_theme(). - */ -function dnd_test_theme() { - return array( - 'dnd_editor_item' => array( - 'arguments' => array('i' => NULL, 'size' => NULL), - 'template' => 'dnd-editor-item', - ), - 'dnd_library_item' => array( - 'arguments' => array('i' => NULL), - 'template' => 'dnd-library-item', - ), - ); -} - -/** - * Page call back that returns some JSON - */ -function dnd_test_library() { - $page = ($_GET['page']) ? $_GET['page'] : 1; - $test_library = dnd_test_generate_library($page); - return drupal_json(array( - 'header' => '

'. t('Test library: Page @page', array('@page' => $page)) .'

', - 'library' => $test_library['library'], - 'editor_representations' => $test_library['editor_representations'], - 'footer' => '
'. l(t('1'), 'dnd-test/library') . ' '. l(t('2'), 'dnd-test/library', array('query' => array('page' => 2))) .'
', - )); -} - -/** - * Create contrived output - */ -function dnd_test_generate_library($page = 1, $limit = 5) { - $start = ($page * $limit) - ($limit); - $end = $page * $limit; - - $library = ''; - $editor_representations = array(); - for ($i=$start + 1; $i < $end + 1; $i++) { - $library .= theme('dnd_library_item', $i); - $editor_representations += dnd_editor_items($i); - } - return array( - 'library' => $library, - 'editor_representations' => $editor_representations, - ); -} - -/** - * Theme wrapper that spins out multiple library representations for a given - * editor representation. This is because we want to demonstrate how to allow - * for multiple versions (i.e. different sizes) of a single item - */ -function dnd_editor_items($i) { - $item = array(); - foreach(array(t('S'), t('M'), t('L')) as $size) { - $item['item-'. $i .'-'. $size] = theme('dnd_editor_item', $i, $size); - } - return $item; -} - -/** - * Completely contrived edit item theme function - */ -function template_preprocess_dnd_library_item(&$variables) { - $i = $variables['i']; - $variables['image'] = theme('image', drupal_get_path('module', 'dnd_test') .'/img/item-'. $i .'-thumb.jpg'); - $variables['title'] = t('Lorem Ipsum @count', array('@count' => $i)); - $variables['date'] = 'Feb 18 2009'; - $variables['author'] = 'David Eads'; - foreach(array(t('S'), t('M'), t('L')) as $size) { - $sizes[] = l(''. $size .'', '', array( - 'html' => TRUE, - 'attributes' => array( - 'class' => 'drop size-'. $size, - 'id' => 'item-'. $i .'-'. $size, - ), - 'query' => array('dnd_id' => 'item-'. $i .'-'. $size), - )); - } - $variables['sizes'] = ''; -} - - -function template_preprocess_dnd_editor_item(&$variables) { - list($i, $size) = array($variables['i'], $variables['size']); - $variables['image'] = theme('image', drupal_get_path('module', 'dnd_test') .'/img/item-'. $i .'-'. $size .'.jpg'); -} diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img-backup/page-1-large.jpg Binary file dnd_test/img-backup/page-1-large.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img-backup/page-1-small.jpg Binary file dnd_test/img-backup/page-1-small.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img-backup/page-2-large.jpg Binary file dnd_test/img-backup/page-2-large.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img-backup/page-2-small.jpg Binary file dnd_test/img-backup/page-2-small.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-1-L.jpg Binary file dnd_test/img/item-1-L.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-1-M.jpg Binary file dnd_test/img/item-1-M.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-1-S.jpg Binary file dnd_test/img/item-1-S.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-1-thumb.jpg Binary file dnd_test/img/item-1-thumb.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-10-L.jpg Binary file dnd_test/img/item-10-L.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-10-M.jpg Binary file dnd_test/img/item-10-M.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-10-S.jpg Binary file dnd_test/img/item-10-S.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-10-thumb.jpg Binary file dnd_test/img/item-10-thumb.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-2-L.jpg Binary file dnd_test/img/item-2-L.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-2-M.jpg Binary file dnd_test/img/item-2-M.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-2-S.jpg Binary file dnd_test/img/item-2-S.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-2-thumb.jpg Binary file dnd_test/img/item-2-thumb.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-3-L.jpg Binary file dnd_test/img/item-3-L.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-3-M.jpg Binary file dnd_test/img/item-3-M.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-3-S.jpg Binary file dnd_test/img/item-3-S.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-3-thumb.jpg Binary file dnd_test/img/item-3-thumb.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-4-L.jpg Binary file dnd_test/img/item-4-L.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-4-M.jpg Binary file dnd_test/img/item-4-M.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-4-S.jpg Binary file dnd_test/img/item-4-S.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-4-thumb.jpg Binary file dnd_test/img/item-4-thumb.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-5-L.jpg Binary file dnd_test/img/item-5-L.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-5-M.jpg Binary file dnd_test/img/item-5-M.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-5-S.jpg Binary file dnd_test/img/item-5-S.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-5-thumb.jpg Binary file dnd_test/img/item-5-thumb.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-6-L.jpg Binary file dnd_test/img/item-6-L.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-6-M.jpg Binary file dnd_test/img/item-6-M.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-6-S.jpg Binary file dnd_test/img/item-6-S.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-6-thumb.jpg Binary file dnd_test/img/item-6-thumb.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-7-L.jpg Binary file dnd_test/img/item-7-L.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-7-M.jpg Binary file dnd_test/img/item-7-M.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-7-S.jpg Binary file dnd_test/img/item-7-S.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-7-thumb.jpg Binary file dnd_test/img/item-7-thumb.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-8-L.jpg Binary file dnd_test/img/item-8-L.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-8-M.jpg Binary file dnd_test/img/item-8-M.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-8-S.jpg Binary file dnd_test/img/item-8-S.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-8-thumb.jpg Binary file dnd_test/img/item-8-thumb.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-9-L.jpg Binary file dnd_test/img/item-9-L.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-9-M.jpg Binary file dnd_test/img/item-9-M.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-9-S.jpg Binary file dnd_test/img/item-9-S.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/item-9-thumb.jpg Binary file dnd_test/img/item-9-thumb.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/page-1-large.jpg Binary file dnd_test/img/page-1-large.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 dnd_test/img/page-2-large.jpg Binary file dnd_test/img/page-2-large.jpg has changed diff -r b9cd179a30a8 -r a54d04d76554 js/bt/.DS_Store Binary file js/bt/.DS_Store has changed diff -r b9cd179a30a8 -r a54d04d76554 js/bt/CHANGELOG.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/bt/CHANGELOG.txt Fri Jul 16 15:02:35 2010 +0200 @@ -0,0 +1,20 @@ +== 0.9.1 == + +* Added dynamic Ajax paths (and demo) + +== 0.9 == +* AJAX!!! +* changed jQuery.fn.bt.defaults to jQuery.bt.defaults +* Changed "titleSelector" option to "contentSelector" for clarity +* bgiframe plugin support (to fix z-index problems in IE6) +* hoverIntent plugin support! +* Added activeClass (default: "bt-active") on target elements +* Added DEMO documentation +* Added click-anywhere-to-close functionality +* Added close-when-others-open functionality +* created a changelog file :-) +* lots of various bugs fixed + + +== 0.7 (10/20/2008) == +* initial release diff -r b9cd179a30a8 -r a54d04d76554 js/bt/DEMO/.DS_Store Binary file js/bt/DEMO/.DS_Store has changed diff -r b9cd179a30a8 -r a54d04d76554 js/bt/DEMO/demofiles/beautytips.png Binary file js/bt/DEMO/demofiles/beautytips.png has changed diff -r b9cd179a30a8 -r a54d04d76554 js/bt/DEMO/demofiles/close.gif Binary file js/bt/DEMO/demofiles/close.gif has changed diff -r b9cd179a30a8 -r a54d04d76554 js/bt/DEMO/demofiles/demo-ajax.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/bt/DEMO/demofiles/demo-ajax.html Fri Jul 16 15:02:35 2010 +0200 @@ -0,0 +1,9 @@ + + +The Ajax Demo Content + + +

This paragraph should be ignored

+
This content came from a separate html page.
+ + \ No newline at end of file diff -r b9cd179a30a8 -r a54d04d76554 js/bt/DEMO/demofiles/demo-ie-fix.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/bt/DEMO/demofiles/demo-ie-fix.css Fri Jul 16 15:02:35 2010 +0200 @@ -0,0 +1,9 @@ +/** + * IE is completely stupid about relative elements and stacking elements + * http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html + * This fix is specific to this demo page and won't be needed for most + * uses of BeautyTips + */ +div.example { + position: static; +} \ No newline at end of file diff -r b9cd179a30a8 -r a54d04d76554 js/bt/DEMO/demofiles/demo.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/bt/DEMO/demofiles/demo.css Fri Jul 16 15:02:35 2010 +0200 @@ -0,0 +1,111 @@ +@charset "UTF-8"; + +body { + background: #FFF; + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; +} + +td { + text-align: center; +} + +div.example { + margin-bottom: 20px; + position: relative; +} + +div.ie-fix { + overflow: visible; + height: 0; +} + +.target { + width: 80px; + text-align: center; + border: 2px solid #666666; + padding: 5px; + background-color: #00FFFF; + height: 45px; + display: block; + float: left; +} + +input.alt-target { + width: 80px; +} + +#page { + width: 600px; + margin-right: auto; + margin-left: auto; + background-color: #EEE; + padding: 2em; + margin-top: 0px; + margin-bottom: 0px; +} + +h3 { + color: #666666; + border-bottom-width: 2px; + border-bottom-style: solid; + border-bottom-color: #666666; + font-size: 1.2em; + margin: 0 0 .4em 0; +} +p { + margin-top: 0px; + margin-bottom: 1em; +} + +.desc { + margin-left: 100px; +} + +.source { + /*clear: both;*/ +} + +.html-source, .js, .css-source { + font-family: "Courier New", Courier, monospace; + background-color: #FFF; + /*clear: both;*/ +} + +.html-source textarea, .js textarea, .css-source textarea { + font-family: "Courier New", Courier, monospace; + font-size: 11px; +} + +.html-link a:focus, .js-link a:focus, .css-link a:focus { + outline: none; + -moz-outline: none; +} + +/** Google maps demo **/ + +#example17 { + cursor: pointer; +} + +.gmap { + font-family: Arial, sans-serif; + font-size: 13px; + position: relative; +} + +.gmap-title { + font-size: 16px; + font-weight: bold; +} + +.gmap-addr { + padding-bottom: 15px; + padding-top: 5px; +} + +.gmap-close { + position: absolute; + top: 0; + right: 0; + border: none; +} \ No newline at end of file diff -r b9cd179a30a8 -r a54d04d76554 js/bt/DEMO/demofiles/demo.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/bt/DEMO/demofiles/demo.js Fri Jul 16 15:02:35 2010 +0200 @@ -0,0 +1,92 @@ +/** + * Fancy script sets up the page and runs the code in the div.js elements + */ +$(function(){ + $('div.example').each(function() { + var target = $('.target, .alt-target', this); + var htmlSource = $('
').append(target.clone()).html(); + htmlSource = $('
' + escapeHTMLEncode(htmlSource) + '
'); + var html = $('').click(function(){ + if ($.browser.msie) { + // ugh!!! effing IE + $(this).parent().find('.html-source').toggle(); + } + else { + $(this).parent().find('.html-source').slideToggle(); + } + return false; + }); + var jsLink = $('').click(function(){ + if ($.browser.msie) { + $(this).parent().find('.js').toggle(); + } + else { + $(this).parent().find('.js').slideToggle(); + } + return false; + }); + + var cssSource = $('style', this); + if (cssSource.length) { + cssSource = $('
' + cssSource.html() + '
'); + var css = $('').click(function(){ + if ($.browser.msie) { + $(this).parent().find('.css-source').toggle(); + } + else { + $(this).parent().find('.css-source').slideToggle(); + } + return false; + }); + } + + var jsSource = $('.js', this); + $(jsSource).before(html); + $(jsSource).before(htmlSource); + textareaWrap(htmlSource); + $('textarea', htmlSource).data('target', target[0]).change(function(){ + var newTarg = $($(this).val()).get(0); + $($(this).data('target')).replaceWith(newTarg); + $(this).data('target', newTarg); + }); + htmlSource.hide(); + + if (typeof css != 'undefined') { + $(jsSource).before(css); + $(jsSource).before(cssSource); + textareaWrap(cssSource); + cssSource.hide(); + } + + $(jsSource).before(jsLink); + //eval the source! + eval(jsSource.html()); + textareaWrap(jsSource, true); + $('textarea', jsSource).change(function(){ + eval($(this).val()); + }); + jsSource.hide(); + }); + + // add BeautyTip to js and html-source textareas + $('div.js textarea, div.html-source textarea').bt('This is live code. Feel free to edit and try out new options. Click (or tab) out of the textarea to see the results of your edits. If things go awry, reload the page.', {positions: 'right', trigger: ['focus', 'blur'], overlap: 8, width: 150, cssStyles: {fontSize: '11px'}}); +}); + +function textareaWrap(obj, escape) { + var html = $(obj).html(); + if (escape) { + html = escapeHTMLEncode(html); + } + $(obj).empty().append($('