Recent Tutorials
Who is online?
In total there are 7 users online :: 2 Registered, 0 Hidden and 5 Guests :: 1 Bot

Milouze14, smurfavr

[ View the whole list ]


Most users ever online was 172 on Fri 19 Feb 2016, 05:17

problem with 2 codes not working

View previous topic View next topic Go down

bodahassan

Title :
Gender : Male
Posts : 28
Points : 175
Reputation : 0
Location : Egypt
Language : arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile

Postbodahassan on Sun 14 Aug 2016, 06:31

[ltr]Good morning

I had a problem with 2 codes not working in Forumactif Edge

The first code used to place fourm icons next to the Forum
[/ltr]
Code:
jQuery(document).ready(function(){var a=[];a[2]=["ficon2"],a[3]=["ficon3"],a[8]=["ficon8"],a[28]=["ficon28"],a[20]=["ficon20"],a[33]=["ficon33"],a[41]=["ficon41"],a[48]=["ficon48"],a[63]=["ficon63"],a[37]=["ficon37"],a[60]=["ficon60"],a[19]=["ficon19"],a[25]=["ficon25"],a[26]=["ficon26"],a[21]=["ficon21"],a[55]=["ficon55"],jQuery("a.forumlink").each(function(){var b=jQuery(this).attr("href").match(/^\/f(\d+)-/)[1];void 0!==a[b]&&jQuery(this).closest("tr").find(".row1:first img").attr("class",a[b])})});
[ltr]



The second code is the solved button

[/ltr]
Code:
$(function() {
  window.$fa_solved = {
   
    icon : {
      id : 3
    },
   
    lang : {
      mark : '<i class="fa"></i> Mark Solved',
      mark_title : 'Marking your topic with the Solved icon will let staff know your problem has been resolved.',
      mark_title_mod : 'Mark this topic Solved',
      marking : '<i class="fa fa-spin"></i> Marking...',
      marked : '<i class="fa"></i> Solved !'
    },
   
    post_id : $('tr.post')[0].id.slice(1),
   
    encode : function(string) {
      return encodeURIComponent(escape(string).replace(/%u[A-F0-9]{4}/g, function(match) {
        return '&#' + parseInt(match.substr(2), 16) + ';';
      })).replace(/%25/g, '%');
    }
   
  };
 
 
 var main = document.getElementById('page-body'), post = $('tr.post',
main)[0], author = $('.poster-profile a[href^="/u"]', post).text(), mod =
 $('.i_icon_ip', post)[0], button = document.createElement('A');
 
  if (!mod && author != _userdata.username) return;
 
  button.innerHTML = $fa_solved.lang.mark;
  button.title = mod ? $fa_solved.mark_title_mod : $fa_solved.mark_title;
  button.className = 'button1 markSolved';
  button.href = '#';
 
  button.onclick = function() {
    var t = this;
    t.innerHTML = $fa_solved.lang.marking;
    t.removeAttribute('title');
    t.onclick = function() { return false };
   
    $.get('/post?p=' + $fa_solved.post_id + '&mode=editpost', function(d) {
      var auth = $('input[name="auth[]"]', d);
 
     $.post('/post', 'subject=' +
$fa_solved.encode($('input[name="subject"]', d)[0].value) +
'&message=' + $fa_solved.encode($('#text_editor_textarea',
d)[0].value) + '&p=' + $fa_solved.post_id + '&post_icon=' +
$fa_solved.icon.id + '&mode=editpost&auth[]=' + auth[0].value +
'&auth[]=' + auth[1].value + '&post=1', function() {
        t.innerHTML = $fa_solved.lang.marked;
        t.className += ' marked';
      });
    });
   
    return false;
  };
 
  main.insertBefore(button, main.firstChild);
  'par ange tuteur';
});
[ltr]

just For the record the codes work fine when I was using phpbb2 version



I hope to fix this code to work with this version[/ltr]


Last edited by bodahassan on Wed 17 Aug 2016, 18:20; edited 1 time in total
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4088
Points : 8387
Reputation : 2008
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sun 14 Aug 2016, 17:10

Hi,

For the first script try replacing it with this :
Code:
jQuery(document).ready(function() {
  var a = [];
  a[2] = ["ficon2"];
  a[3] = ["ficon3"];
  a[8] = ["ficon8"];
  a[28] = ["ficon28"];
  a[20] = ["ficon20"];
  a[33] = ["ficon33"];
  a[41] = ["ficon41"];
  a[48] = ["ficon48"];
  a[63] = ["ficon63"];
  a[37] = ["ficon37"];
  a[60] = ["ficon60"];
  a[19] = ["ficon19"];
  a[25] = ["ficon25"];
  a[26] = ["ficon26"];
  a[21] = ["ficon21"];
  a[55] = ["ficon55"];
 
  jQuery("a.forumtitle").each(function() {
    var b = jQuery(this).attr("href").match(/^\/f(\d+)-/)[1];
    void 0 !== a[b] && jQuery(this).closest(".forum-block").find(".forum-status").attr("class", a[b])
  })
});

For the second script, see if this works instead :
http://fmdesign.forumotion.com/t846-auto-solved-button#17037

But use this script instead of the one provided in the linked topic.
Code:
$(function() {
  window.$fa_solved = {
    forums : /14|42|43|44|45|46|63/,
 
    icon : {
      id : 3,
      image : 'http://i62.servimg.com/u/f62/11/22/70/40/solved10.png'
    },
 
    lang : {
      mark : '<i class="fa"></i> Mark Solved',
      mark_title : 'Marking your topic with the Solved icon will let staff know your problem has been resolved.',
      mark_title_mod : 'Mark this topic Solved',
      marking : '<i class="fa fa-spin"></i> Marking...',
      marked : '<i class="fa"></i> Solved !'
    },
 
    post_id : $('.post')[0].id.slice(1),
 
    encode : function(string) {
      return encodeURIComponent(escape(string).replace(/%u[A-F0-9]{4}/g, function(match) {
        return '&#' + parseInt(match.substr(2), 16) + ';';
      })).replace(/%25/g, '%');
    }
 
  };
 
  var main = document.getElementById('main-content'), post = $('.post', main)[0], fid = $('.topic-actions:first .breadcrumbs a:last', main).attr('href'), author = $('.postprofile .username', post).text(),  icon = $('.title img', main),  mod = $('.i_icon_ip', post)[0], button = document.createElement('A');
 
  if (icon[0].src != $fa_solved.icon.image && $fa_solved.forums.test(fid)) {
    if (!mod && author != _userdata.username) return;
  } else return;
 
  button.innerHTML = $fa_solved.lang.mark;
  button.title = mod ? $fa_solved.mark_title_mod : $fa_solved.mark_title;
  button.className = 'button1 markSolved';
  button.href = '#';
 
  button.onclick = function() {
    var t = this, icon = $('.title img', document.getElementById('main-content'));
    t.innerHTML = $fa_solved.lang.marking;
    t.removeAttribute('title');
    t.onclick = function() { return false };
 
    $.get('/post?p=' + $fa_solved.post_id + '&mode=editpost', function(d) {
      var auth = $('input[name="auth[]"]', d);
      $.post('/post', 'subject=' + $fa_solved.encode($('input[name="subject"]', d)[0].value) + '&message=' + $fa_solved.encode($('#text_editor_textarea', d)[0].value) + '&p=' + $fa_solved.post_id + '&post_icon=' + $fa_solved.icon.id + '&mode=editpost&auth[]=' + auth[0].value + '&auth[]=' + auth[1].value + '&post=1', function() {
        t.innerHTML = $fa_solved.lang.marked;
        t.className += ' marked';
        icon.attr('src', $fa_solved.icon.image);
      });
    });
 
    return false;
  };
 
  main.insertBefore(button, post);
});
 
document.write('<style type="text/css">a.markSolved, a.markSolved:active, a.markSolved:focus {background-color:#8C5;border-color:#8C5;padding:5px 12px !important;}a.markSolved:hover {background-color:#7B4;border-color:#6A3;}a.markSolved.marked {opacity:0.5}a.markSolved i {font-size:13px}</style>');
bodahassan

Title :
Gender : Male
Posts : 28
Points : 175
Reputation : 0
Location : Egypt
Language : arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile

Postbodahassan on Sun 14 Aug 2016, 19:33

Thanks but I tried a lot to make codes work but no result

Unfortunately the scripts does not work

preview : http://sdkoutstore.forumarabia.com/
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4088
Points : 8387
Reputation : 2008
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sun 14 Aug 2016, 20:06

For the first script, try replacing it with this :
Code:
jQuery(document).ready(function() {
  var a = [];
  a[2] = ["ficon2"];
  a[3] = ["ficon3"];
  a[8] = ["ficon8"];
  a[28] = ["ficon28"];
  a[20] = ["ficon20"];
  a[33] = ["ficon33"];
  a[41] = ["ficon41"];
  a[48] = ["ficon48"];
  a[63] = ["ficon63"];
  a[37] = ["ficon37"];
  a[60] = ["ficon60"];
  a[19] = ["ficon19"];
  a[25] = ["ficon25"];
  a[26] = ["ficon26"];
  a[21] = ["ficon21"];
  a[55] = ["ficon55"];
 
  jQuery("a.forumtitle").each(function() {
    var b = jQuery(this).attr("href").match(/^\/f(\d+)-/)[1];
    void 0 !== a[b] && jQuery(this).closest(".forum-block").find(".forum-status").addClass(a[b])
  })
});

For the second script, did you follow these instructions ?
Modifications :

forums : replace the numbers in 42|43|44|45|46|63 with the id of the forum you want the button to show up in. You can see the forum id by looking at the URL when you're inside a forum.
For example : http://fmdesign.forumotion.com/f3-announcements-and-important-topics = 3 ( see the "f3" ? )

id : This is the id of your solved icon. To find it, you need to go to Admin Panel > Display > Pics management > Advanced > Topics icons > edit your solved icon Look at the URL in your address bar, and look for "icon=N" where N would be the id of your topic icon. Once you've found it, replace the "3" that's currently set as the id.
bodahassan

Title :
Gender : Male
Posts : 28
Points : 175
Reputation : 0
Location : Egypt
Language : arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile

Postbodahassan on Sun 14 Aug 2016, 20:16

@Ange Tuteur wrote:For the first script, try replacing it with this :
Code:
jQuery(document).ready(function() {
  var a = [];
  a[2] = ["ficon2"];
  a[3] = ["ficon3"];
  a[8] = ["ficon8"];
  a[28] = ["ficon28"];
  a[20] = ["ficon20"];
  a[33] = ["ficon33"];
  a[41] = ["ficon41"];
  a[48] = ["ficon48"];
  a[63] = ["ficon63"];
  a[37] = ["ficon37"];
  a[60] = ["ficon60"];
  a[19] = ["ficon19"];
  a[25] = ["ficon25"];
  a[26] = ["ficon26"];
  a[21] = ["ficon21"];
  a[55] = ["ficon55"];
 
  jQuery("a.forumtitle").each(function() {
    var b = jQuery(this).attr("href").match(/^\/f(\d+)-/)[1];
    void 0 !== a[b] && jQuery(this).closest(".forum-block").find(".forum-status").addClass(a[b])
  })
});

Unfortunately the code does not work

Important note : I use css code like this to show the fourm icons

Code:
img.ficon2 {
   background: url('http://i35.servimg.com/u/f35/19/14/82/76/ks_css19.png') no-repeat -929px -76px;
   width: 64px;
   height: 64px;
}
img.ficon1 {
   background: url('http://i35.servimg.com/u/f35/19/14/82/76/ks_css19.png') no-repeat -529px -2px;
   width: 64px;
   height: 64px;
}
bodahassan

Title :
Gender : Male
Posts : 28
Points : 175
Reputation : 0
Location : Egypt
Language : arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile

Postbodahassan on Sun 14 Aug 2016, 20:21

@Ange Tuteur wrote:

For the second script, did you follow these instructions ?
Modifications :

forums : replace the numbers in 42|43|44|45|46|63 with the id of the forum you want the button to show up in. You can see the forum id by looking at the URL when you're inside a forum.
For example : http://fmdesign.forumotion.com/f3-announcements-and-important-topics = 3 ( see the "f3" ? )

id : This is the id of your solved icon. To find it, you need to go to Admin Panel > Display > Pics management > Advanced > Topics icons > edit your solved icon Look at the URL in your address bar, and look for "icon=N" where N would be the id of your topic icon. Once you've found it, replace the "3" that's currently set as the id.

Yes I'm sure that everything I've edited it correctly

Code:
$(function() {
          window.$fa_solved = {
            forums : /1|2|43|44|45|46|63/,
       
            icon : {
              id : 8,
              image : 'http://i18.servimg.com/u/f18/13/76/93/58/ks_sol10.png'
            },
       
            lang : {
              mark : '<i class="fa"></i> Mark Solved',
              mark_title : 'Marking your topic with the Solved icon will let staff know your problem has been resolved.',
              mark_title_mod : 'Mark this topic Solved',
              marking : '<i class="fa fa-spin"></i> Marking...',
              marked : '<i class="fa"></i> Solved !'
            },
       
            post_id : $('.post')[0].id.slice(1),
       
            encode : function(string) {
              return encodeURIComponent(escape(string).replace(/%u[A-F0-9]{4}/g, function(match) {
                return '&#' + parseInt(match.substr(2), 16) + ';';
              })).replace(/%25/g, '%');
            }
       
          };
       
          var main = document.getElementById('main-content'), post = $('.post', main)[0], fid = $('.topic-actions:first .breadcrumbs a:last', main).attr('href'), author = $('.postprofile .username', post).text(),  icon = $('.title img', main),  mod = $('.i_icon_ip', post)[0], button = document.createElement('A');
       
          if (icon[0].src != $fa_solved.icon.image && $fa_solved.forums.test(fid)) {
            if (!mod && author != _userdata.username) return;
          } else return;
       
          button.innerHTML = $fa_solved.lang.mark;
          button.title = mod ? $fa_solved.mark_title_mod : $fa_solved.mark_title;
          button.className = 'button1 markSolved';
          button.href = '#';
       
          button.onclick = function() {
            var t = this, icon = $('.title img', document.getElementById('main-content'));
            t.innerHTML = $fa_solved.lang.marking;
            t.removeAttribute('title');
            t.onclick = function() { return false };
       
            $.get('/post?p=' + $fa_solved.post_id + '&mode=editpost', function(d) {
              var auth = $('input[name="auth[]"]', d);
              $.post('/post', 'subject=' + $fa_solved.encode($('input[name="subject"]', d)[0].value) + '&message=' + $fa_solved.encode($('#text_editor_textarea', d)[0].value) + '&p=' + $fa_solved.post_id + '&post_icon=' + $fa_solved.icon.id + '&mode=editpost&auth[]=' + auth[0].value + '&auth[]=' + auth[1].value + '&post=1', function() {
                t.innerHTML = $fa_solved.lang.marked;
                t.className += ' marked';
                icon.attr('src', $fa_solved.icon.image);
              });
            });
       
            return false;
          };
       
          main.insertBefore(button, post);
        });
       
        document.write('<style type="text/css">a.markSolved, a.markSolved:active, a.markSolved:focus {background-color:#8C5;border-color:#8C5;padding:5px 12px !important;}a.markSolved:hover {background-color:#7B4;border-color:#6A3;}a.markSolved.marked {opacity:0.5}a.markSolved i {font-size:13px}</style>');
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4088
Points : 8387
Reputation : 2008
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sun 14 Aug 2016, 21:11

Try removing the "img" tag from the selectors so you get this :
Code:
.ficon2 {
  background: url('http://i35.servimg.com/u/f35/19/14/82/76/ks_css19.png') no-repeat -929px -76px;
  width: 64px;
  height: 64px;
}
.ficon1 {
  background: url('http://i35.servimg.com/u/f35/19/14/82/76/ks_css19.png') no-repeat -529px -2px;
  width: 64px;
  height: 64px;
}

For the second script, may I have a test account on your forum to investigate the issue ?
bodahassan

Title :
Gender : Male
Posts : 28
Points : 175
Reputation : 0
Location : Egypt
Language : arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile

Postbodahassan on Mon 15 Aug 2016, 06:00

I have alredy tried to delete img but without any result

I think that this JavaScript code works fine :

Code:
jQuery(document).ready(function() {
          var a = [];
          a[2] = ["ficon2"];
          a[3] = ["ficon3"];
          a[8] = ["ficon8"];
          a[28] = ["ficon28"];
          a[20] = ["ficon20"];
          a[33] = ["ficon33"];
          a[41] = ["ficon41"];
          a[48] = ["ficon48"];
          a[63] = ["ficon63"];
          a[37] = ["ficon37"];
          a[60] = ["ficon60"];
          a[19] = ["ficon19"];
          a[25] = ["ficon25"];
          a[26] = ["ficon26"];
          a[21] = ["ficon21"];
          a[1] = ["ficon55"];
       
          jQuery("a.forumtitle").each(function() {
            var b = jQuery(this).attr("href").match(/^\/f(\d+)-/)[1];
            void 0 !== a[b] && jQuery(this).closest(".forum-block").find(".forum-status").attr("class", a[b])
          })
        });



I think the issue in css or templates

index_box

Code:
 

<!-- BEGIN catrow -->
   <!-- BEGIN tablehead -->
  <div class="forum-category">
 <div class="title"  ><h2>{catrow.tablehead.L_FORUM}</h2></div>
   <!-- END tablehead -->

     <!-- BEGIN forumrow -->
    <div class="forum-block color-primary">
      <div class="forum-block-inner">
        <div class="forum-status" title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" style="background-image:url('{catrow.forumrow.FORUM_FOLDER_IMG}');">
        </div>

        <div class="forum-info">

          <h{catrow.forumrow.LEVEL} class="hierarchy">
            <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumtitle">{catrow.forumrow.FORUM_NAME}</a>
          </h{catrow.forumrow.LEVEL}>
          {catrow.forumrow.FORUM_DESC}

          <!-- BEGIN switch_moderators_links -->
            {catrow.forumrow.switch_moderators_links.L_MODERATOR}{catrow.forumrow.switch_moderators_links.MODERATORS}
          <!-- END switch_moderators_links -->
          {catrow.forumrow.L_LINKS}{catrow.forumrow.LINKS}
          <strong>{forumrow.L_SUBFORUM_STR}</strong> {forumrow.SUBFORUMS}

        </div>

        <div class="forum-stats">

          <div class="topics">
            <span class="number">{catrow.forumrow.TOPICS}</span><br/>
            <small>{L_TOPICS}</small>
          </div>

          <div class="posts">
            <span class="number">{catrow.forumrow.POSTS}</span><br/>
            <small>{L_POSTS}</small>
          </div>

        </div>

        <div class="forum-lastpost">

          <!-- BEGIN avatar -->
          <span class="lastpost-avatar">{catrow.forumrow.avatar.LAST_POST_AVATAR}</span>
          <!-- END avatar -->

          <span>
            <!-- BEGIN switch_topic_title -->
            <a href="{catrow.forumrow.U_LATEST_TOPIC}" title="{catrow.forumrow.LATEST_TOPIC_TITLE}">{catrow.forumrow.LATEST_TOPIC_NAME}</a><br />
            <!-- END switch_topic_title -->
            {catrow.forumrow.USER_LAST_POST}
          </span>

        </div>

        <div class="clear"></div>
      </div>
    </div>
     <!-- END forumrow -->

   <!-- BEGIN tablefoot -->
    <div class="clear"></div>
    </div>
  </div>
   <!-- END tablefoot -->
<!-- END catrow -->

 


For the second script I've sent you a pm
bodahassan

Title :
Gender : Male
Posts : 28
Points : 175
Reputation : 0
Location : Egypt
Language : arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile

Postbodahassan on Mon 15 Aug 2016, 06:18

I've found a reason

Icons forum does not appear because this code

Code:
style="background-image:url('{catrow.forumrow.FORUM_FOLDER_IMG}');">

But the problem that it appears that way



Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4088
Points : 8387
Reputation : 2008
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Mon 15 Aug 2016, 11:18

For the icons, try floating them to the right :
Code:
.forum-block-inner > div:first-child {
  float:right;
}

For the solved script, I saw you changed a few classes in the viewtopic_body. Try replacing it with this one :
Code:
$(function() {
  window.$fa_solved = {
    forums : /1|2|43|44|45|46|63/,

    icon : {
      id : 8,
      image : 'http://i18.servimg.com/u/f18/13/76/93/58/ks_sol10.png'
    },

    lang : {
      mark : '<i class="fa"></i> Mark Solved',
      mark_title : 'Marking your topic with the Solved icon will let staff know your problem has been resolved.',
      mark_title_mod : 'Mark this topic Solved',
      marking : '<i class="fa fa-spin"></i> Marking...',
      marked : '<i class="fa"></i> Solved !'
    },

    post_id : $('.post')[0].id.slice(1),

    encode : function(string) {
      return encodeURIComponent(escape(string).replace(/%u[A-F0-9]{4}/g, function(match) {
        return '&#' + parseInt(match.substr(2), 16) + ';';
      })).replace(/%25/g, '%');
    }

  };

  var main = document.getElementById('main-content'), post = $('.post', main)[0], fid = $('.topic-actions:first .breadcrumbs a:last', main).attr('href'), author = $('.postprofile .username', post).text(),  icon = $('.topic-title img', main),  mod = $('.i_icon_ip', post)[0], button = document.createElement('A');

  if (icon[0].src != $fa_solved.icon.image && $fa_solved.forums.test(fid)) {
    if (!mod && author != _userdata.username) return;
  } else return;

  button.innerHTML = $fa_solved.lang.mark;
  button.title = mod ? $fa_solved.mark_title_mod : $fa_solved.mark_title;
  button.className = 'button1 markSolved';
  button.href = '#';

  button.onclick = function() {
    var t = this, icon = $('.title img', document.getElementById('main-content'));
    t.innerHTML = $fa_solved.lang.marking;
    t.removeAttribute('title');
    t.onclick = function() { return false };

    $.get('/post?p=' + $fa_solved.post_id + '&mode=editpost', function(d) {
      var auth = $('input[name="auth[]"]', d);
      $.post('/post', 'subject=' + $fa_solved.encode($('input[name="subject"]', d)[0].value) + '&message=' + $fa_solved.encode($('#text_editor_textarea', d)[0].value) + '&p=' + $fa_solved.post_id + '&post_icon=' + $fa_solved.icon.id + '&mode=editpost&auth[]=' + auth[0].value + '&auth[]=' + auth[1].value + '&post=1', function() {
        t.innerHTML = $fa_solved.lang.marked;
        t.className += ' marked';
        icon.attr('src', $fa_solved.icon.image);
      });
    });

    return false;
  };

  main.insertBefore(button, post);
});

$('head').append('<style type="text/css">a.markSolved, a.markSolved:active, a.markSolved:focus {background-color:#8C5;border-color:#8C5;padding:5px 12px !important;}a.markSolved:hover {background-color:#7B4;border-color:#6A3;}a.markSolved.marked {opacity:0.5}a.markSolved i {font-size:13px}</style>');
bodahassan

Title :
Gender : Male
Posts : 28
Points : 175
Reputation : 0
Location : Egypt
Language : arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile

Postbodahassan on Tue 16 Aug 2016, 19:55

Thank you for your effort and we apologize for the inconvenience that causes

But I was trying to delete this

Code:
            forums : /1|2|43|44|45|46|63/,

To make the button appear in every forum topics But when i delete it code not working


Also I did a special div for this button

Code:
<div id="solve-button" class="right"></div>

I want to put id = solve-button in the js code To make the button appears in a particular place

Thank you again bro For you
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4088
Points : 8387
Reputation : 2008
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Tue 16 Aug 2016, 20:04

Hi @bodahassan,

Don't worry about, I'm here to help in my free time. Wink

Try replacing your script with this one :
Code:
$(function() {
  window.$fa_solved = {
 
    icon : {
      id : 8,
      image : 'http://i18.servimg.com/u/f18/13/76/93/58/ks_sol10.png'
    },
 
    lang : {
      mark : '<i class="fa"></i> Mark Solved',
      mark_title : 'Marking your topic with the Solved icon will let staff know your problem has been resolved.',
      mark_title_mod : 'Mark this topic Solved',
      marking : '<i class="fa fa-spin"></i> Marking...',
      marked : '<i class="fa"></i> Solved !'
    },
 
    post_id : $('.post')[0].id.slice(1),
 
    encode : function(string) {
      return encodeURIComponent(escape(string).replace(/%u[A-F0-9]{4}/g, function(match) {
        return '&#' + parseInt(match.substr(2), 16) + ';';
      })).replace(/%25/g, '%');
    }
 
  };
 
  var main = document.getElementById('main-content'), post = $('.post', main)[0], fid = $('.topic-actions:first .breadcrumbs a:last', main).attr('href'), author = $('.postprofile .username', post).text(),  icon = $('.topic-title img', main),  mod = $('.i_icon_ip', post)[0], button = document.createElement('A');
 
  if (icon[0].src != $fa_solved.icon.image) {
    if (!mod && author != _userdata.username) return;
  } else return;
 
  button.innerHTML = $fa_solved.lang.mark;
  button.title = mod ? $fa_solved.mark_title_mod : $fa_solved.mark_title;
  button.className = 'button1 markSolved';
  button.href = '#';
 
  button.onclick = function() {
    var t = this, icon = $('.title img', document.getElementById('main-content'));
    t.innerHTML = $fa_solved.lang.marking;
    t.removeAttribute('title');
    t.onclick = function() { return false };
 
    $.get('/post?p=' + $fa_solved.post_id + '&mode=editpost', function(d) {
      var auth = $('input[name="auth[]"]', d);
      $.post('/post', 'subject=' + $fa_solved.encode($('input[name="subject"]', d)[0].value) + '&message=' + $fa_solved.encode($('#text_editor_textarea', d)[0].value) + '&p=' + $fa_solved.post_id + '&post_icon=' + $fa_solved.icon.id + '&mode=editpost&auth[]=' + auth[0].value + '&auth[]=' + auth[1].value + '&post=1', function() {
        t.innerHTML = $fa_solved.lang.marked;
        t.className += ' marked';
        icon.attr('src', $fa_solved.icon.image);
      });
    });
 
    return false;
  };
 
 
  var div = document.getElementById('solve-button');
  if (div) {
    div.appendChild(button);
  }
});
 
$('head').append('<style type="text/css">a.markSolved, a.markSolved:active, a.markSolved:focus {background-color:#8C5;border-color:#8C5;padding:5px 12px !important;}a.markSolved:hover {background-color:#7B4;border-color:#6A3;}a.markSolved.marked {opacity:0.5}a.markSolved i {font-size:13px}</style>');

I removed the "forums" variable and added the id you wanted for the button. In this spot you can choose what the button is appended to :
Code:
  var div = document.getElementById('solve-button');
  if (div) {
    div.appendChild(button);
  }
bodahassan

Title :
Gender : Male
Posts : 28
Points : 175
Reputation : 0
Location : Egypt
Language : arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile

Postbodahassan on Tue 16 Aug 2016, 20:55

Thank you my bro

you provided the fullest assistance

Only remaining problem and I can say that all problems are resolved

issue in the title button
it Show "undefined"
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4088
Points : 8387
Reputation : 2008
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Wed 17 Aug 2016, 12:15

Ah I found the problem ; it wasn't referencing the "lang" object, so it couldn't find the correct alias. Replace the script with this one :
Code:
$(function() {
  window.$fa_solved = {
 
    icon : {
      id : 8,
      image : 'http://i18.servimg.com/u/f18/13/76/93/58/ks_sol10.png'
    },
 
    lang : {
      mark : '<i class="fa"></i> Mark Solved',
      mark_title : 'Marking your topic with the Solved icon will let staff know your problem has been resolved.',
      mark_title_mod : 'Mark this topic Solved',
      marking : '<i class="fa fa-spin"></i> Marking...',
      marked : '<i class="fa"></i> Solved !'
    },
 
    post_id : $('.post')[0].id.slice(1),
 
    encode : function(string) {
      return encodeURIComponent(escape(string).replace(/%u[A-F0-9]{4}/g, function(match) {
        return '&#' + parseInt(match.substr(2), 16) + ';';
      })).replace(/%25/g, '%');
    }
 
  };
 
  var main = document.getElementById('main-content'), post = $('.post', main)[0], fid = $('.topic-actions:first .breadcrumbs a:last', main).attr('href'), author = $('.postprofile .username', post).text(),  icon = $('.topic-title img', main),  mod = $('.i_icon_ip', post)[0], button = document.createElement('A');
 
  if (icon[0].src != $fa_solved.icon.image) {
    if (!mod && author != _userdata.username) return;
  } else return;
 
  button.innerHTML = $fa_solved.lang.mark;
  button.title = mod ? $fa_solved.lang.mark_title_mod : $fa_solved.lang.mark_title;
  button.className = 'button1 markSolved';
  button.href = '#';
 
  button.onclick = function() {
    var t = this, icon = $('.title img', document.getElementById('main-content'));
    t.innerHTML = $fa_solved.lang.marking;
    t.removeAttribute('title');
    t.onclick = function() { return false };
 
    $.get('/post?p=' + $fa_solved.post_id + '&mode=editpost', function(d) {
      var auth = $('input[name="auth[]"]', d);
      $.post('/post', 'subject=' + $fa_solved.encode($('input[name="subject"]', d)[0].value) + '&message=' + $fa_solved.encode($('#text_editor_textarea', d)[0].value) + '&p=' + $fa_solved.post_id + '&post_icon=' + $fa_solved.icon.id + '&mode=editpost&auth[]=' + auth[0].value + '&auth[]=' + auth[1].value + '&post=1', function() {
        t.innerHTML = $fa_solved.lang.marked;
        t.className += ' marked';
        icon.attr('src', $fa_solved.icon.image);
      });
    });
 
    return false;
  };
 
 
  var div = document.getElementById('solve-button');
  if (div) {
    div.appendChild(button);
  }
});
 
$('head').append('<style type="text/css">a.markSolved, a.markSolved:active, a.markSolved:focus {background-color:#8C5;border-color:#8C5;padding:5px 12px !important;}a.markSolved:hover {background-color:#7B4;border-color:#6A3;}a.markSolved.marked {opacity:0.5}a.markSolved i {font-size:13px}</style>');
Should be corrected now. Wink
bodahassan

Title :
Gender : Male
Posts : 28
Points : 175
Reputation : 0
Location : Egypt
Language : arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile

Postbodahassan on Wed 17 Aug 2016, 18:23

Thanks a lot Ange Tuteur Rose Rose Rose

Resolved
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4088
Points : 8387
Reputation : 2008
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Wed 17 Aug 2016, 18:28

You're welcome ! Mr. Green

Have a good day. ^^

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in

 
Permissions in this forum:
You cannot reply to topics in this forum