WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#6998 closed enhancement (fixed)

Press This: Make UI look more like admin area and fix relative URIs

Reported by: noel Owned by: ryan
Milestone: 2.6 Priority: high
Severity: normal Version:
Component: Template Keywords:
Focuses: Cc:

Description

The Press This bookmarklet needed some formatting to get it looking more wordpress like. This is the first of many diffs coming.

I also modified the function used to get images from a uri so it would not mess up images with relative URIs.

Attachments (5)

press-this.diff (33.3 KB) - added by noel 6 years ago.
Press This enhancement diff.
press-this-parse_url.patch (531 bytes) - added by azaozz 6 years ago.
press-this-5-21-08-5pm.diff (20.1 KB) - added by noel 6 years ago.
moves stylesheet inline and attempts to fix tag area behavior.
press-this-menu-colors.patch (7.7 KB) - added by azaozz 6 years ago.
6998-css.diff (1.6 KB) - added by mdawaffe 6 years ago.
more specific selectors

Download all attachments as: .zip

Change History (23)

noel6 years ago

Press This enhancement diff.

comment:1 DD326 years ago

I also modified the function used to get images from a uri so it would not mess up images with relative URIs.

Heres some code i currently use to determine the real URL of a relative url'd image, Not sure if it'll be of any use though.

function im_url_join($one, $two){
	//defaults:
	$port = "80";
	$scheme = $host = $path = '';
	$url = parse_url($one);
	extract($url);
	if( ! empty($query) )
		$query = "?$query";
	
	$port = ($port != 80) ? ':' . $port : '';
	
	if( substr($path, -1) != '/') //If path is to a file, direct back to a folder.
		$path = trailingslashit(rtrim(dirname($path),'\\'));
	
	if( strpos($two, '://') > -1 ) // http:// .../...jpg
		return $two;
	
	if( $two[0] == '/' ) //   /file.jpg
		return "{$scheme}://{$host}{$port}{$two}";
	
	if( substr($two,0, 3) == '../' ){
		$path = trailingslashit(rtrim(dirname($path),'\\'));
		$two = substr($two, 3);
		return im_url_join("{$scheme}://{$host}{$port}{$path}{$query}", $two);
	}
	return "{$scheme}://{$host}{$port}{$path}{$two}"; // simply file.jpg
}

Example:

$one = 'http://google.com/pagename/';
$two = '../images/image.jpg';
$return = 'http://google.com/images/image.jpg

comment:2 ryan6 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [7957]) Press This styling updates from noel. fixes #6998

comment:3 azaozz6 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Just a small correction: the parse_url "component" parameter is only php 5.1.2+, so the "Photo" tab fails on servers running php 4.

comment:4 ryan6 years ago

(In [7966]) Don't use php 5 only component parameter to parse_url. Props azaozz. see #6998

comment:5 ryan6 years ago

After the removal of all the TB CSS from the press-this css as part of another ticket, the "Visit:" link is floating high (in Mac FF2).

comment:6 follow-up: ryan6 years ago

Tag addition isn't working properly. There's no suggest and clicking Add does a page load.

noel6 years ago

moves stylesheet inline and attempts to fix tag area behavior.

comment:7 in reply to: ↑ 6 noel6 years ago

Replying to ryan:

Tag addition isn't working properly. There's no suggest and clicking Add does a page load.

Tag addition *still* doesn't work in Firefox if you switch tabs.

comment:8 noel6 years ago

When I said it doesn't work in Firefox, I meant to say "it doesn't work in Safari." :)

comment:9 follow-up: ryan6 years ago

Do styles needs to be inline? We lose caching of them, especially now that we have the gears cache.

comment:10 ryan6 years ago

(In [7983]) Press This fixes from noel. see #6998

comment:11 in reply to: ↑ 9 ; follow-up: noel6 years ago

Replying to ryan:

Do styles needs to be inline? We lose caching of them, especially now that we have the gears cache.

I think, regardless, that will speed things up - not everyone is utilizing gears either. No?

comment:12 in reply to: ↑ 11 azaozz6 years ago

Replying to noel:

Replying to ryan:

Do styles needs to be inline? We lose caching of them, especially now that we have the gears cache.

I think, regardless, that will speed things up - not everyone is utilizing gears either. No?

Without Gears the css files would already be cached in the browser, so it's faster. Also currently the menu colours aren't right when using colors-classic.

comment:13 azaozz6 years ago

The patch fixes the menu colours so they follow the colour theme selected.

The ajax loading of the tabs doesn't play well with TinyMCE and the tag suggest field. Each time a tab is switched, another instance of TinyMCE is initialized without removing the old one. The tag suggest doesn't seem to initialize at all.

Tested replacing the whole page instead of loading most of it with ajax. Seems to be at least as fast as now and a bit faster with Gears enabled. Perhaps we could do that.

Another option would be to load with ajax only the parts that are different between the four tabs. In TinyMCE we can add, append, replace, remove content easily. This way we won't have to reload and re-initialize TinyMCE, the tag suggest script and the categories list.

comment:14 ryan6 years ago

(In [7993]) Press This: Obey color scheme. Props azaozz. see #6998

comment:15 ryan6 years ago

Either way sounds good to me. Whatever is cleanest or easiest assuming speed is comparable.

comment:16 mdawaffe6 years ago

6998-css.diff

Make some of the color CSS selectors more specific so that the category tabs on the Write page don't get messed up.

mdawaffe6 years ago

more specific selectors

comment:17 ryan6 years ago

(In [8013]) Make some of the color CSS selectors more specific so that the category tabs on the Write page don't get messed up. Props mdawaffe. see #6998

comment:18 ryan6 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.