/* * [BestBrowsers.java] * * Summary: Generates a list of recommended browsers with links to where to get them. * * Copyright: (c) 2009-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.8 2009-02-06 include go package in ZIP bundle. */ package com.mindprod.htmlmacros.macro; import com.mindprod.fastcat.FastCat; import com.mindprod.htmlmacros.support.BuildImage; import com.mindprod.htmlmacros.support.ImageAlignment; import com.mindprod.htmlmacros.support.Tools; import static com.mindprod.htmlmacros.macro.Global.configuration; import static com.mindprod.htmlmacros.support.JDKandJREVersions.JRE_RECOMMENDED_VERSION; import static java.lang.System.*; /** * Generates a list of recommended browsers with links to where to get them. *

* * @author Roedy Green, Canadian Mind Products * @version 1.8 2009-02-06 include go package in ZIP bundle. * @noinspection WeakerAccess * @since 2009 */ public final class BestBrowsers extends Macro { /** * suffix for a tag */ private static final String TAG_TAIL = configuration.getTagTail(); /** * how to use the macro */ private static final String USAGE = "\nBestBrowsers macro needs context, [trouble]"; /** * expandNoRef Best Browser macro guts. * * @param what what browser is for, e.g. "Applet" "your website" * "pages". * @param trouble additional message. * * @return expanded best browser macro. */ private String expand( String what, String trouble ) { String message; if ( what.equals( "" ) ) { message = ""; } else if ( what.equals( "recommended" ) ) { message = "Please select one of these modern browsers to download and install free."; } else if ( what.equals( "your website" ) ) { message = "Please check that your own website works with all of these up-to-date-browsers:"; } else if ( what.equals( "pages" ) ) { message = "These pages require one of the following up-to-date browsers:"; } else { message = "This " + what + " requires one of the following up-to-date browsers:"; } final FastCat sb = new FastCat( 39 ); sb.append( "\n" ); sb.append( "" ); sb.append( "\n" ); sb.append( "\n" ); sb.append( "
best browsers
" ); sb.append( message ); if ( trouble.length() > 0 ) { sb.append( " " ); sb.append( trouble ); } sb.append( "
" ); sb.append( "Click the corresponding browser icon to download the latest free browser software, " + "or click the browser name for more information." ); // FIREFOX sb.append( standardBrowser( "Firefox", "60.0.1", "No longer suppoorts Java Applets. Most widely supported next to IE. Many add-ins. Very fast rendering.\n" + " Weak on table rendering. Best for printing. Fairly slow to start up.\n" + "Often stalls on first page from a new site. Must hit reload. 9% market share.\n" + "Firefox properly balances two-column layouts. None of the other browsers do.\n" + "Firefox displays SSL certificates.", "jgloss/firefox.html", "corplogo/firefox.png", "https://www.mozilla.org/en-US/firefox/new/" ) ); // CHROME sb.append( standardBrowser( "Google Chrome", "53.0.2785.92", "Dropped support for Java Applets. Good for YouTube. Frequently automatically updated. Has no edit source button. Slow starting when it " + "fiddles with a proxy. Poor downloading — it hides the fact it is doing so in the bottom " + "left corner. Often downloads without you asking. Handles foreign language sites " + "particularly well since it integrates with Google Translate by automatically translating. Best for interacting with Google. " + "BrowserMark rates this as the fastest " + "browser. Good for ecommerce. " + "Can’t print white writing on a black background. 53% market share.", "jgloss/googlechrome.html", "corplogo/googlechrome.png", "https://www.google.com/chrome/" ) ); // IE 11 sb.append( standardBrowser( "IE11", "11.0.9600.17501", "Now works with Java Applets. " + "Some websites will work with no other browser, though many work on everything but this eccentric browser. 10% market share.", "jgloss/ie.html", "corplogo/ie11.png", "https://support.microsoft.com/en-ca/help/17621/internet-explorer-downloads" ) ); // SeaMonkey sb.append( standardBrowser( "SeaMonkey", "2.49.2", "Similar to Firefox, with integrated Email. No longer supports Java Applets.", "jgloss/seamonkey.html", "corplogo/seamonkey64.png", "http://www.seamonkey-project.org/" ) ); // SAFARI sb.append( standardBrowser( "Safari", "5.1.7", "For both Macs and PCs. No longer supports Java. Apple has dropped support for the PC version. Freezes. Simple and stripped down. 12% market share.", "jgloss/safari.html", "corplogo/safaribrowser.png", "http://www.apple.com/safari/" ) ); // AVANT sb.append( standardBrowser( "Avant", "2018:1", "It is a fast browser, especially at starting up. Has problems with JavaScript. Excellent at " + "rendering and printing tables. It uses the Firefox or Chrome rendering engine. In theory it should handle Java, but I can’t get it to work.", "jgloss/avant.html", "corplogo/avant.jpg", "http://www.avantbrowser.com/" ) ); // OPERA sb.append( standardBrowser( "Opera", "48.0.2685.52", "It no longer its own rendering engine, which was its main advantage. It uses Chrome. It no longer supports Java Applets." + "No longer lets you configure your own editor. No bookmarks. Implements SPDY for faster communication. In Turbo mode, caches pages in encrypted compressed form. 6% market share.", "jgloss/opera.html", "icon64/operao.png", "http://www.opera.com/computer" ) ); // EDGE sb.append( standardBrowser( "Edge", "25.10586.0.0", "Stripped down browser without features. " + "It does not support Java or any other plug-in.", "jgloss/edge.html", "corplogo/edge.png", "https://www.microsoft.com/en-ca/windows/microsoft-edge" ) ); // JAVA sb.append( "
" ); sb.append( Tools.completeLink( "jgloss/installingjava.html", BuildImage.buildImgTag( "corplogo/javaget100x43.png", "Get Java", ImageAlignment.none, "plain", fileBeingDistributed ), "plain", fileBeingDistributed ) ); sb.append( "" ); sb.append( Tools.completeLink( "jgloss/installingjava.html", "Oracle’s Java", "plain", fileBeingDistributed ) ); sb.append( "" ); sb.append( JRE_RECOMMENDED_VERSION ); sb.append( "" ); final Acronym acronym = new Acronym(); acronym.setFileBeingProcessedAndFileBeingDistributed( fileBeingProcessed, fileBeingDistributed ); sb.append( acronym.expandNoRef( "JRE" ) ); sb.append( "
\n" ); return sb.toString(); } /** * Generate code for standard browser * * @param browser name of the browser * @param browserVersion version of the browser * @param desc description of the browser * @param linkTo webroot relative page to link to to describe browser * @param icon webroot relative png icon file. * @param downloadURL URL to download the executable, icon links to it. * * @return HTML to describe this browser. */ private String standardBrowser( String browser, String browserVersion, String desc, String linkTo, String icon, String downloadURL ) { final FastCat sb = new FastCat( 16 ); sb.append( "" ); sb.append( "" ); sb.append( BuildImage.buildImgTag( icon, browser, ImageAlignment.none, "plain", fileBeingDistributed ) ); sb.append( "" ); sb.append( Tools.completeLink( linkTo, browser, "plain", fileBeingDistributed ) ); sb.append( "" ); sb.append( browserVersion ); sb.append( "with the Java " ); sb.append( JRE_RECOMMENDED_VERSION ); sb.append( " " ); final Acronym acronym = new Acronym(); acronym.setFileBeingProcessedAndFileBeingDistributed( fileBeingProcessed, fileBeingDistributed ); sb.append( acronym.expandNoRef( "JRE" ) ); sb.append( ".\n" ); sb.append( desc ); sb.append( "\n" ); return sb.toString(); } /** * Generates a table of recommended Browsers. invoked with: * * @param parms first parm is what we are going to use the browser for. e.g. Applet, glossary, pages, * "your website"
second optional parm is a trouble message. e.g. "Does not work with * Opera." * @param quiet true if want output suppressed. * @param verbose @return expanded macro HTML */ public final String expandMacro( String[] parms, final boolean quiet, final boolean verbose ) { if ( !quiet ) { out.print( "B" ); } if ( !( 1 <= parms.length && parms.length <= 2 ) ) { throw new IllegalArgumentException( USAGE ); } String what = "Applet"; String trouble = ""; if ( parms.length > 0 ) { what = parms[ 0 ]; } if ( parms.length > 1 ) { trouble = parms[ 1 ]; } return expand( what, trouble ); } }