Skip to content

Instantly share code, notes, and snippets.

@tjmcewan
Last active December 15, 2015 02:29
Show Gist options
  • Save tjmcewan/5187623 to your computer and use it in GitHub Desktop.
Save tjmcewan/5187623 to your computer and use it in GitHub Desktop.
Sync or Unsync all Box folders on the current page
$('#mod-item-list>li').each(function(index, el){
// defaults to unsync; to sync, set unsync to 0
var unsync = 1;
var folder_id = el.attributes['data-view_id'].textContent;
var data = ["q[items][0]=", folder_id, "&q[unsync]=", unsync, "&request_token=", request_token, "&realtime_subscriber_id=", realtime_subscriber_id].join('');
var url = ["https://", location.host, "/index.php?rm=box_sync_mark_item_sync"].join('');
$.post(url, data, function(x,status,z){ console.log(folder_id, ': ', status) });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment