Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-68 Fixed bug with id creation based on time. #69

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions js/plugins/tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 == '') {
Expand Down Expand Up @@ -276,7 +276,7 @@
<button class="tab-delete btn"><i class="icon-trash"></i> Remove</button>';


var id = 'bs_tab' + e.timeStamp;
var id = 'bs_tab' + guid();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion to add an underscore after 'bs_tab' for the id. So, var id = 'bs_tab_' + guid();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just replaced e.timeStamp and did not think about this. Thank you.


if (type != 1) {
if (mparent == '') {
Expand All @@ -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();
}
});
</script>
</head>
Expand Down