Avatar

About opening of links in new tabs or browser windows (Features)

by Micha ⌂, Monday, October 26, 2020, 09:31 (1240 days ago) @ Auge

Hello,

One further question about the issue of readable code. The main.min.js has only half the size of the main.js (25 versus 50 kB)....

We can omit to compress the sources for CSS and JS files. I believe, 50 kb is not a traffic problem (today) and these files are (usually) cached by the browser.

Isn't it time to tidy up the code from compatibility … errr … legacy code for long dead browsers so we could minify the JS-code without minifying it?

Most of the file size comes from comments and not from the code itself. To reduce the size, it is more reasonable to remove such comments than to look for some dead codes. Moreover, I'm not up-to-date which browser supports a function and which one not. For some functions, e.g.,

/**
 * Liefert eine Liste mit Elementen, die die
 * selbe CSS-Klasse haben
 *
 * @param class_name
 * @return node_list
 */
if(typeof document.getElementsByClassName != 'function') {  
 document.getElementsByClassName = function (class_name) {
 var all_obj,ret_obj=new Array(),j=0,teststr;
 if(this.all)
  all_obj=this.all;
 else if(this.getElementsByTagName && !this.all)
  all_obj=this.getElementsByTagName("*");
 var len=all_obj.length;
 for(var i=0;i<len;i++) {
  if(all_obj[i].className.indexOf(class_name)!=-1) {
   teststr=","+all_obj[i].className.split(" ").join(",")+",";
   if(teststr.indexOf(","+class_name+",")!=-1) {
    ret_obj[j]=all_obj[i];
    j++;
   }
  } 
 }
 return ret_obj;
 };
}


I can check the availability of these functions, cf. getElementsByClassName. For this example: all modern browsers support this function and the code can reduced. Which version is your preferred version that we should support?

I will open a dedicated PR for the HTML code adaption today.

Perfect.

Do you also create a PR for the user_settings and the corresponding changes in PHP/MySQL?

regards
Micha

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences


Complete thread:

 RSS Feed of thread