alle $ durch jQuery ersetzt
This commit is contained in:
parent
4308943177
commit
042b282731
4 changed files with 17 additions and 18 deletions
5
README
5
README
|
@ -32,7 +32,7 @@ Erstelle ein leeres <div> mit einer ID:
|
||||||
3. Uhr per Javascript konfigurieren
|
3. Uhr per Javascript konfigurieren
|
||||||
|
|
||||||
Initialisiere die Uhr mit einer einzigen Zeile Javascript:
|
Initialisiere die Uhr mit einer einzigen Zeile Javascript:
|
||||||
new Uhr($('#meineuhr'));
|
new Uhr(jQuery('#meineuhr'));
|
||||||
|
|
||||||
Als Parameter wird ein jQuery-gewrapptes HTML-Element erwartet.
|
Als Parameter wird ein jQuery-gewrapptes HTML-Element erwartet.
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ Wie du diese Optionen ändern kannst, verrät der nächte Abschnitt
|
||||||
|
|
||||||
4. Weitere Optionen
|
4. Weitere Optionen
|
||||||
Der Uhr()-Methode kann ein Options-Objekt mitgegeben werden:
|
Der Uhr()-Methode kann ein Options-Objekt mitgegeben werden:
|
||||||
new Uhr($('#uhrcontainer'), {
|
new Uhr(jQuery('#uhrcontainer'), {
|
||||||
status: 'on', // 'on' oder 'off'
|
status: 'on', // 'on' oder 'off'
|
||||||
theme: 'red', // 'black', 'red', 'blue', 'green' oder 'white'
|
theme: 'red', // 'black', 'red', 'blue', 'green' oder 'white'
|
||||||
layout: 'en', // 'de_EC', 'de' oder 'en' (je nach eingebundenen Sprachdateien
|
layout: 'en', // 'de_EC', 'de' oder 'en' (je nach eingebundenen Sprachdateien
|
||||||
|
@ -69,4 +69,3 @@ GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
<script type="text/javascript" src="uhr-de.js"></script>
|
<script type="text/javascript" src="uhr-de.js"></script>
|
||||||
<script type="text/javascript" src="uhr-en.js"></script>
|
<script type="text/javascript" src="uhr-en.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
new Uhr($('#uhr'), {
|
new Uhr(jQuery('#uhr'), {
|
||||||
layout: 'de_CH',
|
layout: 'de_CH',
|
||||||
theme: 'black',
|
theme: 'black',
|
||||||
status: 'on',
|
status: 'on',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
CACHE MANIFEST
|
CACHE MANIFEST
|
||||||
# 3.0.5
|
# 3.0.6
|
||||||
|
|
||||||
COPYING
|
COPYING
|
||||||
index.html
|
index.html
|
||||||
|
|
26
uhr.js
26
uhr.js
|
@ -42,7 +42,7 @@ Uhr.prototype.start = function() {
|
||||||
var uhr = this;
|
var uhr = this;
|
||||||
this.timer = window.setInterval(function() {uhr.update();}, 1000);
|
this.timer = window.setInterval(function() {uhr.update();}, 1000);
|
||||||
this.update();
|
this.update();
|
||||||
$.cookie('status' + this.id, 'on', {expires: 365, path: '/'});
|
jQuery.cookie('status' + this.id, 'on', {expires: 365, path: '/'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Uhr.prototype.stop = function() {
|
Uhr.prototype.stop = function() {
|
||||||
|
@ -50,7 +50,7 @@ Uhr.prototype.stop = function() {
|
||||||
window.clearInterval(this.timer);
|
window.clearInterval(this.timer);
|
||||||
this.timer = null;
|
this.timer = null;
|
||||||
this.update();
|
this.update();
|
||||||
$.cookie('status' + this.id, 'off', {expires: 365, path: '/'});
|
jQuery.cookie('status' + this.id, 'off', {expires: 365, path: '/'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Uhr.prototype.isOn = function() {
|
Uhr.prototype.isOn = function() {
|
||||||
|
@ -62,7 +62,7 @@ Uhr.prototype.setLayout = function(locale) {
|
||||||
this.currentLayout = newLayout;
|
this.currentLayout = newLayout;
|
||||||
var renderer = new UhrRenderer(this.currentLayout, this.letterarea);
|
var renderer = new UhrRenderer(this.currentLayout, this.letterarea);
|
||||||
renderer.render(this);
|
renderer.render(this);
|
||||||
$.cookie('layout' + this.id, locale, {expires: 365, path: '/'});
|
jQuery.cookie('layout' + this.id, locale, {expires: 365, path: '/'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Uhr.prototype.setTheme = function(theme) {
|
Uhr.prototype.setTheme = function(theme) {
|
||||||
|
@ -72,7 +72,7 @@ Uhr.prototype.setTheme = function(theme) {
|
||||||
this.clockarea.addClass(theme);
|
this.clockarea.addClass(theme);
|
||||||
this.toggleSwitch.addClass(theme);
|
this.toggleSwitch.addClass(theme);
|
||||||
this.currentTheme = theme;
|
this.currentTheme = theme;
|
||||||
$.cookie('theme' + this.id, theme, {expires: 365, path: '/'});
|
jQuery.cookie('theme' + this.id, theme, {expires: 365, path: '/'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Uhr.prototype.update = function() {
|
Uhr.prototype.update = function() {
|
||||||
|
@ -174,8 +174,8 @@ Uhr.prototype.createClockarea = function(clockarea, width) {
|
||||||
this.clockarea = clockarea
|
this.clockarea = clockarea
|
||||||
}
|
}
|
||||||
Uhr.prototype.createToggleSwitch = function() {
|
Uhr.prototype.createToggleSwitch = function() {
|
||||||
this.toggleSwitch = $('<div class="onoffswitch"></div>');
|
this.toggleSwitch = jQuery('<div class="onoffswitch"></div>');
|
||||||
var input = $('<input type="checkbox" name="onoffswitch' + this.id + '" class="onoffswitch-checkbox" id="onoffswitch' + this.id + '" checked="checked" />');
|
var input = jQuery('<input type="checkbox" name="onoffswitch' + this.id + '" class="onoffswitch-checkbox" id="onoffswitch' + this.id + '" checked="checked" />');
|
||||||
this.toggleSwitch.append(input);
|
this.toggleSwitch.append(input);
|
||||||
this.toggleSwitch.append('<label class="onoffswitch-label" for="onoffswitch' + this.id + '">'
|
this.toggleSwitch.append('<label class="onoffswitch-label" for="onoffswitch' + this.id + '">'
|
||||||
+ '<div class="onoffswitch-inner"></div>'
|
+ '<div class="onoffswitch-inner"></div>'
|
||||||
|
@ -184,18 +184,18 @@ Uhr.prototype.createToggleSwitch = function() {
|
||||||
this.clockarea.after(this.toggleSwitch);
|
this.clockarea.after(this.toggleSwitch);
|
||||||
}
|
}
|
||||||
Uhr.prototype.createLayoutSwitch = function () {
|
Uhr.prototype.createLayoutSwitch = function () {
|
||||||
this.layoutSwitch = $('<select></select>')
|
this.layoutSwitch = jQuery('<select></select>')
|
||||||
for (var code in Uhr.layouts) {
|
for (var code in Uhr.layouts) {
|
||||||
if (Uhr.layouts.hasOwnProperty(code)) {
|
if (Uhr.layouts.hasOwnProperty(code)) {
|
||||||
var layout = Uhr.layouts[code];
|
var layout = Uhr.layouts[code];
|
||||||
var option = $('<option value="' + code + '">' + layout.language + '</option>')
|
var option = jQuery('<option value="' + code + '">' + layout.language + '</option>')
|
||||||
this.layoutSwitch.append(option);
|
this.layoutSwitch.append(option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.clockarea.after(this.layoutSwitch);
|
this.clockarea.after(this.layoutSwitch);
|
||||||
}
|
}
|
||||||
Uhr.prototype.createThemeSwitch = function () {
|
Uhr.prototype.createThemeSwitch = function () {
|
||||||
this.themeSwitch = $('<select></select>');
|
this.themeSwitch = jQuery('<select></select>');
|
||||||
this.themeSwitch.append('<option value="black">Schwarz</option>');
|
this.themeSwitch.append('<option value="black">Schwarz</option>');
|
||||||
this.themeSwitch.append('<option value="red">Rot</option>');
|
this.themeSwitch.append('<option value="red">Rot</option>');
|
||||||
this.themeSwitch.append('<option value="blue">Blau</option>');
|
this.themeSwitch.append('<option value="blue">Blau</option>');
|
||||||
|
@ -204,12 +204,12 @@ Uhr.prototype.createThemeSwitch = function () {
|
||||||
this.clockarea.after(this.themeSwitch);
|
this.clockarea.after(this.themeSwitch);
|
||||||
}
|
}
|
||||||
Uhr.prototype.initToggleSwitch = function(defaultValue, overrideCookie) {
|
Uhr.prototype.initToggleSwitch = function(defaultValue, overrideCookie) {
|
||||||
var input = $('#onoffswitch' + this.id);
|
var input = jQuery('#onoffswitch' + this.id);
|
||||||
var uhr = this;
|
var uhr = this;
|
||||||
input.on('click', function() {
|
input.on('click', function() {
|
||||||
uhr.toggle();
|
uhr.toggle();
|
||||||
});
|
});
|
||||||
var status = $.cookie('status' + this.id);
|
var status = jQuery.cookie('status' + this.id);
|
||||||
if (status == undefined || (overrideCookie && (defaultValue != undefined))) {
|
if (status == undefined || (overrideCookie && (defaultValue != undefined))) {
|
||||||
status = defaultValue;
|
status = defaultValue;
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ Uhr.prototype.initLayoutSwitch = function(defaultValue, overrideCookie) {
|
||||||
this.layoutSwitch.on('change', function() {
|
this.layoutSwitch.on('change', function() {
|
||||||
uhr.setLayout(this.value);
|
uhr.setLayout(this.value);
|
||||||
});
|
});
|
||||||
var selectedLayout = $.cookie('layout' + this.id);
|
var selectedLayout = jQuery.cookie('layout' + this.id);
|
||||||
if (selectedLayout == undefined || (overrideCookie && (defaultValue != undefined))) {
|
if (selectedLayout == undefined || (overrideCookie && (defaultValue != undefined))) {
|
||||||
selectedLayout = defaultValue;
|
selectedLayout = defaultValue;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ Uhr.prototype.initThemeSwitch = function(defaultValue, overrideCookie) {
|
||||||
this.themeSwitch.on('change', function() {
|
this.themeSwitch.on('change', function() {
|
||||||
uhr.setTheme(this.value);
|
uhr.setTheme(this.value);
|
||||||
});
|
});
|
||||||
var selectedTheme = $.cookie('theme' + this.id);
|
var selectedTheme = jQuery.cookie('theme' + this.id);
|
||||||
if (selectedTheme == undefined || (overrideCookie && (defaultValue != undefined))) {
|
if (selectedTheme == undefined || (overrideCookie && (defaultValue != undefined))) {
|
||||||
selectedTheme = defaultValue;
|
selectedTheme = defaultValue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue