예제 #1
0
def producehtml(name, debug):
    ui = pages.UIs[name]
    js = jslist(name, debug)
    css = csslist(name, debug, gen=True)
    csshtml = "\n".join(
        "  <link rel=\"stylesheet\" href=\"%s%s\" type=\"text/css\"/>" %
        (config.STATIC_BASE_URL, x) for x in css)

    def toscript((url, digest)):
        if digest:
            subresource_int = " integrity=\"%s\" crossorigin=\"anonymous\"" % digest
        else:
            subresource_int = ""
        return "  <script type=\"text/javascript\" src=\"%s%s\"%s></script>" % (
            "" if url.startswith("//") else config.STATIC_BASE_URL, url,
            subresource_int)

    jshtml = "\n".join(toscript(x) for x in js)

    if hasattr(config, "ANALYTICS_HTML"):
        jshtml += "\n" + config.ANALYTICS_HTML

    div = ui.get("div", "")
    customjs = ui.get("customjs", "")

    return """%s
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <base />
  <title>%s (qwebirc)</title>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
  <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
  <meta name="mobile-web-app-capable" content="yes" />
  <link rel="icon" sizes="192x192" href="%simages/highresicon.png"/>
  <link rel="shortcut icon" type="image/png" href="%simages/favicon.png"/>
%s<script type="text/javascript">QWEBIRC_DEBUG=%s;</script>%s
%s
  <script type="text/javascript">
    var ui = new qwebirc.ui.Interface("ircui", qwebirc.ui.%s, %s);
  </script>
</head>
<body>
  <div id="ircui">
    <noscript>
      <div id="noscript">Javascript is required to use IRC.</div>
    </noscript>%s
  </div>
</body>
</html>
""" % (ui["doctype"], config.APP_TITLE, config.STATIC_BASE_URL,
       config.STATIC_BASE_URL, csshtml, debug and "true" or "false", customjs,
       jshtml, ui["class"], optionsgen.get_options(), div)
예제 #2
0
def producehtml(name, debug):
    ui = pages.UIs[name]
    js = jslist(name, debug)
    css = csslist(name, debug, gen=True)
    csshtml = "\n".join(
        "  <link rel=\"stylesheet\" href=\"%s%s\" type=\"text/css\"/>" %
        (config.STATIC_BASE_URL, x) for x in css)
    jshtml = "\n".join(
        "  <script type=\"text/javascript\" src=\"%s%s\"></script>" %
        (config.STATIC_BASE_URL, x) for x in js)

    if hasattr(config, "ANALYTICS_HTML"):
        jshtml += "\n" + config.ANALYTICS_HTML

    div = ui.get("div", "")
    customjs = ui.get("customjs", "")

    return """%s
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <base />
  <title>%s (qwebirc)</title>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
  <link rel="shortcut icon" type="image/png" href="%simages/favicon.png"/>
%s%s
%s
  <script type="text/javascript">
    var ui = new qwebirc.ui.Interface("ircui", qwebirc.ui.%s, %s);
  </script>
</head>
<body>
  <div id="ircui">
    <noscript>
      <div id="noscript">Javascript is required to use IRC.</div>
    </noscript>%s
  </div>
</body>
</html>
""" % (ui["doctype"], config.APP_TITLE, config.STATIC_BASE_URL, csshtml,
       customjs, jshtml, ui["class"], optionsgen.get_options(), div)
예제 #3
0
파일: pagegen.py 프로젝트: akavlie/qwebirc
def producehtml(name, debug):
  ui = pages.UIs[name]
  js = jslist(name, debug)
  css = csslist(name, debug, gen=True)
  csshtml = "\n".join("  <link rel=\"stylesheet\" href=\"%s%s\" type=\"text/css\"/>" % (config.STATIC_BASE_URL, x) for x in css)
  jshtml = "\n".join("  <script type=\"text/javascript\" src=\"%s%s\"></script>" % (config.STATIC_BASE_URL, x) for x in js)

  div = ui.get("div", "")
  customjs = ui.get("customjs", "")

  return """%s
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <base />
  <title>%s (qwebirc)</title>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
  <link rel="shortcut icon" type="image/png" href="%simages/favicon.png"/>
%s%s
%s
  <script type="text/javascript">
    var ui = new qwebirc.ui.Interface("ircui", qwebirc.ui.%s, %s);
  </script>
</head>
<body>
  <div id="ircui">
    <noscript>
      <div id="noscript">Javascript is required to use IRC.</div>
    </noscript>%s
  </div>
</body>
</html>
""" % (ui["doctype"], config.APP_TITLE, config.STATIC_BASE_URL, csshtml, customjs, jshtml, ui["class"], optionsgen.get_options(), div)
예제 #4
0
def producehtml(name, debug):
  ui = pages.UIs[name]
  js = jslist(name, debug)
  css = csslist(name, debug, gen=True)
  csshtml = "\n".join("  <link rel=\"stylesheet\" href=\"%s%s\" type=\"text/css\"/>" % (config.STATIC_BASE_URL, x) for x in css)
  jshtml = "\n".join("  <script type=\"text/javascript\" src=\"%s%s\"></script>" % (config.STATIC_BASE_URL, x) for x in js)

  if hasattr(config, "ANALYTICS_HTML"):
    jshtml+="\n" + config.ANALYTICS_HTML

  div = ui.get("div", "")
  customjs = ui.get("customjs", "")

  return """%s
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <base />
  <title>%s (qwebirc)</title>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
  <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
  <meta name="mobile-web-app-capable" content="yes" />
  <link rel="icon" sizes="192x192" href="%simages/highresicon.png"/>
  <link rel="shortcut icon" type="image/png" href="%simages/favicon.png"/>
%s%s
%s
  <script type="text/javascript">
    var ui = new qwebirc.ui.Interface("ircui", qwebirc.ui.%s, %s);
  </script>
</head>
<body>
  <div id="ircui">
    <noscript>
      <div id="noscript">Javascript is required to use IRC.</div>
    </noscript>%s
  </div>
</body>
</html>
""" % (ui["doctype"], config.APP_TITLE, config.STATIC_BASE_URL, config.STATIC_BASE_URL, csshtml, customjs, jshtml, ui["class"], optionsgen.get_options(), div)
예제 #5
0
def producehtml(name, debug):
  ui = pages.UIs[name]
  js = jslist(name, debug)
  css = csslist(name, debug, gen=True)
  csshtml = "\n".join("  <link rel=\"stylesheet\" href=\"%s%s\" type=\"text/css\"/>" % (config.STATIC_BASE_URL, x) for x in css)
  jshtml = "\n".join("  <script type=\"text/javascript\" src=\"%s%s\"></script>" % (config.STATIC_BASE_URL, x) for x in js)

  if hasattr(config, "ANALYTICS_HTML"):
    jshtml+="\n" + config.ANALYTICS_HTML

  div = ui.get("div", "")
  customjs = ui.get("customjs", "")

  return """%s
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <base />
  <title>%s (qwebirc)</title>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
  <link rel="shortcut icon" type="image/png" href="%simages/favicon.png"/>
%s%s
%s
  <script type="text/javascript">
    function init() {
    	var ui = new qwebirc.ui.Interface("ircui", qwebirc.ui.%s, %s);
    }
  </script>
</head>
<body onLoad="javascript:init();">
  <!--[if lte IE 6]><script src="js/ie6/warning.js"></script><script>window.onload=function(){e("js/ie6/")}</script><![endif]-->
  <div id="ircui">
    <noscript>
      <div id="noscript">Javascript is required to use IRC.</div>
    </noscript>%s
  </div>
</body>
</html>
""" % (ui["doctype"], config.APP_TITLE, config.STATIC_BASE_URL, csshtml, customjs, jshtml, ui["class"], optionsgen.get_options(), div)