| 1 |
// $Id: relatedlinks.js,v 1.4.2.6 2008/02/18 20:59:05 karthik Exp $ |
// $Id: relatedlinks.js,v 1.4.2.7 2008/05/08 17:25:33 karthik Exp $ |
| 2 |
|
|
| 3 |
// Todo: Convert to prototype (or behaviour, I suppose) and promote reuse. |
// Todo: Convert to prototype (or behaviour, I suppose) and promote reuse. |
| 4 |
$(document).ready(function() { |
$(document).ready(function() { |
| 17 |
} |
} |
| 18 |
} |
} |
| 19 |
|
|
|
// -1 signifies that no link is being edited at the moment. |
|
|
current = -1; |
|
|
|
|
| 20 |
var autocomplete_path = 'relatedlinks/autocomplete'; |
var autocomplete_path = 'relatedlinks/autocomplete'; |
| 21 |
autocomplete_path = Drupal.settings.relatedlinks.base_path + (Drupal.settings.relatedlinks.clean_urls ? autocomplete_path : '?q=' + autocomplete_path); |
autocomplete_path = Drupal.settings.relatedlinks.base_path + (Drupal.settings.relatedlinks.clean_urls ? autocomplete_path : '?q=' + autocomplete_path); |
| 22 |
|
|
| 39 |
.appendTo(top); |
.appendTo(top); |
| 40 |
|
|
| 41 |
var preview = $('#relatedlinks-preview', fields); |
var preview = $('#relatedlinks-preview', fields); |
|
|
|
| 42 |
links_preview(); |
links_preview(); |
| 43 |
|
|
| 44 |
|
// -1 signifies that no link is being edited at the moment. |
| 45 |
|
var current = -1; |
| 46 |
|
|
| 47 |
var l = $('<a id="relatedlinks-add" href="#">Add / Update</a>') |
var l = $('<a id="relatedlinks-add" href="#">Add / Update</a>') |
| 48 |
.appendTo(fields) |
.appendTo(fields) |
| 49 |
.click(function() { |
.click(function() { |
| 138 |
|
|
| 139 |
// Handle up clicks. Move clicked link up one row. |
// Handle up clicks. Move clicked link up one row. |
| 140 |
$('.relatedlinks-up', table).each(function(k) { |
$('.relatedlinks-up', table).each(function(k) { |
| 141 |
$(this).click(function() { |
$('a', this).click(function() { |
| 142 |
links_swap(k, k + 1); |
links_swap(k, k - 1); |
| 143 |
links_preview(); |
links_preview(); |
| 144 |
return false; |
return false; |
| 145 |
}); |
}); |
| 147 |
|
|
| 148 |
// Handle down clicks. Move clicked link down one row. |
// Handle down clicks. Move clicked link down one row. |
| 149 |
$('.relatedlinks-down', table).each(function(k) { |
$('.relatedlinks-down', table).each(function(k) { |
| 150 |
$(this).click(function() { |
$('a', this).click(function() { |
| 151 |
links_swap(k, k + 1); |
links_swap(k, k + 1); |
| 152 |
links_preview(); |
links_preview(); |
| 153 |
return false; |
return false; |