8 – Best practices for the mail body

Battery Exchange Network

The Stack Exchange network includes 175 question-and-answer communities, including Stack Overflow, the largest and most reliable online community on which developers can learn, share knowledge and build their careers.

Visit Stack Exchange

css – Clear body retaining only 2 elements

I have to clear everything from body less 2 items

I have tried the means below but none has worked:

  body > *:not("div#pedidosRelMensal, h1.resposta"){
    display: none;
  }

  body > *:not("div#pedidosRelMensal")not("h1.resposta"){
    display: none;
  }

  body > *:not(#pedidosRelMensal, h1.resposta){
    display: none;
  }

If I just do that:

 body > *:not(#pedidosRelMensal){
    display: none;
  }

to go well

But I also need the h1

magento2 – Magento 2 Add different body classes for different pages

Currently, I am working on HTML to Magento 2 conversion and I have received the HTML code from the designer who has the class in the body, so I added it in general

in the default.xml file in my Magento theme

but the main problem is that the body class is different for the other pages

for example

the body class of the home page is "home_page_body_class"

and for the other pages is "other_page_body_class"

I do not understand how to get there.

If anyone has an idea about it, please share it with me.

php – displays the custom view of the plugin on the front end in the body of the template

I've searched on google but nothing. I create a custom plugin. The administration area is displayed without any problem. The problem is on the front end, I do not know what action or what filter I have to call. When I use add_filter ('template_include', 'myPublicFunction'), the view is displayed without the inside of the template body.

add_filter("template_include", "publicViewCall");

enter the description of the image here

I need to include the view inside the model body.
thanks any help is appreciated

node.js – Body in the controller

I'm using objectionjs as ORM in the project and I do not understand why, when it's a body in the express request, I can not go to the functions;
The error that occurs is as follows:

enter the description of the image here

user.model.ts:

export class User extends Model {
  readonly id: number;
  name: string;
  password: string;
  email: string;
  role_id: number;
  active: boolean;
  created_at?: string;
  deleted_at?: string;
  updated_at?: string;
  mail_confirmed?: boolean;
}

user.controller.ts:

router.post('/', async (req: Request, res: Response) => {
  try {
    const { name, password, email, role_id, ...rest } = req.body;
    const user = await add({ name, email, password, role_id });
    if (user) {
      return res.status(200).json(user);
    }
    return res.status(200).json(());
  } catch (error) {
    return res.status(500).json(error);
  }
});

services.user.ts

export const add = async ({ ...rest }: User): Promise => {
  return await User.query().insertAndFetch({ ...rest });
};

Is it a problem when I type the variables?

theming – How to add a script to the site / app Drupal 8 just above the body tag?

How to add a script on the site / application Drupal 8 just above the body tag?

The supplier has provided some JS in the following form:


M & # 39; asked to place immediately above .

The script should only be executed for anonymous traffic.

Here's how I did it:

THEME = name of your theme

  1. kidnapped code
  2. Minified using https://javascript-minifier.com/
  3. Filename created-of-my-script.min.js
  4. Downloaded from THEME / js / custom / name-of-my-script.min.js
  5. Adding the library to the bottom of THEME.libraries.yml
name-of-my-library:
  version: 1.0
  js:
    js/custom/name-of-my-script.min.js: {preprocess: false} // {preprocess: false} is responsible for code showing up above 
  1. Add the following code in THEME.theme to an already existing function: function THEME_preprocess_page(&$variables) {}
$user_status = Drupal::currentUser()->isAnonymous();
if ($user_status) {
$variables('#attached')('library')() = 'THEME/name-of-my-library';
}
  1. Cache cleared.

Resources that helped:

armor – non-kinematic DR of advanced body armor

If you want to adjust the DR type of an armor, we can rely on the old "control of reality" mechanism introduced at the very beginning of GURPS (in From man to man, 1986).

The common soft Kevlar will reliably stop a common pistol bullet, so its DR should be at least as big as the average damage caused by a range of routine guns – say a 1911, Colt Peacemaker, something in .38 Special or something in 9mm – if it's not equal to most of the d-39's ;between them.

Likewise, if you have better armor, his DR should be based on what he's going to stop. If he has to absorb a bullet from an AK-47 he must have enough DR to do it.

I do not directly know Pinnacle Armor's claims or test data on his equipment, but modern military hard plate armor is partially ablative (hard plates absorb energy partly by breaking or collapsing). , and lose their effectiveness against the following shots). same location), and in new condition, can even stop bullets of 7.62×51 (common "ball" type, not shielding).

So choose a weapon against which you want to protect your version of armor and place your DR near the maximum damage of that weapon. Completed.

javascript – The body blur feature does not work with multiple modals

Intro – I have created a modal window in which several modal windows can be opened on each other and closed one by one. I've recently added a blur feature in which, if a modal window is opened, the background of the body becomes blurred and if a second window is opened. , the body and the first window become blurred. And it follows the same concept when closing … Closing the second window makes the first window normal and closing the first window makes the normal body bottom.

For this particular question, I created 3 modals – The first has a button to trigger it, the second can be opened from the body of the first modal and the third modal has a button

The blur feature mentioned in the intro works well only for First & Second modal and does not work for the third modal. In modal third, the closing of the modal window does not make the bottom of the body unsharp, contrary to the first two modals.

(The third modal is just a minimal example to explain this problem, I wish ideally that it works with n number of modals)

Hope that someone can give an effective solution

I've included all 3 – html, css and javascript codes in snippets, though I'm sure it just requires a little JavaScript fit.

let open_modals = ();

$(function() {

  // Get the button that opens the modal
  // read all the control of any type which has class as modal-button
  var btn = document.querySelectorAll(".modal-button");

  // All page modals
  var modals = document.querySelectorAll('.modal');

  // Get the  element that closes the modal
  var spans = document.getElementsByClassName("close");

  // When the user clicks the button, open the modal
  for (var i = 0; i < btn.length; i++) {
    btn(i).onclick = function(e) {
      e.preventDefault();
      modal = document.querySelector(e.target.getAttribute("href"));
      modal.style.display = "block";
      open_modals.push(modal.id);
      document.body.style.overflow = "hidden";

      if (this.parentElement.parentElement.nodeName == 'BODY') {
        document.body.classList.add("open");
      } else {
        this.parentElement.parentElement.parentElement.classList.add("open");
      }
    }
  }

  function checkRenableScroll() {
    if (!open_modals.length) {
      document.body.style.overflow = "scroll";
    }
  }

  // When the user clicks on  (x), close the modal
  for (var i = 0; i < spans.length; i++) {
    spans(i).onclick = function() {
      for (var index in modals) {
        if (typeof modals(index).style !== 'undefined' && modals(index).id == open_modals(open_modals.length - 1)) {
          modals(index).classList.add("modal-content-active");
          var item = modals(index);

          if (index > 0) {
            var parentModal = spans(index - 1).parentElement.parentElement;
            parentModal.classList.remove("open");
            if (parentModal.getElementsByClassName('open').length > 0) {
              parentModal.getElementsByClassName('open')(0).classList.remove("open");
            }
          } else {
            document.body.classList.remove("open");
          }

          setTimeout(function() {
            item.classList.remove("modal-content-active");
            item.style.display = "none";
            open_modals.pop();
            checkRenableScroll();

          }, 400);
        }
      }
    }
  }

  //   When the user clicks anywhere outside of the modal, close it
  window.onclick = function(event) {
    if (event.target.classList.contains('modal')) {
      for (var index in modals) {
        if (typeof modals(index).style !== 'undefined' && modals(index).id == open_modals(open_modals.length - 1)) {
          modals(index).classList.add("modal-content-active");
          var item = modals(index);

          if (index > 0) {
            var parentModal = spans(index - 1).parentElement.parentElement;
            parentModal.classList.remove("open");
            if (parentModal.getElementsByClassName('open').length > 0) {
              parentModal.getElementsByClassName('open')(0).classList.remove("open");
            }
          } else {
            document.body.classList.remove("open");
          }

          setTimeout(function() {
            item.classList.remove("modal-content-active");
            item.style.display = "none";
            open_modals.pop();
            checkRenableScroll();

          }, 400);
        }
      }
    }
  }
})



  
  
  



• first modal

The second modal can be triggered from the body of the first modal window
• third modal

@import url('https://fonts.googleapis.com/css?family=Quicksand&display=swap');

/* The Modal (background) */

.modal {
  box-sizing: border-box;
  font-family: 'Quicksand', sans-serif;
  display: none;
  /* Hidden by default */
  position: fixed;
  /* Stay in place */
  z-index: 1;
  /* Sit on top */
  padding-top: 3.125rem;
  /* Location of the box */
  left: 0;
  top: 0;
  width: 100%;
  /* Full width */
  height: 100%;
  /* Full height */
  overflow: auto;
  /* Enable scroll if needed */
  background-color: rgb(0, 0, 0);
  /* Fallback color */
  background-color: rgba(0, 0, 0, 0.4);
  /* Black w/ opacity */
}


/* Modal Content */

.modal-content {
  color: white;
  position: relative;
  background-color: #171B20;
  margin: auto;
  padding: 0;
  border: 0.0625rem solid #888;
  width: 90%;
  box-shadow: 0 0.25rem 0.5rem 0 rgba(0, 0, 0, 0.2), 0 0.375rem 1.25rem 0 rgba(0, 0, 0, 0.19);
  -webkit-animation-name: animatetop;
  -webkit-animation-duration: 0.4s;
  animation-name: animatetop;
  animation-duration: 0.4s;
}


/* Add Animation */

@-webkit-keyframes animatetop {
  from {
    top: -300px;
    opacity: 0;
  }
  to {
    top: 0;
    opacity: 1;
  }
}

@keyframes animatetop {
  from {
    top: -300px;
    opacity: 0;
  }
  to {
    top: 0;
    opacity: 1;
  }
}

@-webkit-keyframes animateBottom {
  from {
    top: 0px;
    opacity: 1;
  }
  to {
    top: 500px;
    opacity: 0;
  }
}

@keyframes animateBottom {
  from {
    top: 0px;
    opacity: 1;
  }
  to {
    top: 300px;
    opacity: 0;
  }
}

.modal-content-active {
  -webkit-animation-name: animateBottom;
  -webkit-animation-duration: 0.4s;
  animation-name: animateBottom;
  animation-duration: 0.4s;
}


/* The Close Button */

.close {
  color: #F0B823;
  float: right;
  font-size: 2.6rem;
  font-weight: bold;
  position: absolute;
  right: 0.25rem;
  top: -0.25rem;
}

.close:hover,
.close:focus {
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.modal-header {
  padding: 0.125rem 1rem;
  background-color: #171B20;
  color: #F0B823;
}

.modal-body {}

.modal-button {
  font-family: 'Quicksand', sans-serif;
  background-color: #171B20;
  border: none;
  color: white;
  padding: 0.248em 0.496em;
  text-align: left;
  text-decoration: none;
  display: inline-block;
  font-size: 1.750rem;
  margin: 0.124em 0.062em;
  -webkit-transition-duration: 0;
  /* Safari */
  transition-duration: 0;
  cursor: pointer;
  width: auto;
}

.modal-button:hover {
  background-color: #171B20;
  color: #F0B823;
}

.pic {
  margin: auto;
  display: block;
  height: auto;
  width: 50vh;
}

.headertext {
  font-family: 'Quicksand', sans-serif;
  display: block;
  text-align: center;
  font-size: 2rem;
}

.bodytext {
  font-size: 1.125rem;
  font-family: 'Quicksand', sans-serif;
  display: block;
  padding: 0.625em 0.9375em;
  line-height: 2rem;
}

p {
  display: block;
  margin: 0;
  padding: 0;
}

.open>* {
  -webkit-filter: blur(5px);
  -moz-filter: blur(5px);
  -o-filter: blur(5px);
  -ms-filter: blur(5px);
}

.modal {
  -webkit-filter: blur(0px);
  -moz-filter: blur(0px);
  -o-filter: blur(0px);
  -ms-filter: blur(0px);
  filter: blur(0px);
}

.modal .open {
  -webkit-filter: blur(5px);
  -moz-filter: blur(5px);
  -o-filter: blur(5px);
  -ms-filter: blur(5px);
  filter: blur(5px);
}

.bold {
  display: inline-block;
  font-weight: 900;
}

JWT: In a server-to-server query, do I have to sign the body of the query in its entirety?

please let me know if this question is better suited to stackoverflow

show two servers:

  1. an "auth" server that provides users with authorization tokens containing relevant claims on their behalf
  2. a "paywall" server that, after receiving payment from a user, sends a request to the authentication server to add the "premium" claim to the user's account (and this server can also distribute restricted content to users with the claim)

both servers have access to a shared secret key, which allows the Paywall server to check if the user claims to display restricted content

I want to verify that all claims modification requests received by the authentication server actually come from my trusted Paywall server.

I think the paywall server should simply sign each claim modification request in its entirety in a JSON web token, so that the authentication server can check the identity of the sender and check that none of the claim has been falsified.

in this case, it seems that the entire body of the application would be just a big JSON Web token (instead of a simple authorization header) because I can not trust no unsigned data in the JWT.

My question is: does this reasoning make sense or is it excessive? Is my solution redundant? Maybe HTTPS can already effectively solve this problem? I think HTTPS is a way to secure communications between two points, but that may not guarantee the identity of one or the other end.

thank you, any advice is appreciated!

7 – How can I export the raw body of a node?

I have configured a CSV view with views_data_export. I would like to export the raw body of the nodes. So I want to keep both raw unscratching and raw HTML in the CSV file.

Is there a way to do that I've neglected? Should I add a trainer who does not do anything? If so, how can I do this?

enter the description of the image here

enter the description of the image here


I thought I solved the problem by checking the option "Rewrite the output of this field" and using [body-value], which is the gross value.

enter the description of the image here

And that gives me raw unscratching but still does not give me raw HTML code.