Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing the sidebar #45

Closed
GitterHubber opened this issue Mar 3, 2016 · 4 comments
Closed

Removing the sidebar #45

GitterHubber opened this issue Mar 3, 2016 · 4 comments

Comments

@GitterHubber
Copy link

Hi Again!

Is there any config / setting in XOWA that can hide / remove the sidebar in Wikipedia from rendering in XOWA.
If there isn't?, how complex would it be to implement this functionality. I know you are absolutely busy at this point of time and that you are currently focusing on the mobile version.
But if you can point out to the relevant sections of the codebase that we can look into to achieve this objective it would indeed be very nice.

Thanks in advance.

@gnosygnu
Copy link
Owner

gnosygnu commented Mar 4, 2016

Is there any config / setting in XOWA that can hide / remove the sidebar in Wikipedia from rendering in XOWA.

There isn't any setting now, but XOWA externalizes as many configurations as possible in its config files. The process is a bit complicated, but you should have full control.

In this case, you can edit the format in C:\xowa\bin\any\xowa\cfg\app\xowa.gfs . Note the following:

  • The file format is a homemade one specific to XOWA. I will change this to use Javascript / Mustache later, but for now, please bear with it.
  • This file is replaced with every release. If you make changes to it, you will need to update it after every release. You can also try to save your changes as an option under home/wiki/Help:Options/Config_script. If you're interested, let me know and I'll detail more.
  • You should make a backup of this file before you edit it so you can revert
  • The file is UTF-8 and UNIX style end-of-line characters. I'd recommend editing in Notepad++ or any other text-editor (just don't use Notepad)

With these disclaimers out of the way, please try the following:

  • Open up C:\xowa\bin\any\xowa\cfg\app\xowa.gfs
  • Search for page_read. Note that the next section is an HTML template
  • Search for the next occurence of <div id='mw-panel' class='noprint'>
  • Change this to something like <div id='mw-panel' class='noprint' style='display:none'>
  • Restart XOWA

You'll probably also want to tinker with the CSS files. Each wiki saves its css in C:\xowa\user\anonymous\wiki. For example, English Wikipedia is in C:\xowa\user\anonymous\wiki\en.wikipedia.org\html\en.wikipedia.org\html

Finally, you can always do the following to review changes

  • Open up a page
  • Click on "View HTML"
  • Copy and Paste the HTML to your text-editor
  • Save it as "C:\test.html"
  • Open it up in Firefox. The page should look exactly the same as it does in XOWA
  • Tinker with the look and feel, and make the changes to either xowa.gfs or the CSS

Hope this helps. Thanks.

@GitterHubber
Copy link
Author

Thanks for the detailed reply.

The <div id='mw-panel' class='noprint' style='display:none'>part worked well and the sidebar was removed however the content was still at its original position and there was a empty space on the left.

Apart from this I had to change the xowa_common.css, did a find for the following tags

#left-navigation
#mw-head-base
div#content
div#footer

and changed the left margin of each to 1em (it was 10 or 11em earlier)
margin-left: 1em;

and that scaled the content to fill into the empty space of the sidebar.

You can also try to save your changes as an option under home/wiki/Help:Options/Config_script. If you're interested, let me know and I'll detail more.

Would certainly be interested to know this.
Many thanks again.

@gnosygnu
Copy link
Owner

gnosygnu commented Mar 5, 2016

Apart from this I had to change the xowa_common.css, did a find for the following tags

Cool. Thanks for documenting this.

You can also try to save your changes as an option under home/wiki/Help:Options/Config_script. If you're interested, let me know and I'll detail more.

Would certainly be interested to know this.

Sure, here are the steps:

  • Go to home/wiki/Help:Options/Config_script
  • Enter in text from the page_read section. See my example below. Note that this looks just like the xowa.gfs, except:
    • the wiki is specified as "en.wikipedia.org": app.wikis.get('en.wikipedia.org).html.article {
    • there is a closing } at the end
  • Click Save
  • Restart XOWA and go to any page in en.wikipedia.org

Basically, any "command" in xowa.gfs can be entered into the text box. Keep in mind that this feature is not guaranteed to be backward-compatible and will break someday in the future when I migrate gfs to javascript / mustache. This will probably not happen for at least several months, but it's something to be aware of.

Hope this helps.

app.wikis.get('en.wikipedia.org).html.article {
  page_read =
<:["
<!DOCTYPE html>
<html dir="~{page_lang_ltr}" class="client-js">
<head>
  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  <title>~{page_name} - XOWA</title>
  <link rel="shortcut icon" href="~{app_root_dir}bin/any/xowa/file/app.window/app_icon.png" />
  <link rel="stylesheet" href="~{html_css_common_path}" type="text/css">
  <link rel="stylesheet" href="~{html_css_wiki_path}" type="text/css">~{xowa_head}
  <link rel="stylesheet" href="~{app_root_dir}bin/any/xowa/html/res/src/xowa/find/xowa_find_html.css" type="text/css">
  <script src="~{app_root_dir}bin/any/xowa/html/res/src/xowa/find/xowa_find_html.js" type='text/javascript'></script>
  <style type="text/css">
    div#simpleSearch #searchButton,    
    div#simpleSearch #mw-searchButton {
      ~{<>lang.x_axis_end;<>}: 0;
      direction: ~{<>lang.dir_str;<>};
      z-index:initial;  /* reset z-index, else will show in front of popup; DATE:2015-07-31 */
    }    
    .new {!important; color:green;}
  </style>
</head>
<body class="mediawiki ~{page_lang_ltr} sitedir-~{page_lang_ltr} ~{page_body_cls} skin-vector action-submit vector-animateLayout"~{html_content_editable} spellcheck="false">
<div id="mw-page-base" class="noprint"></div>
<div id="mw-head-base" class="noprint"></div>
<div id="content" class="mw-body">~{page_indicators}~{page_pgbnr}
  <div id='xowa_err_div' class='xowa_err' style='display:none; color:red; white-space:pre; display:block; unicode-bidi:embed;'></div>~{page_heading}  
  <div id="bodyContent" class="mw-body-content">
    <div id="siteSub">From XOWA: the free, open-source, offline wiki application</div>
    <div id="contentSub" class="visible">~{page_content_sub}</div>~{page_jumpto}
    <div id="mw-content-text" lang="en" dir="~{page_lang_ltr}" class="mw-content-~{page_lang_ltr}">~{page_data}
      <div class="visualClear">
~{page_langs}<br/><br/>
        ~{page_modified_on_msg}
        <div style='float:right'>
          <ul style='-moz-column-count: 2; list-style:none;font-size:xx-small;'>
            <li>~{<>app.user.msgs.get('xowa-portal-version');<>}</li>
            <li>~{<>app.user.msgs.get('xowa-portal-build_time');<>}</li>
            <li>~{app_version}</li>
            <li>~{app_build_date}</li>
          </ul>
        </div>
        <br/>
      </div>
    </div>
  </div>
</div>

<div id="mw-head" class="noprint">
~{portal_div_personal}
~{portal_div_ns}
~{portal_div_view}
</div>

<div id='mw-panel' class='noprint' style='display:none'>
~{portal_div_logo}
~{portal_div_home}
~{portal_sidebar}
~{portal_div_xtn}
~{portal_div_wikis}
</div>
</body>
</html>
<!-- page_id=~{page_id} -->
"]:>
;
}

@gnosygnu
Copy link
Owner

I'm going to mark this issue closed, as there are workarounds to remove the sidebar. Feel free to reopen if there are any further questions. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants