Forum Replies Created

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter saib0t

    (@saib0t)

    Now it’s working. It seems, that it just took a while.
    By the way, I see. that the error console still shows another error:

    Failed to set referrer policy: The value ” is not one of ‘no-referrer’, ‘no-referrer-when-downgrade’, ‘origin’, ‘origin-when-cross-origin’, ‘same-origin’, ‘strict-origin’, ‘strict-origin-when-cross-origin’, or ‘unsafe-url’. The referrer policy has been left unchanged.

    Any idea what that means?

    Thread Starter saib0t

    (@saib0t)

    I just swaped the link in my css file. The link I set there, is the one you mentioned, but with https. The link WordPress shows me for this file, is a http link (like with any other media I uploaded there). But it’s the only one to be delivered unsecure.

    Thread Starter saib0t

    (@saib0t)

    I swaped the gif with one that I uploaded manually in the media section of wordpress. But the error console still tells me, that it is unsecured. I cleared the cache of the Optimole plugin. Why would this be the only image from all the images I uploaded in WordPress, that’s not served over https?

    Thread Starter saib0t

    (@saib0t)

    Alright. I know where this circle comes from. It’s used by a custom built plugin. So I guess I have to replace this reference with a gif that’s hosted locally right?
    From curiosity: How did you find it out so fast?

    Thank you

    Thread Starter saib0t

    (@saib0t)

    Actually yes. The homepage seems to be secure, whereas https://brightdecide.com/e-mountainbike-vergleich/ isn’t

    Thread Starter saib0t

    (@saib0t)

    Well at least I get a “Connection failed” now, instead of an empty page. I used the data I got from my host, to connect to the database. Just to make things clear: I’m not talking about the data base that WordPress depends on anyways, but a seperate one storing data, which, later on, should be displayed in the table.

    Thread Starter saib0t

    (@saib0t)

    Yea actually there is a die, for the case, that the connection failed. Taking it out doesn’t help. I used a plugin called Post Snippets. Code looks like this:

    <?php
    $dbh = mysql_connect("<em>Server</em>", "<em>Username</em>", "<em>Password</em>");
    if (!mysql_query($query, $dbh)) die("Connection failed.");
    $query = "use <em>DB-Name</em>";
    ?>
    Thread Starter saib0t

    (@saib0t)

    I do, but there is not much to see:
    https://brightdecide.de/?page_id=15

    Thread Starter saib0t

    (@saib0t)

    Well I turend debugging on now. All it shows is the following:
    Warning: Use of undefined constant minor - assumed 'minor' (this will throw an Error in a future version of PHP) in /mnt/web415/e2/89/59712689/htdocs/WordPress_01/wp-config.php on line 94 Warning: Cannot modify header information - headers already sent by (output started at /mnt/web415/e2/89/59712689/htdocs/WordPress_01/wp-config.php:94) in /mnt/web415/e2/89/59712689/htdocs/WordPress_01/wp-admin/includes/misc.php on line 1144 Warning: Cannot modify header information - headers already sent by (output started at /mnt/web415/e2/89/59712689/htdocs/WordPress_01/wp-config.php:94) in /mnt/web415/e2/89/59712689/htdocs/WordPress_01/wp-includes/pluggable.php on line 1223
    That’s the mentioned constant: define( “WP_AUTO_UPDATE_CORE”, minor );
    Yet I’m not sure how to interpret this error, but as it also appears in the header of the working site, I assume, that it’s not the cause for the non visible table.

    Thread Starter saib0t

    (@saib0t)

    Ok I think I found the problem.
    At the beginning of the page I inserted another shortcode with Post Snippets. This code is supposed to establish the connection to my database. As soon, as I remove this shortcode everything is fine. Any idea why?
    It would just look like this:

    [db-verbindung-aufbauen]
    
    [sc name="table_xyz"]

    And another question: Why is there a pop-up message every time I press “Calculate Multiplier”?

    • This reply was modified 6 years, 1 month ago by saib0t.
    • This reply was modified 6 years, 1 month ago by saib0t.
    Thread Starter saib0t

    (@saib0t)

    So to test it, I tried to insert the code into my wordpress site using the plugin “Shortcoder”. But for some reason nothing appears in the preview.

    I merged HTML, CSS and JS into one document, as follows:

    
    <!DOCTYPE html>
    <html>
    <head>
    <style>td { border:1px solid #000; color: #000; cursor: pointer; }
    .max { background: red; color: #fff; }
    .selected { background: purple; color: #fff; }
    small { color: yellow; padding: 0 5px; }</style>
    <script> 
      /* https://stackoverflow.com/questions/45983101/jquery-find-smallest-value-in-table-row-and-style-it */
    
    $('document').ready(function(){
      $('tr').not('.colTotal').each(function(){
          var vals = $('td,th',this).map(function () {
              return parseInt($(this).text(), 10) ? parseInt($(this).text(), 10) :  null;
          }).get();
          // then find their maximum
          var max = Math.max.apply(Math, vals);
    
          // tag any cell matching the max value
          $('td,th', this).filter(function () {
              return parseInt($(this).text(), 10) === max;
          }).addClass('max');
      });
      
      /* user clicks */
      $('td').on('click', function(){
      if($(this).hasClass('max')){
        $(this).removeClass('max');
      } else {
     	  $(this).toggleClass('selected');
      }
      });
    });
    
    /* add up row values */
    $('#calcRows').on('click', function(){
        $('tr').not('.colTotal').each(function () {
            var sum = 0
            /*
            $(this).find('td').not('.total').each(function () {
                var val = $(this).text();
                if (!isNaN(val) && val.length !== 0) {
                    sum += parseFloat(val);
                }
            });
            $('.total', this).html(sum);
            */
            var sum = $('td.max', this).length + $('td.selected', this).length;
            $('.total', this).text(sum);
        });
    });
    $('#calcCols').on('click', function(){
        for (i=0;i<$('tr:eq(0) td').length;i++) {
           var total = 0;
            $('td:eq(' + i + ')', 'tr').each(function(i) {
              $('small', this).remove();
              if (!isNaN(parseInt($(this).text()))){
               total = total + parseInt($(this).text());
              }
            });            
            $('tr.colTotal td').eq(i).text(total);
        }
    });
    $('#calcMul').on('click', function(){
        for (i=0;i<$('tr:eq(0) td').length;i++) {
           var tot = 0;
            $('td:eq(' + i + ')', 'tr').each(function(i) {
              $('small', this).remove();
              if($(this).hasClass('max') || $(this).hasClass('selected')) {
                if (!isNaN(parseInt($(this).text()))){
                  $(this).append('<small />');
                  $('small', this).text(1 * parseInt($(this).parent('tr').data('multiplier')));
                 tot = tot + parseInt($('small', this).text());
                  //tot = 1 * parseInt($(this).parent('tr').data('multiplier'));
                  //alert(parseInt($(this).parent('tr').data('multiplier')));
                }
              }
            });            
          $('tr.mulTotal td').eq(i).text(tot);
        }
    });
    </script> 
    </head>
    <body>
    <table cellpadding="10" cellspacing="0">
      <tr data-multiplier="7">
        <td>29</td>
        <td>921</td>
        <td>2</td>
        <td class="total"></td>
      </tr>
      <tr data-multiplier="2">
        <td>112</td>
        <td>9</td>
        <td>55</td>
        <td class="total"></td>
      </tr>
      <tr data-multiplier="5">
        <td>13</td>
        <td>81</td>
        <td>82</td>
        <td class="total"></td>
      </tr>
      <tr class="colTotal">
        <td></td>
        <td></td>
        <td></td>
      </tr>
      <tr class="mulTotal">
        <td></td>
        <td></td>
        <td></td>
      </tr>
    </table>
    <button id="calcRows">Calculate Rows</button>
    <button id="calcCols">Calculate Columns</button>
    <button id="calcMul">Calculate Multiplier</button>
    </body>
    </html>
    

    Any idea, why the table wouldn’t show up?
    When inserting the code into the text editor of wordpress, the table appears in the visual editor, but not in the page preview.

    • This reply was modified 6 years, 1 month ago by saib0t.
    Thread Starter saib0t

    (@saib0t)

    Yeah that’s pretty much what I was looking for. Thanks

    Thread Starter saib0t

    (@saib0t)

    Nice. Thank you.
    Sorry for the late reply.
    There’s just one little detail that needs to be changed: The possibility to remove the automated mark, by klicking on the cell.

    can you elaborate on what you want here: “Furthermore each marked cell per column should count as numerical value 1, so I can do further calculations with these values.”

    :

    Each marked cell counts as 1 point, which will be multiplied with a certain factor. This factor differs for each row. In the end all the points multiplied with their factor will be summed up for each column.

    Thread Starter saib0t

    (@saib0t)

    Thanks for your answer.
    Any specific reason, why you opt for Javascript instead of PHP?

Viewing 14 replies - 1 through 14 (of 14 total)