Add language detection
This commit is contained in:
		@@ -6,7 +6,8 @@
 | 
				
			|||||||
#wikiFrame {
 | 
					#wikiFrame {
 | 
				
			||||||
    width: 100%;
 | 
					    width: 100%;
 | 
				
			||||||
    height: 100%;
 | 
					    height: 100%;
 | 
				
			||||||
    top: 0;
 | 
					    padding-top: 30px;
 | 
				
			||||||
 | 
					    top:0;
 | 
				
			||||||
    bottom: 0;
 | 
					    bottom: 0;
 | 
				
			||||||
    position: absolute;
 | 
					    position: absolute;
 | 
				
			||||||
    overflow: hidden;
 | 
					    overflow: hidden;
 | 
				
			||||||
@@ -129,8 +130,6 @@
 | 
				
			|||||||
    border-color: darkgreen;
 | 
					    border-color: darkgreen;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wiki
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.wiki-aside-action-item {
 | 
					.wiki-aside-action-item {
 | 
				
			||||||
    display: flex;
 | 
					    display: flex;
 | 
				
			||||||
    /* main axis */
 | 
					    /* main axis */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -382,8 +382,11 @@ $(document).ready(function() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  function showWiki() {
 | 
					  function showWiki() {
 | 
				
			||||||
    if (!main.isWikiAsideLoad) {
 | 
					    if (!main.isWikiAsideLoad) {
 | 
				
			||||||
 | 
					      var lang = window.location.toString().match(/\/\w{2}\//);
 | 
				
			||||||
 | 
					      lang = (lang) ? lang[0] : '/en/';
 | 
				
			||||||
 | 
					      var wikiURL = 'http://freecodecamp.github.io/wiki' + lang;
 | 
				
			||||||
      var wikiAside = $('<iframe>');
 | 
					      var wikiAside = $('<iframe>');
 | 
				
			||||||
      wikiAside.attr('src', 'http://freecodecamp.github.io/wiki'); /*  <-----------------------------------------  here */
 | 
					      wikiAside.attr('src', wikiURL);
 | 
				
			||||||
      $('.wiki-aside').append(wikiAside);
 | 
					      $('.wiki-aside').append(wikiAside);
 | 
				
			||||||
      main.isWikiAsideLoad = true;
 | 
					      main.isWikiAsideLoad = true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@
 | 
				
			|||||||
  "target": "_blank"
 | 
					  "target": "_blank"
 | 
				
			||||||
},{
 | 
					},{
 | 
				
			||||||
  "content": "Wiki",
 | 
					  "content": "Wiki",
 | 
				
			||||||
  "link": "https://github.com/freecodecamp/freecodecamp/wiki/",
 | 
					  "link": "/wiki",
 | 
				
			||||||
  "target": "_blank"
 | 
					  "target": "_blank"
 | 
				
			||||||
},{
 | 
					},{
 | 
				
			||||||
  "content": "Jobs",
 | 
					  "content": "Jobs",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,6 @@
 | 
				
			|||||||
module.exports = function(app) {
 | 
					module.exports = function(app) {
 | 
				
			||||||
  var router = app.loopback.Router();
 | 
					  var router = app.loopback.Router();
 | 
				
			||||||
 | 
					  router.get('/wiki/*', showWiki);
 | 
				
			||||||
  router.get('/wiki', showWiki);
 | 
					  router.get('/wiki', showWiki);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  app.use(router);
 | 
					  app.use(router);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -66,8 +66,7 @@ export default function csp() {
 | 
				
			|||||||
        '*.twitter.com',
 | 
					        '*.twitter.com',
 | 
				
			||||||
        '*.ghbtns.com',
 | 
					        '*.ghbtns.com',
 | 
				
			||||||
        '*.freecatphotoapp.com',
 | 
					        '*.freecatphotoapp.com',
 | 
				
			||||||
        'freecodecamp.github.io',
 | 
					        'freecodecamp.github.io'        
 | 
				
			||||||
        'localhost:8000'        
 | 
					 | 
				
			||||||
      ].concat(trusted)
 | 
					      ].concat(trusted)
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    // set to true if you only want to report errors
 | 
					    // set to true if you only want to report errors
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,7 @@ nav.navbar.navbar-default.navbar-fixed-top.nav-height
 | 
				
			|||||||
            li.hidden-xs
 | 
					            li.hidden-xs
 | 
				
			||||||
                a#nav-wiki-btn(href='#' onclick='return false') Wiki
 | 
					                a#nav-wiki-btn(href='#' onclick='return false') Wiki
 | 
				
			||||||
            li.visible-xs
 | 
					            li.visible-xs
 | 
				
			||||||
                a(href='//github.com/FreeCodeCamp/freecodecamp/wiki/Home', target='_blank') Wiki
 | 
					                a(href='/wiki', target='_blank') Wiki
 | 
				
			||||||
            li
 | 
					            li
 | 
				
			||||||
                a(href='/jobs') Jobs
 | 
					                a(href='/jobs') Jobs
 | 
				
			||||||
            li
 | 
					            li
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,7 @@
 | 
				
			|||||||
extends ../layout-wide
 | 
					extends ../layout-wide
 | 
				
			||||||
block content
 | 
					block content
 | 
				
			||||||
            iframe#wikiFrame(frameborder='no', src='http://freecodecamp.github.io/wiki')
 | 
					    iframe#wikiFrame(frameborder='no')
 | 
				
			||||||
 | 
					    script.
 | 
				
			||||||
 | 
					        var lang = window.location.toString().match(/\/\w{2}\//);
 | 
				
			||||||
 | 
					        lang = (lang) ? lang[0] : '/en/';
 | 
				
			||||||
 | 
					        $('#wikiFrame').attr('src','http://freecodecamp.github.io/wiki' + lang);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user