2 * Copyright (c) 2015 Sylvain Peyrefitte
4 * This file is part of mstsc.js.
6 * mstsc.j is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 * Use for domain declaration
31 return document.getElementById(id);
35 * Compute screen offset for a target element
36 * @param el {DOM element}
37 * @return {top : {integer}, left {integer}}
39 elementOffset : function (el) {
42 while (el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop )) {
43 x += el.offsetLeft - el.scrollLeft;
44 y += el.offsetTop - el.scrollTop;
47 return { top: y, left: x };
51 * Try to detect browser
52 * @returns {String} [firefox|chrome|ie]
54 browser : function () {
55 if (typeof InstallTrigger !== 'undefined') {
59 if (!!window.chrome) {
63 if (!!document.docuemntMode) {
71 * Try to detect language
74 locale : function () {
75 return window.navigator.userLanguage || window.navigator.language;
81this.Mstsc = new Mstsc();