Skip to content
Permalink
Browse files

Enabale Hound for JavaScript.

  • Loading branch information
iissnan committed Nov 18, 2015
2 parents d367c2f + 51e82e4 commit 5f3aa30af7ffb1ae1b7210fcb7c592d190c47a6d
Showing with 32 additions and 13 deletions.
  1. +4 −0 .hound.yml
  2. +3 −0 .javascript_ignore
  3. +1 −5 layout/_partials/head.swig
  4. +24 −8 source/js/src/hook-duoshuo.js
@@ -0,0 +1,4 @@
javascript:
enabled: true
config_file: .jshintrc
ignore_file: .javascript_ignore
@@ -0,0 +1,3 @@
source/vendors/*
source/js/src/affix.js
source/js/src/scrollspy.js
@@ -29,11 +29,7 @@


{% if theme.use_font_lato %}
{% if config.language === 'zh-Hans' %}
<link href='//fonts.lug.ustc.edu.cn/css?family=Lato:300,400,700,400italic&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
{% else %}
<link href='//fonts.googleapis.com/css?family=Lato:300,400,700,400italic&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
{% endif %}
<link href="//fonts.googleapis.com/css?family=Lato:300,400,700,400italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
{% endif %}


@@ -47,17 +47,19 @@ function getAgentInfo(string) {
unknown : 'desktop'
},
browser: {
chrome : 'chrome',
'chromium': 'chrome',
firefox: 'firefox',
opera : 'opera',
safari : 'safari',
ie : 'internet-explorer',
unknown: 'globe'
chrome : 'chrome',
chromium : 'chrome',
firefox : 'firefox',
opera : 'opera',
safari : 'safari',
ie : 'internet-explorer',
wechat : 'wechat',
qq : 'qq',
unknown : 'globe'
}
};
var osIcon = iconMapping.os[osName.toLowerCase()];
var browserIcon = iconMapping.browser[browserName.toLowerCase()];
var browserIcon = iconMapping.browser[getBrowserKey()];

return separator +
'<span class="duoshuo-ua-platform duoshuo-ua-platform-' + osName.toLowerCase() + '">' +
@@ -69,6 +71,20 @@ function getAgentInfo(string) {
browserName + ' ' + browserVersion +
'</span>';

function getBrowserKey () {
var key = browserName.toLowerCase();

if (key.match(/WeChat/i)) {
return 'wechat';
}

if (key.match(/QQBrowser/i)) {
return 'qq';
}

return key;
}

function isMobile() {
var userAgent = window.navigator.userAgent;

0 comments on commit 5f3aa30

Please sign in to comment.
You can’t perform that action at this time.