Skip to content

Commit

Permalink
Merge pull request #12 from WildcardSearch/major-18
Browse files Browse the repository at this point in the history
2.0 Release
  • Loading branch information
Mark Vincent authored Sep 27, 2016
2 parents 713ac3b + 7067983 commit 8e6d83d
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 59 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## YourCode 1.1.1
## YourCode 2.0
for MyBB 1.8.x

*Forget MyCode. Take control of YourCode-- a much better way of handling BB Code for MyBB forums*

Expand Down
32 changes: 16 additions & 16 deletions Upload/admin/jscripts/yourcode/yourcode_inline.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ var YourCode = (function(yc) {
*/
function init() {
initialCount();
$('yc_select_all').observe('click', selectAll);
$$('.yc_check').invoke('observe', 'click', keepCount);
$('yc_inline_clear').observe('click', clearAll);
$('yc_inline_submit').observe('click', submitCheck);
$('#yc_select_all').click(selectAll);
$('.yc_check').click(keepCount);
$('#yc_inline_clear').click(clearAll);
$('#yc_inline_submit').click(submitCheck);
}

/**
Expand All @@ -47,7 +47,7 @@ var YourCode = (function(yc) {
* @return void
*/
function setup(language) {
Object.extend(lang, language || {});
$.extend(lang, language || {});
}

/**
Expand All @@ -58,8 +58,8 @@ var YourCode = (function(yc) {
*/
function submitCheck(e) {
if (!checkCount) {
Event.stop(e);
alert(lang.noSelection);
e.preventDefault();
$.jGrowl(lang.noSelection);
}
}

Expand All @@ -72,7 +72,7 @@ var YourCode = (function(yc) {
function selectAll(e) {
var onOff = false;

if(this.checked) {
if($(this).prop("checked")) {
onOff = true;
}
setAllChecks(onOff);
Expand All @@ -89,9 +89,9 @@ var YourCode = (function(yc) {
onOff = false;
}
checkCount = 0;
$('yc_select_all').checked = onOff;
$$('.yc_check').each(function(check) {
check.checked = onOff;
$('#yc_select_all').prop("checked", onOff);
$('.yc_check').each(function(k, check) {
$(check).prop("checked", onOff);
if (onOff) {
++checkCount;
}
Expand All @@ -106,7 +106,7 @@ var YourCode = (function(yc) {
* @return void
*/
function keepCount(e) {
if(this.checked) {
if(this.prop("checked")) {
++checkCount;
} else {
--checkCount;
Expand All @@ -120,7 +120,7 @@ var YourCode = (function(yc) {
* @return void
*/
function updateCheckCount() {
$('yc_inline_submit').value = lang.go + ' (' + checkCount + ')';
$('#yc_inline_submit').val(lang.go + ' (' + checkCount + ')');
}

/**
Expand All @@ -140,15 +140,15 @@ var YourCode = (function(yc) {
*/
function initialCount() {
checkCount = 0;
$$('.yc_check').each(function(check) {
if (check.checked) {
$('.yc_check').each(function(k, check) {
if ($(check).prop("checked")) {
++checkCount;
}
});
updateCheckCount();
}

Event.observe(window, 'load', init);
$(document).ready(init);

// the public method
yc.inline = {
Expand Down
46 changes: 21 additions & 25 deletions Upload/admin/jscripts/yourcode/yourcode_sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var YourCode = (function(yc) {
function Sandbox(url, elements) {
var allGood = true;

['button', 'regexTextbox', 'replacementTextbox', 'testTextbox', 'htmlTextbox', 'actualDiv', 'nestableInput', 'caseSensitiveInput', 'singleLineInput', 'multiLineInput', 'evalInput'].each(function(key) {
$.each(['button', 'regexTextbox', 'replacementTextbox', 'testTextbox', 'htmlTextbox', 'actualDiv', 'nestableInput', 'caseSensitiveInput', 'singleLineInput', 'multiLineInput', 'evalInput'], function(k, key) {
if (elements && elements[key]) {
this[key] = elements[key];
} else {
Expand All @@ -38,7 +38,7 @@ var YourCode = (function(yc) {
}

this.url = url;
this.button.observe('click', this.update.bindAsEventListener(this));
this.button.click($.proxy(this.update, this));
}

/**
Expand All @@ -49,27 +49,26 @@ var YourCode = (function(yc) {
*/
function update(e) {
var fn = encodeURIComponent;
Event.stop(e);
e.preventDefault();

// build the data
postData = "regex=" + fn(this.regexTextbox.value) +
"&replacement=" + fn(this.replacementTextbox.value) +
"&test_value=" + fn(this.testTextbox.value) +
postData = "regex=" + fn(this.regexTextbox.val()) +
"&replacement=" + fn(this.replacementTextbox.val()) +
"&test_value=" + fn(this.testTextbox.val()) +
"&my_post_key=" + fn(my_post_key) +
(this.nestableInput.checked ? '&nestable=1' : '') +
(this.caseSensitiveInput.checked ? '&case_sensitive=1' : '') +
(this.singleLineInput.checked ? '&single_line=1' : '') +
(this.multiLineInput.checked ? '&multi_line=1' : '') +
(this.evalInput.checked ? '&eval=1' : '');
(this.nestableInput.prop("checked") ? '&nestable=1' : '') +
(this.caseSensitiveInput.prop("checked") ? '&case_sensitive=1' : '') +
(this.singleLineInput.prop("checked") ? '&single_line=1' : '') +
(this.multiLineInput.prop("checked") ? '&multi_line=1' : '') +
(this.evalInput.prop("checked") ? '&eval=1' : '');

this.spinner = new ActivityIndicator("body", {
image: this.spinnerImage
});

new Ajax.Request(this.url, {
method: 'post',
postBody: postData,
onComplete: this.onComplete.bind(this)
$.jGrowl("updating...");

$.ajax({
type: 'post',
url: this.url,
data: postData,
complete: $.proxy(this.onComplete, this),
});
}

Expand All @@ -86,13 +85,11 @@ var YourCode = (function(yc) {
if (!message[1]) {
message[1] = "An unknown error occurred.";
}
alert('There was an error fetching the test results.\n\n' + message[1]);
$.jGrowl('There was an error fetching the test results.\n\n' + message[1]);
} else if(transport.responseText) {
this.actualDiv.innerHTML = transport.responseText;
this.htmlTextbox.value = transport.responseText;
this.actualDiv.html(transport.responseText);
this.htmlTextbox.val(transport.responseText);
}

this.spinner.destroy();
return true;
}

Expand All @@ -109,7 +106,6 @@ var YourCode = (function(yc) {
singleLineInput: null,
multiLineInput: null,
evalInput: null,
spinnerImage: "../images/spinner_big.gif",
update: update,
onComplete: onComplete,
}
Expand Down
30 changes: 15 additions & 15 deletions Upload/inc/plugins/yourcode/acp.php
Original file line number Diff line number Diff line change
Expand Up @@ -562,20 +562,20 @@ function yourcode_admin_edit()
echo <<<EOF
<script type="text/javascript" src="./jscripts/yourcode/yourcode_sandbox.js"></script>
<script type="text/javascript">
Event.observe(window, "load", function() {
$(document).ready(function() {
<!--
new YourCode.Sandbox("./index.php?module=config-yourcode&action=edit&mode=xmlhttp", {
button: $("test"),
regexTextbox: $("regex"),
replacementTextbox: $("replacement"),
testTextbox: $("test_value"),
htmlTextbox: $("result_html"),
actualDiv: $("result_actual"),
nestableInput: $('nestable'),
caseSensitiveInput: $('case_sensitive'),
singleLineInput: $('single_line'),
multiLineInput: $('multi_line'),
evalInput: $('eval'),
button: $("#test"),
regexTextbox: $("#regex"),
replacementTextbox: $("#replacement"),
testTextbox: $("#test_value"),
htmlTextbox: $("#result_html"),
actualDiv: $("#result_actual"),
nestableInput: $('#nestable'),
caseSensitiveInput: $('#case_sensitive'),
singleLineInput: $('#single_line'),
multiLineInput: $('#multi_line'),
evalInput: $('#eval'),
});
});
// -->
Expand Down Expand Up @@ -986,7 +986,7 @@ function yourcode_admin_tools()
yourcode_output_tabs('yourcode_tools');

$onsubmit = <<<EOF
if($('file_s').value) { return true; } alert('{$lang->yourcode_import_no_file}'); return false;
if($('#file_s').val()) { return true; } alert('{$lang->yourcode_import_no_file}'); return false;
EOF;

$form = new Form($html->url(array("action" => 'import')), 'post', '', 1, '', '', $onsubmit);
Expand Down Expand Up @@ -1095,10 +1095,10 @@ function yourcode_admin_import()

$total = count($codes);
$onclick = <<<EOF
var all_checks = $$('input.checkbox_input'); if(this.checked) { checked = true; } for(x = 0; x < all_checks.length; x++) { all_checks[x].checked = checked; }
var all_checks = $('input.checkbox_input'); if(this.checked) { checked = true; } for(x = 0; x < all_checks.length; x++) { all_checks[x].checked = checked; }
EOF;
$onsubmit = <<<EOF
var all_checks = $$('input.checkbox_input'); for(x = 0; x < all_checks.length; x++) { if(all_checks[x].checked) { return true; } } alert('{$lang->yourcode_import_selection_error}'); return false;
var all_checks = $('input.checkbox_input'); for(x = 0; x < all_checks.length; x++) { if(all_checks[x].checked) { return true; } } alert('{$lang->yourcode_import_selection_error}'); return false;
EOF;
$form = new Form($html->url(array("action" => 'import', "mode" => 'finish')), 'post', '', '', '', '', $onsubmit);
$form_container = new FormContainer($lang->yourcode_import);
Expand Down
4 changes: 2 additions & 2 deletions Upload/inc/plugins/yourcode/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ function yourcode_info()
"website" => 'https://github.com/WildcardSearch/YourCode',
"author" => $author,
"authorsite" => 'http://www.rantcentralforums.com',
"version" => '1.1.1',
"compatibility" => '16*',
"version" => '2.0',
"compatibility" => '18*',
"guid" => '36a18ebc285a181a42561141adfd1d7f',
);
}
Expand Down

0 comments on commit 8e6d83d

Please sign in to comment.