Skip to content

Instantly share code, notes, and snippets.

@ZhangYiJiang
Created August 12, 2016 04:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZhangYiJiang/e89503477c68b38342b457213079b31e to your computer and use it in GitHub Desktop.
Save ZhangYiJiang/e89503477c68b38342b457213079b31e to your computer and use it in GitHub Desktop.
Reorder CORS tutorial ranking using drag and drop
// ==UserScript==
// @name CORS Tutorial Reordering
// @namespace yijiang
// @description Reorder CORS tutorial ranking using drag and drop
// @include https://myaces.nus.edu.sg/cors/RankTutorialServlet
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js
// @require https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js
// @version 1
// @grant none
// ==/UserScript==
$('form[name="FrmRankClass"] table').sortable({
items: 'tr.tablerecord',
update: function(){
$('form[name="FrmRankClass"] table tr.tablerecord').each(function(i) {
$(this).find('select option:nth-child(' + (i+1) + ')').prop('selected', true);
});
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment