-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from dlockhart/framed-support
framed support
- Loading branch information
Showing
16 changed files
with
266 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
|
||
var config = require('../config'), | ||
Client = require('ifrau').Client; | ||
|
||
module.exports = function() { | ||
var client = new Client(); | ||
return client.connect().then(function() { | ||
return client.request('lang'); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use strict'; | ||
|
||
var Client = require('ifrau').Client; | ||
|
||
module.exports = function() { | ||
var client = new Client(); | ||
return client.connect().then(function() { | ||
return client.request('isRtl'); | ||
}); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
'use strict'; | ||
|
||
var isFramed = require('./isFramed'), | ||
isRtlLocal = require('./local/isRtl'), | ||
isRtlFramed = require('./framed/isRtl'); | ||
|
||
module.exports.getLangTag = require('./getLangTag').get; | ||
module.exports.isRtl = require('./isRtl'); | ||
module.exports.isRtl = function() { | ||
var isRtl = isFramed() ? isRtlFramed : isRtlLocal; | ||
return isRtl(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
module.exports = function() { | ||
return !window.D2L; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use strict'; | ||
|
||
var config = require('../config'), | ||
Q = require('q'); | ||
|
||
module.exports = function() { | ||
return Q.fcall(function() { | ||
if(!window || !window.document) { | ||
return { lang: config.defaultLangTag }; | ||
} | ||
|
||
var elems = window.document.getElementsByTagName('html'); | ||
if( elems.length === 0 ) { | ||
return { lang: config.defaultLangTag }; | ||
} | ||
|
||
var lang = elems[0].getAttribute('lang'); | ||
if( lang === null ) { | ||
return { lang: config.defaultLangTag }; | ||
} | ||
|
||
var fallback = elems[0].getAttribute('data-lang-default'); | ||
|
||
var value = { | ||
lang: lang | ||
}; | ||
if(fallback !== null) { | ||
value.fallback = fallback; | ||
} | ||
return value; | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
var Q = require('q'); | ||
|
||
module.exports = function() { | ||
return Q.fcall(function() { | ||
if(!window || !window.document || !window.document.body) { | ||
return false; | ||
} | ||
var value = (window.document.body.dir.toLowerCase() === 'rtl'); | ||
return value; | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
module.exports = function(value) { | ||
return { | ||
then: function(resolve) { | ||
setTimeout(function() { resolve(value); }, 0); | ||
} | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.