-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#47: Run Prittier on all Javascripts to clean up code formatting.
- Loading branch information
1 parent
36cc918
commit a5766fb
Showing
8 changed files
with
1,040 additions
and
763 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,40 @@ | ||
import './styles/bookmarks.css'; | ||
import $ from 'jquery'; | ||
import "./styles/bookmarks.css"; | ||
import $ from "jquery"; | ||
|
||
$(function() { // on DOM ready | ||
$(function () { | ||
// on DOM ready | ||
|
||
$('.save_course a').click(function () { | ||
var clickedAnchor = $(this); | ||
var courseId = $(this).siblings('input[name=course_id]').val(); | ||
|
||
$.ajax({ | ||
url: clickedAnchor.attr('href'), | ||
success: function () { | ||
if (clickedAnchor.hasClass('save')) { | ||
bookmarks_show_forget(courseId); | ||
} else { | ||
bookmarks_show_save(courseId); | ||
} | ||
} | ||
|
||
}); | ||
return false; | ||
}); | ||
$(".save_course a").click(function () { | ||
var clickedAnchor = $(this); | ||
var courseId = $(this).siblings("input[name=course_id]").val(); | ||
|
||
$.ajax({ | ||
url: clickedAnchor.attr("href"), | ||
success: function () { | ||
if (clickedAnchor.hasClass("save")) { | ||
bookmarks_show_forget(courseId); | ||
} else { | ||
bookmarks_show_save(courseId); | ||
} | ||
}, | ||
}); | ||
return false; | ||
}); | ||
}); | ||
|
||
function bookmarks_show_save(courseId) { | ||
$('.save_course input[name=course_id][value="' + courseId + '"]').siblings('a.save').show(); | ||
$('.save_course input[name=course_id][value="' + courseId + '"]').siblings('a.forget').hide(); | ||
$('.save_course input[name=course_id][value="' + courseId + '"]') | ||
.siblings("a.save") | ||
.show(); | ||
$('.save_course input[name=course_id][value="' + courseId + '"]') | ||
.siblings("a.forget") | ||
.hide(); | ||
} | ||
function bookmarks_show_forget(courseId) { | ||
$('.save_course input[name=course_id][value="' + courseId + '"]').siblings('a.save').hide(); | ||
$('.save_course input[name=course_id][value="' + courseId + '"]').siblings('a.forget').show(); | ||
$('.save_course input[name=course_id][value="' + courseId + '"]') | ||
.siblings("a.save") | ||
.hide(); | ||
$('.save_course input[name=course_id][value="' + courseId + '"]') | ||
.siblings("a.forget") | ||
.show(); | ||
} |
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.