You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by rl...@apache.org on 2018/08/27 17:35:28 UTC

svn commit: r1839354 - /comdev/project-logos/site/js/logofinder.js

Author: rlenferink
Date: Mon Aug 27 17:35:28 2018
New Revision: 1839354

URL: http://svn.apache.org/viewvc?rev=1839354&view=rev
Log:
Resolved problem of showing wrong image icons for originals when the project name contains the extension (e.g. 'ai' in 'Pony Mail')

Modified:
    comdev/project-logos/site/js/logofinder.js

Modified: comdev/project-logos/site/js/logofinder.js
URL: http://svn.apache.org/viewvc/comdev/project-logos/site/js/logofinder.js?rev=1839354&r1=1839353&r2=1839354&view=diff
==============================================================================
--- comdev/project-logos/site/js/logofinder.js (original)
+++ comdev/project-logos/site/js/logofinder.js Mon Aug 27 17:35:28 2018
@@ -111,8 +111,9 @@ function make_div(key, project) {
         // original:
         let img =imgs[0];
         img.opath = img.opath || 'undef.svg';
-        let ma = img.opath.match(/(eps|svg|ai|pdf)/);
-        let oext = ma ? ma[1] : 'svg';
+        let allowedExtensions = ['eps', 'svg', 'ai', 'pdf'];
+        let imgExt = img.opath.split('.').pop();
+        let oext = allowedExtensions.includes(imgExt) ? imgExt : 'svg';
         let arr = [
                 new HTML('img', {src:'images/%s.png'.format(oext), style: {maxWidth: '24px', maxHeight: '24px'}}),
                 new HTML('br'),



Re: svn commit: r1839354 - /comdev/project-logos/site/js/logofinder.js

Posted by Roy Lenferink <rl...@apache.org>.

On 2018/08/27 18:29:57, Daniel Gruno <hu...@apache.org> wrote: 
> On 08/27/2018 08:28 PM, Roy Lenferink wrote:
> > 
> > 
> > On 2018/08/27 17:37:56, Daniel Gruno <hu...@apache.org> wrote:
> >> On 08/27/2018 07:35 PM, rlenferink@apache.org wrote:
> >>> Author: rlenferink
> >>> Date: Mon Aug 27 17:35:28 2018
> >>> New Revision: 1839354
> >>>
> >>> URL: http://svn.apache.org/viewvc?rev=1839354&view=rev
> >>> Log:
> >>> Resolved problem of showing wrong image icons for originals when the project name contains the extension (e.g. 'ai' in 'Pony Mail')
> >>
> >> Nice catch!
> >> I'm always nervous about using too "new" ecma standards ;-) but what the
> >> heck, I was using 'let' anyway!
> >>
> >> With regards,
> >> Daniel
> >>
> > 
> > Thanks, I checked [1] and Array#includes has more or less been around for 20 versions on Firefox/Chrome/Opera & Edge and because of the 'let' I thought, why not use it ;)
> > 
> > Side question:
> > Does the site update itself / does it pull in the latest changes from svn every hour? Or is that still an action you need to do manually?
> 
> It updates every hour and pulls in changes. I sometimes pull the stuff 
> manually when I update things.

Aha, thanks for answering, I was thinking it didn't update after committing, but I just noticed it has been propagated to the live version. Perfect ;)

Roy

> 
> > 
> > Regards,
> > Roy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@community.apache.org
> For additional commands, e-mail: dev-help@community.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@community.apache.org
For additional commands, e-mail: dev-help@community.apache.org


Re: svn commit: r1839354 - /comdev/project-logos/site/js/logofinder.js

Posted by Daniel Gruno <hu...@apache.org>.
On 08/27/2018 08:28 PM, Roy Lenferink wrote:
> 
> 
> On 2018/08/27 17:37:56, Daniel Gruno <hu...@apache.org> wrote:
>> On 08/27/2018 07:35 PM, rlenferink@apache.org wrote:
>>> Author: rlenferink
>>> Date: Mon Aug 27 17:35:28 2018
>>> New Revision: 1839354
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1839354&view=rev
>>> Log:
>>> Resolved problem of showing wrong image icons for originals when the project name contains the extension (e.g. 'ai' in 'Pony Mail')
>>
>> Nice catch!
>> I'm always nervous about using too "new" ecma standards ;-) but what the
>> heck, I was using 'let' anyway!
>>
>> With regards,
>> Daniel
>>
> 
> Thanks, I checked [1] and Array#includes has more or less been around for 20 versions on Firefox/Chrome/Opera & Edge and because of the 'let' I thought, why not use it ;)
> 
> Side question:
> Does the site update itself / does it pull in the latest changes from svn every hour? Or is that still an action you need to do manually?

It updates every hour and pulls in changes. I sometimes pull the stuff 
manually when I update things.

> 
> Regards,
> Roy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@community.apache.org
For additional commands, e-mail: dev-help@community.apache.org


Re: svn commit: r1839354 - /comdev/project-logos/site/js/logofinder.js

Posted by Roy Lenferink <rl...@apache.org>.

On 2018/08/27 17:37:56, Daniel Gruno <hu...@apache.org> wrote: 
> On 08/27/2018 07:35 PM, rlenferink@apache.org wrote:
> > Author: rlenferink
> > Date: Mon Aug 27 17:35:28 2018
> > New Revision: 1839354
> > 
> > URL: http://svn.apache.org/viewvc?rev=1839354&view=rev
> > Log:
> > Resolved problem of showing wrong image icons for originals when the project name contains the extension (e.g. 'ai' in 'Pony Mail')
> 
> Nice catch!
> I'm always nervous about using too "new" ecma standards ;-) but what the 
> heck, I was using 'let' anyway!
> 
> With regards,
> Daniel
> 

Thanks, I checked [1] and Array#includes has more or less been around for 20 versions on Firefox/Chrome/Opera & Edge and because of the 'let' I thought, why not use it ;)

Side question:
Does the site update itself / does it pull in the latest changes from svn every hour? Or is that still an action you need to do manually?

Regards,
Roy

[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes#Browser_compatibility

> > 
> > Modified:
> >      comdev/project-logos/site/js/logofinder.js
> > 
> > Modified: comdev/project-logos/site/js/logofinder.js
> > URL: http://svn.apache.org/viewvc/comdev/project-logos/site/js/logofinder.js?rev=1839354&r1=1839353&r2=1839354&view=diff
> > ==============================================================================
> > --- comdev/project-logos/site/js/logofinder.js (original)
> > +++ comdev/project-logos/site/js/logofinder.js Mon Aug 27 17:35:28 2018
> > @@ -111,8 +111,9 @@ function make_div(key, project) {
> >           // original:
> >           let img =imgs[0];
> >           img.opath = img.opath || 'undef.svg';
> > -        let ma = img.opath.match(/(eps|svg|ai|pdf)/);
> > -        let oext = ma ? ma[1] : 'svg';
> > +        let allowedExtensions = ['eps', 'svg', 'ai', 'pdf'];
> > +        let imgExt = img.opath.split('.').pop();
> > +        let oext = allowedExtensions.includes(imgExt) ? imgExt : 'svg';
> >           let arr = [
> >                   new HTML('img', {src:'images/%s.png'.format(oext), style: {maxWidth: '24px', maxHeight: '24px'}}),
> >                   new HTML('br'),
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@community.apache.org
> For additional commands, e-mail: dev-help@community.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@community.apache.org
For additional commands, e-mail: dev-help@community.apache.org


Re: svn commit: r1839354 - /comdev/project-logos/site/js/logofinder.js

Posted by Daniel Gruno <hu...@apache.org>.
On 08/27/2018 07:35 PM, rlenferink@apache.org wrote:
> Author: rlenferink
> Date: Mon Aug 27 17:35:28 2018
> New Revision: 1839354
> 
> URL: http://svn.apache.org/viewvc?rev=1839354&view=rev
> Log:
> Resolved problem of showing wrong image icons for originals when the project name contains the extension (e.g. 'ai' in 'Pony Mail')

Nice catch!
I'm always nervous about using too "new" ecma standards ;-) but what the 
heck, I was using 'let' anyway!

With regards,
Daniel

> 
> Modified:
>      comdev/project-logos/site/js/logofinder.js
> 
> Modified: comdev/project-logos/site/js/logofinder.js
> URL: http://svn.apache.org/viewvc/comdev/project-logos/site/js/logofinder.js?rev=1839354&r1=1839353&r2=1839354&view=diff
> ==============================================================================
> --- comdev/project-logos/site/js/logofinder.js (original)
> +++ comdev/project-logos/site/js/logofinder.js Mon Aug 27 17:35:28 2018
> @@ -111,8 +111,9 @@ function make_div(key, project) {
>           // original:
>           let img =imgs[0];
>           img.opath = img.opath || 'undef.svg';
> -        let ma = img.opath.match(/(eps|svg|ai|pdf)/);
> -        let oext = ma ? ma[1] : 'svg';
> +        let allowedExtensions = ['eps', 'svg', 'ai', 'pdf'];
> +        let imgExt = img.opath.split('.').pop();
> +        let oext = allowedExtensions.includes(imgExt) ? imgExt : 'svg';
>           let arr = [
>                   new HTML('img', {src:'images/%s.png'.format(oext), style: {maxWidth: '24px', maxHeight: '24px'}}),
>                   new HTML('br'),
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@community.apache.org
For additional commands, e-mail: dev-help@community.apache.org