So, I was having trouble with a status update widget the other day. I did manage to get it fixed thanks to Twisted. However, I am having a small problem editing the LocalStorage script to work with the widget. The widget isn't showing the current status, which leads me to believe that it's due to not setting up the LocalStorage script correctly due to my lack of knowledge in Java. Below are the current codes I have for the widget and widget's Java page.
Any assistance in setting up the LocalStorage script would be amazing. I'm so lost with Java x.x
Widget Code
Widget Java Code
Any assistance in setting up the LocalStorage script would be amazing. I'm so lost with Java x.x
Widget Code
- Code:
<div align="center">
<span id="tm_currstat">Current Status:</span><br /><br />
<div class="form-group row p-2">
<label for="input-text-help" id="tmst_stnotice" class="control-label"></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><em class="fa fa-paypal"></em></span>
</div>
<input maxlength="150" type="text" class="form-control" id="tstatus" value="" />
</div>
</div>
<div class="form-group row p-2">
<button class="btn btn-light px-5" type="button" onclick="updstatus()">
<em class="fa fa-floppy-o mr-1" id="tmst_stnotice"> </em> Save Status
</button>
</div>
</div>
Widget Java Code
- Code:
jQuery(function()
{
var id = 'field_id1';
dataStore.set('Stat', '', 60*1000);
if(dataStore.get('Stat').value =="")
{
jQuery.get('/u'+_userdata.user_id, function (data)
{
var cstat= jQuery('#'+id+' .field_uneditable', data).eq(0).text();
jQuery('#tm_currstat').text('Current Status: '+cstat);
jQuery('#tstatus').val(cstat);
dataStore.set('Stat', cstat, 60*1000);
})
}else{
jQuery('#tstatus').val(cstat);
jQuery('#tm_currstat').text('Current Status: '+dataStore.get('Stat').value);
}
});
function updstatus()
{
var id = 'field_id1';
var name = 'profile_field_13_8';
jQuery.getScript('https://illiweb.com/rs3/86/frm/jquery/json/jquery.json-1.3.min.js', function()
{
jQuery('#tmst_stnotice').text('Updating.');
var content = new Array();
var newstat = jQuery('#tstatus').val();
content.push(new Array(name, newstat));
jQuery.post('/ajax_profile.forum?jsoncallback=?', {
id: id.substring(8, id.length),
user: _userdata.user_id,
active: '1',
content: jQuery.toJSON(content),
tid: document.getElementById('logout').href.replace(/.*tid=(.*?)&.*/,'$1')
},function(data)
{
jQuery.get('/u'+_userdata.user_id, function (data)
{
var cstat= jQuery('dl:contains(Status) .field_uneditable', data).eq(0).text();
if (jQuery('#tstatus').val()==cstat)
{
jQuery('#tm_currstat').text('Current Status: '+cstat);
dataStore.set('Stat', cstat, 60*1000);
jQuery('#tmst_stnotice').text('Done...');
}else{
jQuery('#tmst_stnotice').text('Error Try Again.');
}
})
}, 'json');
});
};
Last edited by Astariel on March 6th 2019, 12:01 am; edited 2 times in total