Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Here is a script I wrote a while back that adds the ability to open up one of the issue tracker links as an iframe. You click on the show issue link. If there is a new reply it'll automatically open up to that reply in the issue.
Screenshot of the Show issue link
http://www.diigo.com/item/image/khh3/0crv
Screenshot of the iframe
http://www.diigo.com/item/image/khh3/5btu
This doesn't use the dreditor overlay so i'm sure it can be improved by using that instead of it's own overlay.
Here is the script.
// ==UserScript==
// @name Enhance Tracker
// @namespace http://redndahead.com/enhanceTracker
// @description Add show/hide controls for loading each issue in an iframe
// @include http://drupal.org/user/*/track*
// @include https://drupal.org/user/*/track*
// ==/UserScript==
// Initialize window objects.
$ = window.$ = window.jQuery = unsafeWindow.jQuery;
Drupal = window.Drupal = unsafeWindow.Drupal;
// Bail out in (the unlikely) case that JS has been disabled.
if (Drupal === undefined) {
return false;
}
//the status of overlay box
var isOpen = false;
//function to display the box
function showOverlayBox() {
//if box is not set to open then don't do anything
if( isOpen == false ) return;
// set the properties of the overlay box, the left and top positions
jQuery('.overlayBox').css({
display:'block',
left:( jQuery(window).width() - jQuery('.overlayBox').width() )/2,
top:( jQuery(window).height() - jQuery('.overlayBox').height() )/2 - 20 + jQuery(window).scrollTop(),
position:'absolute'
});
// set the window background for the overlay. i.e the body becomes darker
jQuery('.bgCover').css({
display:'block',
width: jQuery(window).width(),
height:jQuery(window).height(),
});
}
// Launches the overlay
function doOverlayOpen() {
//set status to open
isOpen = true;
showOverlayBox();
jQuery('.bgCover').css({opacity:0}).animate( {opacity:0.5, backgroundColor:'#000'} );
// dont follow the link : so return false.
return false;
}
// Closes the overlay
function doOverlayClose() {
//set status to closed
isOpen = false;
jQuery('.overlayBox').css( 'display', 'none' );
// now animate the background to fade out to opacity 0
// and then hide it after the animation is complete.
jQuery('.bgCover').animate( {opacity:0}, null, null, function() {
jQuery(this).hide();
});
window.location.reload()
return false;
}
// Attach overlay to the body.
jQuery('body').append('<div class="bgCover"> </div><div class="overlayBox"><div class="overlayContent"><div class="controls"><a class="overlay-close" href="#">Close</a></div><iframe src="" width="100%" height="600"></iframe></div></div>');
// Style the overlay
jQuery('.overlayBox').css({
'border': '5px solid #09F',
'position': 'absolute',
'display': 'none',
'width': '1000px',
'height': '620px',
'background': '#fff',
'z-index': 40,
});
jQuery('.bgCover').css({
'background': '#000',
'position': 'absolute',
'left': '0',
'top': '0',
'display': 'none',
'overflow': 'hidden',
'z-index' : 40,
});
// Make close link actually close.
jQuery('a.overlay-close').click(doOverlayClose);
// Add show link to each page.
jQuery('#tracker table tbody tr').each(function() {
var issueRow = jQuery(this);
var issueLink = issueRow.find('td:eq(1) a');
// Add the show issue link
issueLink.before('<a class="load-issue" href="#">Show Issue</a> - ');
// add click event to our show link.
issueLink.parent().find('a.load-issue').click(function() {
// Get the url
var url = jQuery(this).next('a').attr('href');
// If there is a new comment in the issue use that link since it will take us
// straight to the new comment.
if (issueRow.find('td:eq(3) a').length) {
url = issueRow.find('td:eq(3) a').attr('href');
}
// Set the iframe src to our url.
jQuery('.overlayContent iframe').attr('src', url);
// Open the overlay.
doOverlayOpen();
return false;
});
});
Comment | File | Size | Author |
---|---|---|---|
#2 | overlay-link.png | 34.2 KB | redndahead |
Comments
Comment #1
redndahead CreditAttribution: redndahead commentedHere is an updated version that fixes an issue where the top of the overlay wasn't visible if firebug was opened. It also now links the type column. So if it was "Book Page" it is now a link that opens the overlay saying "Show Book Page".
Comment #2
redndahead CreditAttribution: redndahead commentedHere is an image of the link
Comment #3
redndahead CreditAttribution: redndahead commentedThis one opens up the overlay so it takes up most of the window. Good for larger screens.
Comment #4
redndahead CreditAttribution: redndahead commentedThanks to tim plunkett for testing. This version copies code from dreditor so it works in chrome and firefox. It also let's the user hit escape to close the overlay.
Comment #5
redndahead CreditAttribution: redndahead commentedIt is now currently on github.
Project
http://github.com/redndahead/Enhance-Tracker
Here is a direct link to install it.
https://github.com/redndahead/Enhance-Tracker/raw/master/enhanceTracker....