From 5fa392a28d0641340267d92cd90e189def63764a Mon Sep 17 00:00:00 2001 From: No3x Date: Tue, 28 Jun 2016 10:33:55 +0200 Subject: [PATCH 1/2] gh-68 Fixed bug with id creation based on time. --- js/plugins/tabs.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/js/plugins/tabs.html b/js/plugins/tabs.html index 4a0a4f6..3e516fb 100644 --- a/js/plugins/tabs.html +++ b/js/plugins/tabs.html @@ -90,7 +90,7 @@ var type = $('input[name=type]:checked').val(); var mparent = $('#sl_parent').val(); var content = $('#txt_content').val(); - var id = 'bs_tab' + e.timeStamp; + var id = 'bs_tab' + guid(); if (type == 'tab') { if (mparent == '') { @@ -276,7 +276,7 @@ '; - var id = 'bs_tab' + e.timeStamp; + var id = 'bs_tab' + guid(); if (type != 1) { if (mparent == '') { @@ -293,6 +293,13 @@ $('#' + id).trigger('click') } }); + + function guid() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + } + return s4() + '-' + s4(); + } }); From 95f720006ea5d42406d4c89ad989114bcfeb69b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Z=C3=B6ller?= Date: Wed, 31 Aug 2016 21:27:15 +0200 Subject: [PATCH 2/2] Added underscore Added underscore as suggested by @emRae. --- js/plugins/tabs.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/plugins/tabs.html b/js/plugins/tabs.html index 3e516fb..d800e6e 100644 --- a/js/plugins/tabs.html +++ b/js/plugins/tabs.html @@ -90,7 +90,7 @@ var type = $('input[name=type]:checked').val(); var mparent = $('#sl_parent').val(); var content = $('#txt_content').val(); - var id = 'bs_tab' + guid(); + var id = 'bs_tab_' + guid(); if (type == 'tab') { if (mparent == '') { @@ -276,7 +276,7 @@ '; - var id = 'bs_tab' + guid(); + var id = 'bs_tab_' + guid(); if (type != 1) { if (mparent == '') {